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


arrow-up.pngStart of Chapter 5: The Viewpoint Character
arrow-left.pngBack to §5.3. Characterization
arrow-right.pngOnward to §5.5. Memory and Knowledge

*ExampleMerlin
A REMEMBER command which accepts any text and looks up a response in a table of recollections.

Suppose that, contrary to the usual rules of interactive fiction, we want to allow the player to discover the locations of things he hasn't actually seen yet:

paste.png "One of Those Mornings"

Understand "find [any thing]" as finding.

Finding is an action applying to one visible thing.

Carry out finding:
    if the player is carrying the noun:
        say "You're holding [the noun]!";
    otherwise:
        say "You left [the noun] [if the noun is on a supporter]on[otherwise]in[end if] [the holder of the noun]."

The holder of the noun can be a room, a supporter, or a container: the phrase is not picky. We would want to be a little more careful if it were ever possible for an item to have been "removed from play" in our game, since then the holder could be nothing, and that would have odd results. In this particular example, though, that will not arise.

And that's it, as far as the find command goes. The rest is local color.

The Exhibition Room is a room. It contains a closed locked lockable transparent openable container called the display case. The display case contains a priceless pearl. The display case is scenery. The description of the Exhibition Room is "By far the finest thing in the room is a priceless pearl in a glass display case. It should of course be yours[if key is not visible], if only you can remember where you hid the key[end if]."

The silver key unlocks the display case.

A jade vase, a teak chest, a bronze teakettle, and a child's burial casket are openable closed containers in the Exhibition Room.

After taking the pearl:
    say "The pearl rolls into your hand, gleaming in the oblique light; your fortune is made.";
    end the story finally.

If we want to have the key found in different places when the game is replayed:

When play begins:
    let the space be a random container which is not the display case;
    move the silver key to the space.

Every turn:
    say "Your watch ticks with maddening loudness."

The time of day is 1:02 AM.

At 1:08 AM: say "The security guard arrives to find you fumbling about with keys. Curses."; end the story.

Test me with "find pearl / find teakettle / get teakettle / find teakettle / find key".

*ExampleOne of Those Mornings
A FIND command that allows the player to find a lost object anywhere

Suppose that, contrary to the usual rules of interactive fiction, we want to allow the player to discover the locations of things he hasn't actually seen yet:

paste.png "One of Those Mornings"

Understand "find [any thing]" as finding.

Finding is an action applying to one visible thing.

Carry out finding:
    if the player is carrying the noun:
        say "You're holding [the noun]!";
    otherwise:
        say "You left [the noun] [if the noun is on a supporter]on[otherwise]in[end if] [the holder of the noun]."

The holder of the noun can be a room, a supporter, or a container: the phrase is not picky. We would want to be a little more careful if it were ever possible for an item to have been "removed from play" in our game, since then the holder could be nothing, and that would have odd results. In this particular example, though, that will not arise.

And that's it, as far as the find command goes. The rest is local color.

The Exhibition Room is a room. It contains a closed locked lockable transparent openable container called the display case. The display case contains a priceless pearl. The display case is scenery. The description of the Exhibition Room is "By far the finest thing in the room is a priceless pearl in a glass display case. It should of course be yours[if key is not visible], if only you can remember where you hid the key[end if]."

The silver key unlocks the display case.

A jade vase, a teak chest, a bronze teakettle, and a child's burial casket are openable closed containers in the Exhibition Room.

After taking the pearl:
    say "The pearl rolls into your hand, gleaming in the oblique light; your fortune is made.";
    end the story finally.

If we want to have the key found in different places when the game is replayed:

When play begins:
    let the space be a random container which is not the display case;
    move the silver key to the space.

Every turn:
    say "Your watch ticks with maddening loudness."

The time of day is 1:02 AM.

At 1:08 AM: say "The security guard arrives to find you fumbling about with keys. Curses."; end the story.

Test me with "find pearl / find teakettle / get teakettle / find teakettle / find key".