7.13. Traveling Characters

| Chapter 7: Other Characters |

| 7.13. Traveling Characters

There are a number of ways we can make characters navigate our map. We might reasonably want them to approach and follow the player (as in Van Helsing); or to allow the player to follow characters who have left the room (as in Actaeon).

Characters who are less interested in the player will more likely follow their own courses around the available geography, however. A character may move randomly from room to room, as demonstrated in Mistress of Animals; he may follow a path that we have specifically written in advance, as Odyssey shows; or, most elegantly, he may use the "best route" calculation to find the best possible way to a given target room, as seen in Latris Theon.

This final method is arguably the neatest solution to character movement, allowing for characters to act in sophisticated ways; if we incorporate the Locksmith extension, other characters will even unlock and open doors that are in their way. The chief catch is that it should not be used too profligately with large numbers of characters, since on slow machines the processing power required to plan all their travel will make a noticeable difference to the running speed of the game.

All the same, the constraints are not so severe as to preclude having a moderate number of route-finding characters all wandering around at once. This does introduce a new problem, however: movement descriptions can become hard to follow if every turn produces long reams of reports such as

> Joe enters the room from the south.
> Lawrence opens the gate.
> Lawrence departs to the west.
> Lucy comes in from above.
> Ted enters the room from the south.
> Bill departs to the west.

Patient Zero tackles this problem by calculating all of the character movement without printing any text; it then combines similar or related events into coherent paragraphs, as in

> Rhoda and Antony walk into the Post Office. Rhoda could have been rolling in chocolate and Antony looks as though dipped in french vanilla.

or

> Antony opens the iron gate. He goes through.

See Doors, Staircases, and Bridges for some technical details of allowing other characters to interact with doors when they're in rooms that don't contain the player

78
| Example Mistress of Animals A person who moves randomly between rooms of the map. |
WI

263
| Example Odyssey A person who follows a path predetermined and stored in a table, and who can be delayed if the player tries to interact with her. |
WI

"Odyssey" Corinth is a room. Athens is east of Corinth. Epidaurus is southeast of Corinth and east of Mycenae. Mycenae is south of Corinth. Olympia is west of Mycenae. Argos is south of Mycenae. Thebes is northwest of Athens. Pylos is south of Olympia. Sparta is east of Pylos and south of Argos. Delphi is northwest of Thebes. Athena is a woman in Athens. Athena will proceed, unless delayed, through a list of locations stored in a simple table. Rather than using Inform's route-finding abilities ("the best route from..."), we simply move Athena from one location to the next, not even using the going action: she moves in mysterious ways, as befits a goddess. Table of Athena's Movement destination Thebes Delphi Thebes Athens Corinth Mycenae Every turn when Athena is active: repeat through the Table of Athena's Movement: let last space be the location of Athena; if Athena can be seen by the player, say "Athena heads to [the destination entry]."; move Athena to destination entry; if Athena can be seen by the player, say "Athena arrives from [the last space]."; blank out the whole row; rule succeeds. By blanking out the table line by line, we make sure that we never lose our place in the path. Since we want the player to be able to talk to Athena, we need a way to stall her in her path, as well. Athena can be active or passive. Athena is active. Before doing something to Athena: now Athena is passive; say "Athena waits around patiently, though you can tell she would like to leave..." Instead of telling Athena about something: say "She watches you patiently as though to say that she already knows." Instead of asking Athena about something: say "Her response is inscrutably ancient and Greek. Afterwards you remember only the flash of bright eyes." Finally, we do need to wake Athena up again if she has become passive. The following rule will occur after the movement rule just because of code ordering, though we could make matters more explicit if we needed to: Every turn when Athena is passive: now Athena is active. Test me with "east / northwest / wait / examine athena / wait".

185
| Example Latris Theon A person who can accept instructions to go to new destinations and move towards them according to the most reasonable path. |
WI

291
| Example Actaeon A FOLLOW command allowing the player to pursue a person who has just left the room. |
WI

37
| Example Van Helsing A character who approaches the player, then follows him from room to room. |
WI

396
| Example Patient Zero People who wander around the map performing various errands, and in the process spread a disease which only the player can eradicate. |
WI

Previous | Contents | Next