Official Blog of the Adventuron Text Adventure Creation System

Monday 20 May 2019

Coding A Room Escape Game In Adventuron


Single location "escape from the room" games started with the parser, with 1988's "Behind Closed Doors" series, and sans-parser, the genre is more popular than ever. I thought I'd produce a tutorial of how one might take the genre back to its roots.

In this post I include the Puzzle Dependency Diagram of a trivial room escape game, and include the final source code for the game (minus theming).

  • The full step by step tutorial is available here.
  • The game can be played here.
  • The PDC was produced using Vizon, here.








start_at = cell

locations {
   cell : location "You are in your cell. You see a door, a bed and bland wallpaper adorns the walls." ;
}

objects {
   wallpaper : object "a strip of wallpaper" ;
   pen       : object "a pen"                ;
   key       : object "a small key"          ;
}

booleans {
   is_key_in_keyhole   : boolean "true"  ;
   is_key_on_paper     : boolean "false" ;
   is_paper_under_door : boolean "false" ;
}

vocabulary {
   : noun / aliases = [wallpaper, paper]
}

on_command {

   : match "search bed; examine bed"  {
      : if (has_not_created "pen") {
         : print "You find something" ;
         : create "pen" ;
         : press_any_key ;
         : redescribe;
      }
   }

   : match "examine wallpaper"  {
      : if (has_not_created "wallpaper") {
         : create "wallpaper" ;
         : print "A piece of the wallpaper falls away" ;
         : press_any_key ;
         : redescribe;
      }
      : else {
         : print "You think you should leave the rest of the wallpaper in place." ;
      }
   }

   : match "examine door"  {
      : print "A solid looking oak door with a keyhole." ;
      : if (is_paper_under_door) {
         : print "The wallpaper is peeking out from under the door." ;
      }
   }

   : match "examine keyhole"  {
      : if (is_key_in_keyhole) {
         : print "There appears to be a key in the keyhole on the other side of the door." ;
      }
      : else {
         : print "The key is no longer in the keyhole.\nYou can't see anything else of interest due to the darkness." ;
      }
   }


   : match "slide wallpaper;insert wallpaper;place wallpaper"  {
      : if (is_carried "wallpaper") {
         : if (noun2_is "door") {
            : if (is_paper_under_door) {
               : print "You can't slide it under the door any more." ;
            }
            : else {
               : print "You slide the wallpaper under the door." ;
               : set_true "is_paper_under_door" ;
               : destroy "wallpaper" ;
            }
         }
         : else {
            : print "Where?" ;
         }
      }
      : else {
         : print "You don't have it." ;
      }
   }

   : match "poke keyhole; poke key; insert pen; put pen"  {
      : if (is_key_in_keyhole) {
         : if (is_carried "pen" && (noun2_is "pen" || noun2_is "keyhole" )) {
            : set_false "is_key_in_keyhole" ;
            : if (is_paper_under_door) {
               : print "The key falls onto the paper." ;
               : set_true "is_key_on_paper" ;
            }
            : else {
               : print "The key falls onto the floor behind the door and bounces away." ;
               : print "More planning is perhaps required." ;
               : print "GAME OVER" ;
               : end_game ;
            }
         }
         : else {
            : print "Your finger is too big." ;
         }
      }
      : else {
         : print "The key has already fallen" ;
      }
   }

   : match "pull paper; get paper"  {
      : if (is_paper_under_door) {
         : pocket "wallpaper" ;
         : if (is_key_on_paper) {
            : print "You pull the paper back from underneath the door. You also take the key that is resting upon it." ;
            : pocket "key" ;
         }
         : else {
            : print "You pick up the wallpaper." ;
            : pocket "wallpaper" ;
         }
         : set_false "is_paper_under_door" ;
         : set_false "is_key_on_paper" ;
         : press_any_key ;
         : redescribe;
      }
   }

   : match "unlock door; open door"  {
      : if (is_carried "key") {
         : print "Using the small key, you unlock the door, open it, and continue onward to your next adventure." ;
         : press_any_key ;
         : end_game ;
      }
      : else {
         : print "The door is locked" ;
      }
   }
}

25 comments:

  1. i was glad to see this amazing site which enhance my knowledge Notepad Mac

    ReplyDelete
  2. I really enjoy reading and also appreciate your work. Passe de Elite

    ReplyDelete
  3. As you look at each company you will see some that have photographs of movie stars and people having fun in a casino on the front page of their website. Forget all that material designed to attract you because it is not important.

    sbobet88 login

    ReplyDelete
  4. Today, I was just browsing along and came upon your blog. Just wanted to say good blog and this article helped me a lot, due to which I have found exactly I was looking. asikqq

    ReplyDelete
  5. I can’t believe focusing long enough to research; much less write this kind of article. You’ve outdone yourself with this material without a doubt. It is one of the greatest contents. asikqq

    ReplyDelete
  6. this blog was really great, never seen a great blog like this before. i think im gonna share this to my friends.. interior design ideas

    ReplyDelete
  7. Norse Foundry provides metal dice accessories to gamers worldwide. All designs are specifically innovated to give gamers a unique experience with RPGs and Wargames alike. Norse Foundry

    ReplyDelete
  8. Numerous hassock beds accompany a helped lift framework which implies the bed top can be lifted effectively and getting to the extra room is straightforward and safe.my review here

    ReplyDelete
  9. This article was written by a real thinking writer. I agree many of the with the solid points made by the writer. I’ll be back. wm casino

    ReplyDelete
  10. This is my first visit to your web journal! We are a group of volunteers and new activities in the same specialty. Website gave us helpful data to work. บัตรเติมเกม

    ReplyDelete
  11. Players that purposefully hinder play will be cautioned and if such conduct proceeds may have their records suspended.satta king

    ReplyDelete
  12. This is in reality great to peruse substance of this blog. An is exceptionally broad and tremendous educated stage has been known by this blog. custom sliding windows

    ReplyDelete
  13. There can also moreover some precise strategies in keeping with location or knowledge. Your competencies depend on how you bought this opportunity and wherein you have professional. non-public or expert training may distinguish between each other. idea over right here are beneficial for distinct guys additionally because it did for me. Composite doors in Columbus

    ReplyDelete
  14. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work Kafka

    ReplyDelete
  15. The model is an estimate to and a rearrangements of the real world (regardless of whether it's a nonexistent reality), since it is plainly unreasonable to incorporate everything about to the degree of molecules or quarks.see here

    ReplyDelete
  16. Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. BYDLENÍ

    ReplyDelete
  17. Thanks for this great post, i find it very interesting and very well thought out and put together. I look forward to reading your work in the future. 토토사이트

    ReplyDelete
  18. Part of this is due to it being a less physically demanding sport and the need for less substitutions, and another part is due to needing less specialist players, such as kickers, punters, special teams, offensive lineman, etc. dart set for adults

    ReplyDelete
  19. This is truly an practical and pleasant information for all. Thanks for sharing this to us and more power play fun games

    ReplyDelete
  20. I am incapable of reading articles online very often, but I’m happy I did today. It is very well written, and your points are well-expressed. I request you warmly, please, don’t ever stop writing. Casino Near me

    ReplyDelete
  21. Without fail, your writing style is top professional; even your website also looks amazing thank you for posting. 그래프게임

    ReplyDelete
  22. Excellent information on your blog, thank you for taking the time to share with us. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. Medical Billing Specialist

    ReplyDelete
  23. UFABET UFA Online football betting Baccarat Online casinos are complete on one website. Register today, there is no minimum. UFABET

    ReplyDelete
  24. There is noticeably big money to comprehend this. I suppose you’ve made specific nice points in functions also.sa gaming

    ReplyDelete
  25. find the best warranties and mattress brands available. Find a mattress distribution center cheap truck mattress

    ReplyDelete