5.5. Memory and Knowledge

| Chapter 5: The Viewpoint Character |

| 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. There are even extensions for Inform that provide some possible models for tracking player knowledge systematically.

Modeling what the player does and does not know is only half the job, of course: we also need a way for that information to affect the behavior of the game 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 game 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 game world at all ("EXAMINE CELL PHONE" in a game 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 game, 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 game'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 game and the player. The player knows many things that the game might not (like what a cell phone is); the game 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 game 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 game 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 Helping and Hinting for objects tagged with a "seen" property when the player first encounters them

See Getting Acquainted for a character whose name is changed during the course of play as the player gets to know him better

See Room Descriptions for more ways to change the description of a room depending on player experience

See Going, Pushing Things in Directions for ways to understand the names of distant rooms and move towards them

See Character Knowledge and Reasoning for models of knowledge for other characters than the player

See Sounds for ways of tracking audible objects separately from visible ones

See Lighting for ways to change what the player knows about and can manipulate in dark rooms

See Clocks and Scientific Instruments for a telescope that lets the player view objects in another location

See Continuous Spaces and The Outdoors for more on seeing into adjacent locations

310
| Example Puncak Jaya 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. |
WI

149
| Example Tense Boxing An overview of all the variations of past and present tenses, and how they might be used. |
WI

Here we have a box that prints out its current state and its history each time we open and close it: "Tense Boxing" The Temporal Prism is a room. "A room of angled mirrors, in whose surfaces you can see what is now; what just was; what has always been. A final mirror is broken and its frame gapes blackly." The mysterious box is in the Temporal Prism. It is an openable closed container. To assess the box: if the box was not open, say "The box was not open."; if the box was open, say "The box was open."; if the box had not been open, say "The box had not been open."; if the box had been open, say "The box had been open."; if the box is not open, say "The box is not open."; if the box is open, say "The box is open."; if the box has not been open, say "The box has not been open."; if the box has been open, say "The box has been open." Before opening the mysterious box: say "You are about to open the box."; assess the box. Before closing the mysterious box: say "You are about to close the box."; assess the box. After opening the mysterious box: say "You now open the box."; assess the box. After closing the mysterious box: say "You now close the box."; assess the box. Note that "was..." and "was not..." and so on may describe conditions more complicated than simple properties: we could equally well ask "if the box has been in the sack", "if the box had been carried by the player", and so on. The past ("if the box was...") and past perfect ("if the box had been...") are especially useful for cases where we want to report on an action after the state of the item has changed; so, for instance: After taking the mysterious box: if the box had not been carried by the player, say "You lift the mysterious box for the first time."; if the box had been carried by the player, say "You again pick up the mysterious box." Test me with "open box / close box / open box / take box / drop box / take box". This is in many respects similar to a rule beginning "After taking the mysterious box for the first time...", but it is superior in most circumstances, for two reasons. First, it will respond correctly even if the player has somehow carried the box before without taking it explicitly: for instance, if another character gave him the box, if the box were moved into his inventory as a result of another action, or if the player carried the box at the start of play. Inform begins its reckoning of time when the game begins, so if the box is defined as being open at the outset, "if the box has been open" will always be true. Second, "after taking... for the first time" fires only the first time the player attempts to take something. If the player tried to take the box, failed, and then tried again later, the "for the first time..." rule would not fire; our "if the box has not been carried..." rule would.

148
| Example Zero A box which called "horribly heavy box" after the player has tried to take it the first time. |
WI

346
| Example Casino Banale Creating room descriptions and object descriptions that change as the player learns new facts and pieces things together. |
WI

Previous | Contents | Next