5.6. Viewpoint

| Chapter 5: The Viewpoint Character |

| 5.6. Viewpoint

Inform automatically creates a character for the player - a bland, personality-free entity at the outset, as we've seen. But there is no reason why the player need stick to this same identity throughout the game. Conventional fiction often jumps from one viewpoint character to another, and so can IF.

To do this at the most elementary level, we simply at some point

> change player to Janine;

where Janine is a person we've already defined in the code. Now the player is in whatever location Janine inhabits, carries whatever Janine carries, and wears whatever Janine is wearing. Terror of the Sierra Madre shows off this effect, and also demonstrates how to make the command prompt remind the player which character he currently controls. Some games instead give this information in the status line or after the name of the location when looking, producing output like

> The Bottomless Acherousia (as Charon)

We could do the same by adding a line such as

> After printing the name of a room while constructing the status line or looking:
> say "[roman type] (as [the player])"

Of course, we'll need a good deal of other work to make Janine a distinct person from whichever character the player was before. The distinction may come from changed capabilities of the new character, which we can express through new rules about actions; e.g.,

> Instead of listening when the player is Janine:
> say "Your childhood accident left you unable to hear any but the loudest noises. Currently there is only silence."

Janine may also have new, different perspective on her surroundings, expressed through the descriptions of the things she looks at; Uncommon Ground makes a "by viewpoint" token for text alternatives, allowing us to tag our descriptions to indicate which variations should be shown to which viewpoint characters. The Crane's Leg 1 and 2 offer more elaborate and specialized ways of customizing the player character's observations to depend on how he relates (physically and in attitude) to the things around him.

If we want to change the tense and person of narration from the conventional present second person, we may do this as well, though at the present stage of Inform the effect relies on external extensions.

121
| Example Terror of the Sierra Madre Multiple player characters who take turns controlling the action. |
WI

Suppose we have a game where we want the player to control two different characters, swapping bodies from one turn to the next. First, the setting, and the two people who will alternately play: "Terror of the Sierra Madre" The Hay-Strewn Corridor is a room. "[if the player is Maleska]The horse stalls are empty: you have already drained the animals, and carried off their corpses. The house will not long sustain you now. The window throws on the floor a bright square of malevolent sunlight[otherwise]The stalls for horses run down one side of the room, but the house has long stood empty. A square window without shutters looks out over the ranch, away toward the Sierras[end if]." Teresa is a woman in the Hay-Strewn Corridor. "Teresa stands opposite you[if Teresa carries something], her fingers wrapped tightly around [a list of things carried by Teresa][end if]." Teresa carries a bulb of garlic and a cross. Maleska is a man in the Hay-Strewn Corridor. "Maleska watches you from eyes entirely black." Maleska carries a skull. If we tried the text above in Inform, we would find ourselves in the Hay-Strewn Corridor and confronted by both Teresa and Maleska. If "player" is not set to any named person, Inform creates a bland person called "yourself" to represent the player. To avoid this, we set "player" to the person we want to begin as: The player is Maleska. Now the Corridor contains just two people, and we arrive on the scene as Maleska, with only Teresa facing us. At the end of every turn we will use the 'change the player to...' phrase. (This looks as if it simply changes the value of "player": which it does, but it also carries out a complicated operation behind the scenes to effect the switch.) Every turn: if the player is Maleska, now the player is Teresa; otherwise now the player is Maleska. Our two characters already see the Corridor differently, but let's differentiate them further: Every person has a number called strength. The strength of Teresa is 3. The strength of Maleska is 5. In this small example, strength is not used for anything, except that we will display it on the status line: When play begins: now the command prompt is "[bold type][player][roman type] > "; now the left hand status line is "[player]"; now the right hand status line is "STR: [strength of the player]". That last rule doesn't quite do what we might have expected. When we print "[player]", we find that Inform usually prints "yourself". This is because Inform says "you" to mean Teresa when talking to the player-being-Teresa, and likewise for Maleska. We want to override that in this particular story, because the rapid switches of personality are otherwise hard to follow. So: Rule for printing the name of Teresa: say "Teresa". Rule for printing the name of Maleska: say "Maleska". Test me with "look / look".

445
| Example Uncommon Ground Making a "by viewpoint" token, allowing us to design our own text variations such as "[show to yourself]quaint[to Lolita]thrilling[to everyone else]squalid[end show]" depending on the identity of the player at the moment. |
WI

51
| Example The Crane's Leg 1 A description text that automatically highlights the ways in which the object differs from a standard member of its kind. |
WI

377
| Example The Crane's Leg 2 A description text generated based on the propensities of the player-character, following different rulebooks for different characters. |
WI

Previous | Contents | Next