mind games |
Quentin Heath describes a simple system for creating complex adventures
ARTIFICIALLY intelligent characters can add atmosphere to any adventure game, but the most important parts remain the scenario and the objects it contains.
The most popular means of programming a scenario is to use a grid, first plotted on paper and then transferred to the computer either as a compact data block within a machine code program or an array within a Basic program. Such a structure is shown in figure one which is the floor plan of an Argolian monastery. Each of the squares represents one move and the scale could be adjusted to make it one room or part of a room.
|
The floorplan in figure one does not contain any information about the locations. Instead it contains a list of numbers. These values are address pointers to various other lists which describe locations and events within them. In figure one, for instance, location B1 lists a series of numbers which in themselves mean nothing. To the adventure control program, however, each number has a meaning and they are:
When the program's movement routine places a player at room B1 in the monastery it needs a long location description in order to inform the player what is going on. It finds the number 1000 in that position on the list and then goes to the memory address where the room description is stored. When it has found it the program gives the information in figure two to the player.
address | room | monster | object |
---|---|---|---|
1000 | dark room | ||
1030 | Smike | ||
1060 | crystal egg | ||
2000 | chapel | ||
0 | |||
0 | |||
Figure 2. |
The next action of the program is to see if any objects are stored within the room. The object description for room B1 is placed at memory location 1060 and printed out after a location description. In the example the object is a small glass egg and the program would produce the printout shown in figure three.
If no object has been stored in a particular location the address indicator in the grid for 'object description' should contain a value which tells the program not to look for an object. The program may also change the value if an object is removed during play.
Using the grid system the task of programming a game is made easier because the program only needs to manipulate the grid of memory references and not the lists of descriptions.
The grid in the example is simple and more factors can, and should, be added to it. For instance, the fighting abilities of a monster who is known to haunt a room could be included in a list indicated by the location grid.
These numbers, discussed last month in Mind Games, could be compared to player strengths and weaknesses when a fight takes place and changed as the monster wins or loses. If death occurs a zero can be placed in the reference grid.
The monastery shown in the example grid has only one level. It is, however, easy to develop a grid in which you can move to different floors.
Grids should be created as if they were being produced for a one level adventure but with one important difference. A new reference is added to the list for each location which indicates whether there is a staircase in the room and in which direction, up or down, it goes. The grids are laid end to end in memory.
All the computer needs to do is look at the indicators on the list. If they are set to any number except zero there is a staircase in the room. The player is then asked whether a transition from one floor to another is required. If so, the program then switches to a different floor.
The example, which uses absolute RAM memory addresses, is for a machine code adventure program but by creating a series of arrays, one for each grid and one for each list of information, the grid reference system can be used within a Basic adventure program. The machine code addresses are translated into array elements and a three dimensional array can store any number of grids.
The grid reference system is simple to use and, with the techniques described in previous articles about character generation and manipulation, should enable a substantial artificially intelligent adventure game to be written.
You are standing in a DARK room. Figure 3. |