From IFWiki

This article is about doors in general, as items found in IF games. See Door (disambiguation) for other meanings.

A door is standard fixture found in many interactive fiction games. A door is usually presented as a barrier, blocking directional travel from one room to another until some way is found to unlock and open the door. Often this means finding the door's key, but not always.

Doors are usually untakeable scenery and many are also openable or lockable or both. Most doors will exist in two adjacent locations in the game, one side of the door in each room.

Under normal circumstances, a player character is able to enter an open door and arrive in the location on the door's other side. (Her travel through an open door might be prohibited for any number of reasons: a guard might stop her, she might be too frightened of what's on the other side, the vehicle she's driving might not fit through the door, etc.)

Doors are usually placed within the standard compass directional travel scheme; that is, doors are usually placed north, east, south, west, etc. from the current location (e.g.: "You can see bedroom doors to the north and northeast, and two more doors to the south and southeast"). Associating compass directions with doors is far more common than, say, using relative directions (e.g.: "You can see two bedroom doors to your left and far left, and two other doors to your right and far right") or indifference (e.g.: "Doors to Marie's and Harold's bedrooms are down the hall, opposite the linen closet and bathroom"). When doors are set in specific directions, players expect a direction command like "N" to work just as well as "ENTER MARIE'S BEDROOM DOOR", and further, that the opposite direction "S" will work to go back through the door in the other direction.

Usable doors are not necessarily bidirectional. For example, one can only go one way through a turnstile.

Usable doors are not necessarily two-sided. For example, it's not unreasonable for a PC to go through the front door of her home and arrive at her place of employment, skipping the implied intervening outdoor locations entirely.

Perhaps surprisingly, some doors may be unusable throughout the course of a game and just be pure scenery. There's no law that says that every door in a game must eventually be openable.

Door as metaphor

In some contexts, "door" might refer to any object (such as a window, bridge, or stairway) that connects two adjacent locations. This usage is analogous to -- but somewhat less commonplace than -- the IF convention where one refers to any location as a "room" or the Dungeons and Dragons practice of calling any creature a "monster". Also, things like the trick bookcase that slides aside to reveal a secret passage and the full-length mirror that can be pulled open to reveal a forgotten closet may be called "secret doors".

Door as story control

It can often be overwhelming to a player to find herself within a large game world where there are few barriers to exploration. By blocking off some of the content with locked doors, the author can portion out a section of the game at a time, avoiding infodump and making things more manageable for the player. The author can also potentially control some of the pacing of the game's storyline if different portions of the story are revealed somewhere in each of the game's locked regions.

On making doors unambiguous

Novice authors sometimes shy away from putting more than one door in a single location, to avoid disambiguation responses of the form, "which door do you mean, the door or the door?" To avoid this, they might leave out the doors entirely or elongate a hallway so every door is in a different logical location. Of course, neither strategy is entirely satisfactory.

A better plan is to give each door a unique adjective so doors can be referred to unambiguously. In old-school games, there was an unfortunate tendency to choose color adjectives or distinctive types of wood (or metal) for this purpose. While there's nothing wrong whatsoever with a "white door", a "red door", a "blue door", etc. by themselves, a room where every door is a different color comes across as somewhat gaudy and isn't always appropriate. Likewise, a room featuring a pine door, a maple door, and an oak door will seem a bit absurd.

Naming a door after the room it's for (e.g.: "kitchen door") or the direction the door is in (e.g.: "west door") is much more natural -- but this approach can lead to new difficulties: "which kitchen do you mean, the kitchen or the kitchen door?" And perhaps the author doesn't want to reveal what a door is for right away.

So, perhaps authors could be forgiven for sometimes naming doors with other qualities; for example, the "plain door", the "heavy door", the "important-looking door", the "narrow door", the "crooked door", and so on. This approach, too, can become ridiculous if unusual adjectives are chosen, so be careful.

On making doors friendly

Door as puzzle

Locked door puzzles

Main article: Doors, locked

Unlocked door puzzles

An unlocked door can easily be overlooked by the player as insignificant scenery, but sometimes examining a door can reveal new items or new information. A key might have been left in the lock of the door. Could there be a letterbox, mirror, or notice attached to the door? Examine both sides of the door to make sure you haven't missed anything.

Also, don't forget to try closing doors that were initially found open. This might reveal something hidden between the back of the door and the wall. Or perhaps closing one door is the key to unlocking another door, if the two doors are set up to work together like an airlock.

Coding a door

There are two main approaches to coding a two-sided door in IF:

  • Code one item and secretly move it.
  • Code two items that are linked.
Code Compare: Door
ADRIFT 4:(not pre-defined)
Hugo:The door class
Inform 6:The door attribute
Inform 7:The door kind
TADS 2:The doorway class
TADS 3:The Door class
default:Either define two objects (one per side)
and manually code how they co-operate
or only code the locked side and
don't let the PC close or lock it once open.