3.7. Lighting

| Chapter 3: Place |

| 3.7. Lighting

At any place (room, or inside a container) light is either fully present or fully absent. Inform does not usually try to track intermediate states of lighting, but see The Undertomb 2 for a single lantern with varying light levels and Zorn of Zorna for multiple candles that can be lit for cumulative changes to the light level.

Light can be added to, but not taken away: rooms and things can act as sources of light, by having the "lighted" and "lit" properties respectively, but they cannot be sinks which drain light away. The reason darkness is not a constant hazard in Inform-written games is that rooms always have the "lighted" property unless declared "dark". (We assume daylight or some always-on electric lighting.) A "dark" room may well still be illuminated if a light source happens to be present:

> The Deep Crypt is a dark room. The candle lantern is a lit thing in the Deep Crypt.

Hymenaeus allows us to explicitly refer to torches as "lit" or "unlit", or (as synonyms) "flaming" or "extinguished".

For light produced electrically we might want a wall switch, as in Down Below, or a portable lamp, as in The Dark Ages Revisited.

The fierce, locally confined light thrown out by a carried lamp has a quality quite unlike weak but ambient daylight, and Reflections exploits this to make a lantern feel more realistic.

When the player experiences darkness in a location, Inform is usually very guarded in what it reveals. ("It is pitch dark, and you can't see a thing.") Hohmann Transfer gives darkness a quite different look, and Four Stars heightens the other senses so that a player in darkness can still detect her surroundings. The first of the two examples in Peeled allows exploration of a dark place by touch.

It is sometimes useful to check whether a room that is not the current location happens to contain a light source or be naturally lighted. This poses a few challenges. Unblinking demonstrates one way of doing this, so long as there are no backdrop light sources.

Cloak of Darkness is a short and sweet game based on a light puzzle.

See Room Descriptions for an item that can only be seen in bright light, when an extra lamp is switched on

See Looking Under and Hiding for a looking under action which is helped by the fiercer brightness of a light source

See Going, Pushing Things in Directions for making it hazardous to walk around in the dark

See Electricity and Magnetism for batteries to power a torch or flashlight

See Fire for a non-electrical way to produce light

49
| Example The Undertomb 2 Flickering lantern-light effects added to the Undertomb. |
WI

333
| Example Zorn of Zorna Light levels vary depending on the number of candles the player has lit, and this determines whether or not he is able to examine detailed objects successfully. |
WI

301
| Example Hymenaeus Understanding "flaming torch" and "extinguished torch" to refer to torches when lit and unlit. |
WI

25
| Example Down Below A light switch which makes the room it is in dark or light. |
WI

194
| Example The Dark Ages Revisited An electric light kind of device which becomes lit when switched on and dark when switched off. |
WI

338
| Example Reflections Emphasizing the reflective quality of shiny objects whenever they are described in the presence of the torch. |
WI

334
| Example Hohmann Transfer Changing the way dark rooms are described to avoid the standard Inform phrasing. |
WI

335
| Example Four Stars An elaboration of the idea that when light is absent, the player should be given a description of what he can smell and hear, instead. |
WI

350
| Example Peeled Two different approaches to adjusting what the player can interact with, compared. |
WI

Suppose we have a situation where the player is in darkness, but is allowed to feel and interact with (except for examining) any large objects. In that case, we write a scope rule that puts those large objects into scope all the time, and trust the "requires light" aspect of verbs like examining to prevent the player from doing any actions that he shouldn't: "Peeled" A thing can be large or small. Before touching a large thing when in darkness: say "You grope for [the noun]..." After deciding the scope of the player: repeat with item running through large things in the location: place item in scope. Some generic surroundings are backdrop. They are everywhere. Understand "walls" or "wall" or "ceiling" or "ground" or "floor" or "area" or "room" or "here" as the generic surroundings. Instead of touching the generic surroundings: say "You encounter nothing extraordinary." Instead of touching the generic surroundings when in darkness: say "You try feeling your way around and reach [a list of large things in the location]." After deciding the scope of the player when in darkness: place the surroundings in scope. The Room of Mystery is a dark room. The bearskin rug is a large thing in the Room of Mystery. Instead of touching the rug: say "It feels furry!" The peeled grape is a small thing in the Room of Mystery. Instead of touching the peeled grape: say "Gosh, is that an eyeball?" Test me with "feel floor / feel rug / eat rug / examine rug / get grape". Sadly, because the grape is small, the player will never encounter this horror. Alternatively, suppose we have a situation in which the player can use one command to interact with a kind of thing that isn't normally in scope. It's usually most convenient to write the "understand" rule appropriately rather than use the scope activity. (Note that we define "inquiring about" as applying to one *visible* thing; otherwise we would be required to be able to touch the catsuit in order to inquire about it. More on this restriction may be found in the Advanced Actions chapter on the topic of visible, touchable, and carried things.) "Peeled" Mr Steed's Flat is a room. Understand "ask about [any subject]" as inquiring about. A subject is a kind of thing. The skintight catsuit is a subject. Inquiring about is an action applying to one visible thing. Carry out inquiring about something: say "'What can you tell me about [the noun]?' you demand. Mr Steed raises his eyebrows, but does not reply." Test me with "ask about catsuit / x catsuit". All this said, there do arise certain complex situations when we want an activity-specific scoping.

81
| Example Unblinking Finding a best route through light-filled rooms only, leaving aside any that might be dark. |
WI

280
| Example Cloak of Darkness Implementation of "Cloak of Darkness", a simple example game that for years has been used to demonstrate the features of IF languages. |
WI

Previous | Contents | Next