Edited Version at A20600605.
One of the earliest forms of computer game, text-based adventures1 have been around for many years and have long since been replaced by more complex games with 3D-rendered graphics and fast gameplay which have made storylines more or less obsolete. However, while creating these modern games is very tricky and requires a ridiculous amount of technical knowledge, writing a text-based adventure is relatively straightforward. This Entry thus looks at the basics of creating a text-based adventure, without going into too much detail.
How It Works
The actual process of writing a text-based adventure involves creating a program for a computer that will allow the player to interact with the game. Luckily enough, you don't have to start from first principles in order to write one of these programs, as there are several programming tools available that will do a lot of the legwork and complicated stuff for you. These tools generally require you to add code which defines every single little thing you want to have in your game, including the rooms, objects and characters, along with the actions which players can perform in the game. The nitty gritty of the programming is the subject of another Entry, and before diving into the actual writing of code, you should have a good idea of what it is you will be trying achieve with that code.
As with so-called static novels (aka books), text-based adventures can have just about any storyline you want. The only difference is that the player has to be involved in some way in how the story progresses - some games use flashbacks and the like to reveal a little more detail each time the player successfully solves a puzzle or finds something, while in others the story simply occurs as the player follows one or more of the correct routes through the game. However, you should try to avoid simply telling a story while the player's virtual self watches, and the game shouldn't seem to 'railroad' the player in and force them to follow the story at every step. It's not necessarily easy, but if you want to make a good game, a good story is a must.
Common genres of text-based adventure storyline include fantasy, science fiction, mystery and 'slice of life', the latter simply being a snapshot of modern life. While a wide range of subjects are easily coverable, the most intriguing stories all have a common theme to them. Since the player begins the game by immediately taking control of someone they know little about, it is possible to make the story more compelling by letting them slowly discover who they are actually playing. Babel, which is linked to at the end of this Entry, does this through the use of amnesia and flashbacks, and is worth a look.
Some games have multiple plots, all woven in amongst each other, while other games use plots that branch out based upon player choices, either reconnecting later, or leading to separate endings. For some the simple plot is best, firstly as it is easier to write, and secondly because once the player has completed the game, they know that they've seen pretty much everything that was in it. Others prefer branching plots, which can bring the player back to see what would have happened if they'd done something differently.
In a novel, the writer can totally control the main character, and so where they are, what they are doing and how they are feeling can always be that which most benefits the story. In an interactive work, this is a much trickier thing to do. It becomes necessary to break the desired plot down into its smallest parts and let the player uncover those parts as they progress. Key scenes that the player is present for are just one example. In some cases, the scene may be as simple as writing down the ideal of what happens as if it were the only thing that could happen, and then implementing it, adding adjustments to accommodate the player acting differently. In other cases it may be that you need some way to keep the player occupied doing something, whilst the scene unfolds around them.
Not everything has to be imparted in one big, dramatic scene, though. A general sense can be imparted from the mood, or foreshadowing or even the repetition of some seemingly innocuous detail.
The Player Character
The 'player character' is the main character of the adventure, as played by whoever has just picked up and started playing the game. There are generally four ways in which the identity of this main character is decided:
Indeterminate - this is a sort of 'everyman' who has no predefined emotions or motivations and lacks a strong background. This sort of character is effectively defined by the character of whoever is playing the game, thus making conversation with other characters in the game a little bland unless the game is set in a place that is alien to the character.
With some personality - the real detail of the character is still lacking, but they are made to be a certain sort of person. This gives some interest but still hampers the writer's ability to add a background to the character.
Fixed - these player characters are well-defined, and can either be based upon a well-known cliché or have a unique personality invented by the author. While using a cliché or adapting a well-known story brings a wealth of background knowledge to the game, creating an original character can give the game more depth. Though the player may not be able to fully identify with the feelings of the character, they should be able to understand them - it's down to the writer to make sure this is the case.
Player-defined - these characters either develop over time depending on the actions made by the player, or are defined by the player at the start, thus allowing the player to choose which type of character they would like to play.
Interaction is the crux of every text-based adventure - once you have placed the player at their starting point and provided whatever introduction is necessary, what happens next is up to them. At the very least, players need to be able to move from one room to the next, pick up, drop and use items they find, and generally be able to look around and gain a feel for where they are and what is going on. Interaction with other characters in the game adds to the realism and can be achieved either through listing a number of things that can be said, or through allowing the player to type in whatever they want to say and then trying to decode it so that the game can respond.
Text-based interaction is achieved through a parser which takes what the player has typed and interprets it to discover what it is the player wants to do. The easiest parsers to create are those which detect one word commands such as look, examine or get, and then try to perform that action on whatever is described in the text following the command. Parsers should either come with a list of verbs which are accepted, or should be capable of understanding a variety of verbs so as to avoid forcing the player to choose the correct verb.
Some games go as far as letting you talk to the various characters in the world, with some such interactions being vital either in terms of the information that they yield or the things that the other characters can do for you. Interaction with other characters adds a lot of depth to a game, but makes it a lot more time-consuming to make.
Text-based adventures usually take place in a world consisting of a series of rooms or areas linked to each other, with the player inhabiting precisely one of these rooms at any particular time. From any particular room, the player should be able to travel to adjacent rooms via a compass direction such as north, east, south or west, depending on which links exist between rooms or areas. While having four directions in which a player can travel can make things simpler, it is quite usual to include eight compass directions in total, thus including northeast, northwest, southeast and southwest. Be warned that players can also move up and down stairs and so forth if you give them the chance. It is best to imagine your world as a series of squares on a map, each linked by horizontal, vertical and diagonal lines to those which are accessible from it - try to design it so that all of the rooms fit neatly onto the map, rather than just squeezing in areas wherever you can.
Each room should come with a description consisting of its appearance and contents along with any additional information, such as sounds or smells, which might add to the realism. Once the player has visited a room once, a slightly more concise description should be given so as to avoid overwhelming the player with text as they travel through areas that they have already explored. Though only giving a 'terse' commentary on rooms that have already been visited is the default in text-based adventures, it is good practice to allow the player to use a 'verbose' setting so that the player can ask the game to continue to be descriptive no matter what.
If inside, rooms can be linked by doors and corridors, while outside it is usually acceptable to just carve the world up into chunks and treat each one as a room. While the outside world should be quite open and accessible, it is best not to give every single indoor room eight different doors, as this will make the layout of your world confusing.
Players should ideally be able to examine many of the objects and details of each room, including such things as the wallpaper, the furnishings or the weather if outside. Players should definitely be able to look at items that they can pick up and characters they can talk to, but limiting their field of view to only these can make the world unrealistic.
Text-based adventures are usually full of items which can be grabbed by the player to the extent that it may seem as if the protagonist is a kleptomaniac. Items can range from being absolutely vital to completely pointless, with some having an obvious purpose while others are shrouded in mystery. It is best to give the player some idea as to what the object is for without giving the game away, and to try to avoid including items which are completely pointless unless they have some entertainment value later on. Items are stored in the player's inventory, which should preferably be viewable at all times.
Items can sometimes only be obtainable if the player does the right thing, as this makes the game more challenging than simply allowing the player to hoard everything they come across. If a game is to have many, many items, consider tactfully ridding the player of all their pointless items before they move on to the next part of the game. This can be done by forcing them to negotiate an obstacle where they cannot carry all their objects, or by having them captured2. Alternatively, you could simply limit the number of items a player can carry, bearing in mind that allowing the player to carry only the minimum number of items required to complete the game might be a little overly-punitive.
In text-based adventures, puzzles are the things which test the player's abilities and make the game more than a simple matter of finding an object and using it. Puzzles can range from using objects in the right manner to achieve something to finding the way through a maze of some sort, with some being vital to the plot while others are simply there to give the player something interesting to do. Ideally, early puzzles should be easy and puzzles should get harder as the game progresses.
One of the main points of having puzzles in a game is to force the player to delve further into the game's environment by looking around, experimenting with various items and talking to the game's characters. Puzzles should thus be carefully thought out - try not to rush them, and if possible make them part of your story as opposed to just throwing them in from nowhere.
Naturally, the game should progress due to the player being successful rather than simply occurring at random. Progression can either take the form of new rooms being accessible to the player, or can be achieved by transporting the player to an entirely new area. However, it is best not to whisk the player off to a completely new world every single time they achieve anything, as they will probably be able to cope with the concept that the exciting new things will be in the areas that have just become available rather than those which they have already seen. Also, it is a good idea to have several things to achieve in any one area so as to give the player plenty of things to look into if they get stuck on one.
In terms of helping the player to progress, the odd hint can often be extremely valuable. For instance, advising the player that they have forgotten to do one of the things they should do before leaving an area can be helpful, though naturally a balance should be found between reminding the player and badgering them. Alternatively, you could include hints in the game so that the player can request them if needs be. It is especially useful to provide hints before killing off the player, as it would be particularly unfair for the main character to die without fair warning.
A Good Example
A particularly good example of a text-based adventure for those who have never played one is Babel by Ian Finley. The game can be installed to run straight away without any hassle by downloading and running the Windows executable file.