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
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

To begin with, we create an action for going to a named place. All that this action will do is to change that person's hoped-for destination: the actual moving around comes later.

"Latris Theon"

A person has a room called destination.

Understand "go to [any room]" as going vaguely.

Going vaguely is an action applying to one visible thing.

Carry out someone going vaguely:
    now the destination of the person asked is the noun.

Report someone going vaguely:
    say "[The person asked] looks amused, but accepts the commission to go to [the noun]."

It stands to reason the player plays Zeus or at the very least Apollo, but let's not let this go to the player's head. Note that the following rule applies to the player, but not to anyone else, so HERMES, GO TO ATHENS will work but GO TO ATHENS will not.

Carry out going vaguely:
    say "You're too thoroughly lost."

And finally we recreate Greece and one of its heroes.

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.

Hermes is a man in Corinth. The destination of Hermes is Corinth. [So he is initially happy where he is.] Persuasion rule for asking Hermes to try going vaguely: persuasion succeeds. [But he is open to suggestions.]

Every turn when the destination of Hermes is not the location of Hermes:
    let the right direction be the best route from the location of Hermes to the destination of Hermes;
    try Hermes going the right direction.

Test me with "hermes, go to athens / e".

It simplifies matters that our map of Greece makes it possible to reach any location from any other location, by some sequence of movements: if there were an isolated location -- say, Crete -- with no map connection to the mainland, then we would have to worry about the "right direction" not being a direction at all. The following version of Hermes' trekking rule is protected against the possibility:

Every turn when the destination of Hermes is not the location of Hermes:
    let the right direction be the best route from the location of Hermes to the destination of Hermes;
    if the right direction is a direction, try Hermes going the right direction.

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


PreviousContentsNext