Text-based adventures1, one of the earliest forms of computer game, have been around for many years, but have long since been replaced by more complex games with 3D-rendered graphics and fast gameplay2. However, while programmers require a ridiculous amount of technical knowledge to create these modern games, writing a text-based adventure is relatively straightforward. This Entry looks at the most basic principles of creating a text-based adventure.
How It Works
The actual process of writing a text-based adventure involves creating a computer program that will allow the player to interact with the game. Luckily, you don't have to start from first principles in order to write one of these programs, as several programming tools exist that will do a lot of the legwork and complicated stuff for you. These tools generally require you to add code that defines every single little thing you want to have in your game, including the rooms, objects and characters, along with the actions that players can perform.
The nitty gritty of the programming will not be discussed here as it is subject enough for an entire other Entry - besides, before diving into a pile of literature discussing the actual writing of the code, you should have a good idea of what you are trying to do with it.
As with so-called static novels (aka books), text-based adventures can have any storyline you want. However, in a text-based adventure the reader has a direct involvement in the progression and direction of the story. Some games use flashbacks to reveal a little more detail each time the player successfully solves a puzzle or finds something. With 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. 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 text-based games cover a wide range of subjects, 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 actually are. The game 'Babel', for example, does this through the use of amnesia and flashbacks, and is worth a look. Some games, on the other hand, include familiar characters - perhaps licensed from a book, movie or TV show - which covers some of the groundwork for the game designer, as the player will have some idea of who they are from the outset3.
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 endings4. For some, a simple plot works best. Firstly, because you can write a simpler plot with greater ease; and secondly, because once the player has completed the game, they know that they've seen pretty much everything in it. Others prefer branching plots, which can bring the player back to see what would have happened if they'd done something differently or from another angle5.
In a novel, the writer can totally control the main character. He can decide the where, when, what and how to most benefit the progression of the story. In interactive fiction, this is a much trickier thing to do. It becomes necessary to break the desired plot down into small 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, 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 - while the character still lacks real detail, it still has enough nuisances to come across as 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 necessary introductions, 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 together, 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.
You are in the front yard of a large abandoned Victorian house. Stone steps lead up to a wide porch.
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. A player struggling to find clues or items will continue to appreciate a fuller description of areas already visited.
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.
> take molecular hyperwave pincer
> examine molecular hyperwave pincer
It looks like every other molecular hyperwave pincer you've ever seen.
Text-based adventures are usually full of items that can be grabbed by the player to the extent that it may seem as if the protagonist is a kleptomaniac. Items can range from the absolutely vital to the completely pointless, with some having an obvious purpose while others remain mysterious. 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 on6. 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 you intend your game 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 captured7. 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 that 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 way to achieve something to finding the correct route through a maze, with some being vital to the plot while others are simply there to give the player something interesting to do. Ideally, puzzles should start easy near the beginning of the game and get progressively harder.
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.
> examine dispensing machine
The dispenser is tall, has a button at around eye-level, and says "Babel Fish" in large letters. Anything dispensed would probably come out the slot at around knee-level. It bears a small label which reads "Another fine product of the Sirius Cybernetics Corporation."
> press button
Which button do you mean, the dispenser button, the red button, or the green button?
> press the dispenser button
A single babel fish shoots out of the slot. It sails across the room and through a small hole in the wall, just under a metal hook.
Naturally, the game should progress due to the player's successes rather than simply at random. Progression can either take the form of the player having access to new rooms or 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, otherwise they may start thinking exciting new things will always be in the next area rather than engaging them in thoughtful activities and searching in the current location. 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 something.
In terms of helping the player to progress, the odd hint can prove invaluable. For instance, advising the player that they have forgotten to do something before leaving an area can be helpful. However, you should strike a balance between reminding the player and badgering or mollycoddling them. Alternatively, you could include hints in the game so that the player can request them if needed. Always supply a couple of solid and graphic hints before killing off the player, as it would be particularly unfair for the main character to die without fair warning.
You stand at the base of the tower situated at the northern corner of the castle. Fat drops of rain fall from the darkened sky above, as thunder rumbles in the distance. Above, you spy a lit window about two-thirds of the way up the tower. A muddy trail follows the curve of the tower to your left. No trail leads to the right, but you can hear what sounds like dogs barking in the distance over in that direction.
> climb the wall.
You dig your fingernails into the gaps between the rough stones of the wall and pull yourself up. You find it tough going making headway, struggling to find cracks to lodge your fingers or toes in. The rain falls faster, rapidly drenching you to the skin.
> climb the wall.
You hang several metres off the ground, the rain continuing to pound down on you. The wall almost shines, slick with the flow of water. Your fingers feel numb and blood runs freely from several cuts. You pause for a moment and glance up towards the window, still some way off. You struggle to draw breath with the exertion of the climb.
> climb the wall.
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, if you run Windows; or the Macintosh executable file, if you have a Mac. Meanwhile, if you run Linux you'll need to download the .gam file and run it using TADS 3 for Linux but, being of the sort who can use Linux, you'll probably cope.
Also, you might want to take a look at the classic text adventure version of The Hitchhiker's Guide to the Galaxy, playable completely online with enhanced complimentary graphical interface.