Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

17. Domain-Specific Languages > Creating Custom Game Commands for Wizard's Adve...

Creating Custom Game Commands for Wizard's Adventure Game

image with no caption

If you remember, when we last encountered the game starring our wizard and apprentice in Chapter 5 and Chapter 6, we could walk around the world and pick up objects. However, we couldn’t really perform any other interesting or fun actions. To make a game fun, it should include special actions that can be performed with certain objects and/or at certain locations in the game. We need frogs that can be kissed, dragons that can be fought, and perhaps even maidens that can be rescued!

Creating these kinds of interesting activities in the game poses a unique challenge. On the one hand, there are clearly many similarities between such different game actions. For instance, most of them will require us to have an object in our possession. On the other hand, they all need to have unique and idiosyncratic properties (enabled through command-specific Lisp code) or the game becomes boring. As you’ll see, a DSL can help you add many such unique commands to your game.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint