Lets make a Commodore 64 Text Adventure Game!A simple tutorial by John Christian LonningdalPart 4 - Room, Object and Direction descriptions
Ok, next we need to add the room descriptions and here we use the handy ON..GOSUB method
based on the room number we are in:
Nothing fancy here, it prints out "You are " first and then the description. Not all adventures
has this though since it limits the way rooms are presented. Also in our case since there is no
word wrap going on before text is outputed we might get words flowing from one line to another
which doesnt look very good. We will have to do something about this later.
Next we have similar object descriptions based on the room we are in. The only reason we can do
this is that objects can never be in another room since we do not support taking and DROPing objects
elsewhere.
It is clear that this will have to be improved since all adventure games should allow picking up
objects and dropping them elsewhere. Additionally the way INVENTORY listing works now its also
a duplication of the strings output for objects that you can carry with you.
Finally we have the listing of directions:
Again, this is a terribly simple way of doing it and basically almost all adventures use some kind of
configuration per room to specify directions so there is a part that we will most definitely improve
upon for our text adventure game engine. One notable feature in the listing above is that there is
some logic connected to the visibility of a direction depending on whether the BOULDER has been pushed
away or not. This is quite unusual really since most adventures usually open up special commands that
can be done on objects to open up a new direction. For example if you push a barrel and find a trap
door under it, rather than listing a DOWN direction they list a new object called TRAPDOOR and the
player would have to write GO TRAPDOOR or something similar. Both ways are equally good in my opinion
but conditional directions are not used very often. We will have to decide whether we want to keep this
feature in our new and improved version of the text adventure engine.
Part 5 - Room specific commands and game logic Back to index |