5. The Viewpoint Character

Recipe Book

RB §5.1 The Human Body

By default, Inform gives the player character (and every other person) a simple unitary body, one without hands or feet or any other defined parts. In many games this is adequate; but in others it is not enough, and we may want to endow all people with some more specific physical features, as in

A face is a kind of thing. A face is part of every person.

Once we've done this, we may invite ambiguities if the player types LOOK AT FACE; it is this challenge that is addressed in The Night Before ★★★.

rBGH gives the player a random height and then uses this to determine how the room should be described around him.

Slouching ★★ lets the player (and other characters as well) take different sitting, standing, and lying down positions.


The player character's height is selected randomly at the start of play.
Slouching ★★
A system of postures allowing the player and other characters to sit, stand, or lie down explicitly or implicitly on a variety of enterable supporters or containers, or in location.
Instructing Inform to prefer different interpretations of EXAMINE NOSE, depending on whether the player is alone, in company, or with Rudolph the Red-nosed Reindeer.

RB §5.2 Traits Determined By the Player

Some IF tries to make the viewpoint character more congenial to the player by allowing some customization.

Identity Theft demonstrates asking the player to supply the viewpoint character's name.

Pink or Blue ★★★ demonstrates a way to let the player choose a gender at the start of play: this will mostly be interesting if the rest of the story makes some use of the player's choice. Since that example is written expressly to demonstrate included Inform 6 code, however, we may find it more congenial to generalize from the more flexible Baritone, Bass ★★★.

This is not the only way to go - as we'll see in the next section, there's also something to be said for making the viewpoint character a strongly distinct creature with well-defined preferences and attitudes.


Allowing the player to enter a name to be used for the player character during the game.
Baritone, Bass ★★★
Letting the player pick a gender (or perhaps other characteristics) before starting play.
Pink or Blue ★★★
Asking the player to select a gender to begin play.

RB §5.3 Characterization

Much of the personality of the player character in IF emerges from what he can and cannot (or will and will not) do; part of the pleasure of playing a character arises from this opportunity for role-playing and role-exploration. Some characters are consciousless daredevils, willing to jump off cliffs, crawl through narrow gaps, and rob widows if the player commands it; others are repressed neurotics who barely dare to speak to other characters or touch anything that doesn't belong to them.

Finishing School and Dearth and the Maiden both treat the case of a character constrained by good manners and a sense of polite society: the former forbids only one action, while the latter condemns a whole range of them.

Constraining the character is only the half of it: we might also want to think about what sorts of unusual actions that character might be especially likely to take, and account for these. Of course, major actions that affect the story world will require some thought and implementation work, and we should consider carefully before making the player a character like, say, the Noble of Glamour, a spirit in human form who can charm all comers, transform bespectacled secretaries into divas, and cause spontaneous cloudbursts of scarlet glitter.

But even simple humans have some characteristic traits and gestures. We will probably want to write some characteristic reaction to EXAMINE ME, as demonstrated in Bad Hair Day . We might provide a few pieces of clothing or props that aren't strictly critical in the story, like a policeman's helmet or a feather boa:

The player is wearing a policeman's helmet.

We can liven up the interactive aspect of characterization if we give the player a little scope for role-playing: this may mean responding to gestures, like

Understand "bite nails" as a mistake ("Your only nail remaining is the one on your left thumb, and you're saving it for the AP Calculus exam.").

(Of course, we would need to have hinted to the player that nail-biting is characteristic of his character.)

See Also

Clothing for more on dressing characters up.
Saying Complicated Things for conversation, another area in which the player character's personality might come into play.


The "another" adjective for rules such as "in the presence of another person".
Change the player's appearance in response to EXAMINE ME.
Our heroine, fallen among gentleman highwaymen, is restrained by her own modesty and seemliness.

RB §5.4 Background

In IF, as in all interactive storytelling, an essential problem is that the player does not begin the story knowing everything that the player character should, and so may implausibly bumble through situations that the player character should be quite comfortable in. If the player character has friends, an unusual job, a home or environment we're not familiar with, a secret past, these will all be a blank to the player.

Some games get around this by making the player character an amnesiac, or positioning him as a newcomer to a strange world in which his disorientation is explicable; but there are stories that cannot be told this way, and so we need other methods of getting the player to know what the player character already does.

Our first opportunity to inform the player about the player character is in the opening text of a story:

When play begins:
   say "The funeral is exactly a month ago now, but Elise's shoes are still on the shoe tree."

We may also want to write descriptions of objects to give extra background information the first time the player encounters them:

A thing can be examined or unexamined. A thing is usually unexamined. After examining something: now the noun is examined; continue the action.
The description of the newspaper is "A rolled-up newspaper[if unexamined], and thus a symbol of your newly-single state: Elise always had it open and the Local Metro section next to your plate by the time you got out of the shower[end if]."

To expand on this, we could give the player a THINK ABOUT or REMEMBER command, with which he can call up information about people he meets or references he encounters in descriptions, so that he could (for instance) next type REMEMBER ELISE. Merlin demonstrates one way to implement a character with memory; One of Those Mornings puts a twist on this by letting the player FIND things which he knows his character possessed at some time before the story started.


A REMEMBER command which accepts any text and looks up a response in a table of recollections.
A FIND command that allows the player to find a lost object anywhere

RB §5.5 Memory and Knowledge

All of us carry around in our heads an (incomplete, imperfect) model of the world around us: an idea of where we left the keys, whether the oven is on or off, how many clean pairs of socks are left in the drawer, what we look like in our best pair of jeans. The differences between that mental model and reality are to some degree a reflection of personal character: our forgetfulness, our wishful thinking, our innocence or cynicism.

By default, Inform does not keep track of the player character's knowledge (or any other character's knowledge, for that matter) as a separate thing from the model world, relying on descriptive prose rather than modeling to introduce these quirks of characterization.

All the same, there are often times when we would like to keep track of discrepancies between the world model and the narrator's mental model. Perhaps the most common way to do this is simply to mark everything that the player encounters as "seen" when the player first examines it, thus:

A thing can be seen or unseen.
Carry out examining a thing:
   now the noun is seen.

or -- to have things remembered from the first moment they're mentioned in a room description:

Rule for printing the name of something (called the target):
   now the target is seen.

The mental model need not always be accurate, of course. We might, for instance, have occasion to keep track of where the player character last saw something, even if the object has since been moved; or keep track of falsehoods the player character has been told in conversation; or make the player refer to a character as "the bearded man" until he is properly introduced.

Included with Inform is the extension Epistemology, by Eric Eve, which provides one way of tracking this kind of information. Epistemology distinguishes between items that the player character has seen, because they're objects in a room the player has been to, and items that are familiar to the player for other reasons, such as a quest item he knows about but hasn't found yet, or an abstract conversation topic. Anything that is either seen or familiar is counted as "known".

Modeling what the player does and does not know is only half the job, of course: we also need that information to affect the behavior of the story in plausible ways.

One obvious occasion to use player character knowledge is in the output of descriptions. We might want to respond to actions differently depending on what the player has previously done, as in Tense Boxing , or change the way we describe objects in light of new knowledge about them, as in Zero ★★★. Casino Banale ★★★ takes that idea much further, with a whole system of facts that can be narrated to the player in a somewhat flexible but interdependent order, as the player looks at relevant objects or notices them in room descriptions.

Along similar lines, we may want an object to change its name for the player depending on what the player knows. That name change should affect both what Inform displays and what it understands about the object. For instance:

An Amherz Amulet is a thing. It can be known or unknown. It is privately-named.
The printed name is "[if known]Amherz Amulet[otherwise]lizard-shaped pewter charm[end if]".
The description is "[if known]It's a unique and magically powerful pewter charm shaped like a lizard[otherwise]It's some cheap tacky pewter charm shaped like a lizard. At least, as far as you can tell -- it's pretty grubby[end if]."
Understand "amherz" or "amulet" as the Amulet when the Amulet is known.
Understand "lizard" or "lizard-shaped" or "pewter" or "charm" as the Amulet when the Amulet is unknown.
Instead of rubbing the amulet when the amulet is unknown:
   say "You rub off a bit of the dirt, and... what do you know? It's actually the priceless and fabulously powerful Amherz Amulet!";
   now the Amherz Amulet is known.

Finally, the player's knowledge may affect how the story interprets commands, in the determining what is called "scope". When Inform tries to make sense of something the player has typed, it makes a list of everything that the player is allowed to refer to at the moment, and then checks whether all of the objects in the player's command refer to items in that list. Only things that are "in scope" are open for discussion.

If the player mentions an object that is not "in scope" -- say, a red hat left behind in the next room -- Inform will issue the response "You can't see any such thing." This is also Inform's reply if the player mentions a nonsense object ("EXAMINE FURSZWIGGLE") or an object that does not exist in the story world at all ("EXAMINE CELL PHONE" in a story set in Carolingian France).

This is not the only possible way for interactive fiction to handle such communication. Some games will respond differently to EXAMINE RED HAT and EXAMINE FURSZWIGGLE, saying in the first case something like "You can't see that now" and in the second "I don't know the word 'furszwiggle'."

The drawback of such behavior is that the player can make premature discoveries. If he hasn't found a sword yet, but thinks there may be a sword later in the story, he can type EXAMINE SWORD and see from the response whether his guess is correct. Nonetheless, there are people who prefer this alternative exactly because it does expose the limits of the story's understanding, preventing fruitless attempts to use a word that is not recognized at all. If it is desirable, there is an extension that will reproduce this behavior in Inform as well.

Using Inform's default behavior, however, scope is an ad-hoc way of keeping a list of things that are common knowledge between the story and the player. The player knows many things that the story might not (like what a cell phone is); the story knows a few things the player may not (like the fact that there is a sword in an as-yet unvisited room). Neither of those things can fruitfully enter into commands because they have no mutually agreed-upon referent.

By default, Inform assumes that "scope" includes only those things that are currently visible by line of sight. This works pretty well for a wide range of situations, but there are still plenty of occasions when we want to admit that the story and the player share a knowledge of things not seen. GO TO THE KITCHEN might be a useful command even when the player can't currently view the kitchen. ASK FRED ABOUT THE FOOTPRINTS should perhaps work even when the footprints are far away in the garden. SMELL STINKY CHEESE might need to work even when the cheese is invisibly locked away in a porous container but is exuding a stench. In a dark room, the player can't see his own inventory, but he should still remember that he's carrying it and be able to mention it. And sometimes we might want the story to acknowledge that the player is referring to an object that he has seen somewhere, even if that thing is now out of sight.

In practice, we have two ways to tinker with scope: we can change the scope for a specific command, using a token with any, as in

Understand "go to [any room]" as approaching.
Understand "find [any thing]" as finding.
Understand "ask [someone] about [any known thing]" as interrogating it about.

Or we can add areas and items to scope for all commands, as in

After deciding the scope of the player when the surveillance camera is switched on:
   place the jail cell in scope.

Puncak Jaya demonstrates understanding references to characters who are currently off-stage.

See Also

Helping and Hinting for objects tagged with a "seen" property when the player first encounters them.
Getting Acquainted for a character whose name is changed during the course of play as the player gets to know him better.
Room Descriptions for more ways to change the description of a room depending on player experience.
Going, Pushing Things in Directions for ways to understand the names of distant rooms and move towards them.
Character Knowledge and Reasoning for models of knowledge for other characters than the player.
Sounds for ways of tracking audible objects separately from visible ones.
Lighting for ways to change what the player knows about and can manipulate in dark rooms.
Clocks and Scientific Instruments for a telescope that lets the player view objects in another location.
Continuous Spaces and The Outdoors for more on seeing into adjacent locations.


An overview of all the variations of past and present tenses, and how they might be used.
When a character is not visible, responding to such commands as EXAMINE PETER and PETER, HELLO with a short note that the person in question is no longer visible.
Zero ★★★
A box which called "horribly heavy box" after the player has tried to take it the first time.
Casino Banale ★★★
Creating room descriptions and object descriptions that change as the player learns new facts and pieces things together.

RB §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 story. 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

now the player is 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 ★★★ and Crane's Leg 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:

When play begins:
   now the story viewpoint is first person plural;
   now the story tense is past tense.

Though this only changes the form of the text produced automatically by Inform (responses such as "you can't go that way" might become, say, "I couldn't go that way"), and all author-written text in the story must be written in the tense and person intended.


A description text generated based on the propensities of the player-character, following different rulebooks for different characters.
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.
A description text that automatically highlights the ways in which the object differs from a standard member of its kind.
Multiple player characters who take turns controlling the action.