In my never-ending quest to rid myself of all possible loafing time, I have decided to dive back into the world of game programming. This time I will attempt to make a generic text adventure engine, for the purpose of re-creating great games like Zork, Adventure, and Leather Goddesses of Phobos in a Flash environment.
This is the core of creating a consistent game: figuring out how all the pieces and parts fit together. Making things react differently in different environments. Defining those environments. Setting up the localized laws of cause-and-effect.
Probably the simplest type of text adventure is the choose-your-own adventure, which is essentially a mostly linear, occasionally branching, multiple choice quiz:
You are clinging to a vine halfway down the side of a cliff. At the top of the cliff a tiger is waiting to eat you. At the bottom of the cliff another tiger is waiting to eat you. Two mice are chewing through your vine. You notice a strawberry plant bearing a single, perfect, ripe strawberry growing out of the cliff next to your head.
Do you want to:
A) Climb up
B) Climb down
C) Eat the mice
D) Eat the strawberry
Quite simple, and with a predetermined path to the outcome. These adventures tend also to go in one direction. Once you pick something up, you cannot put it back down.
The text adventures a la Zork use simple language parsing which allows the player to state, in simple, precise sentences, exactly what he/she wants to do at any particular moment:
Go North
Open Door
Get Key
Unlock Door With Key
Open Door
Drop Key
Go East
Close Door
…and so forth. Suddenly we are not just moving through the environment, we are interacting with it on a significant (if limited) level When I picked up the key, I removed it from one environment (a room) and made it a part of another (me).
So now I am in an environment. In a one-person game this is a useless statement, since there is not another autonomous thing which will act within that environment in a way that will affect me. I can change my surroundings, but they cannot change me. Sure, a troll may kill me, or a thief may steal steal the key before I get a chance to use it to open a door. These are triggered, programmed events. They are part of a solvable system. The only way to make the system non-solvable is to introduce another outside agent: Another player.
This takes us into the realm of the MUD, or Multi-User Dungeon; essentially a text adventure with 1 or more players interacting with each other and the environment… and here we get far beyond the scope of what I can hope to accomplish in any reasonable amount of free time.
By the by, this genre of games is commonly referred to as Interactive Fiction
. Here are a few helpful websites:
The Brass Lantern
The Interactive Fiction Archives
Seton Hill University notes on Interactive Fiction
Play Infocom text adventures online !!! (Java applet)