Chapter 10: Physics: Substances, Ropes, Energy and Weight
10.1. Gases

Inform normally assumes that everything is solid. It has no built-in support for gases or liquids, because they have so many different behaviours. For instance, is the important thing about gas that it diffuses, or that we breathe it, or that it mixes with other gases to react, or that it sometimes obscures vision? The answer depends on what we are trying to write, and for this reason Inform leaves it up to us.

Gases are easier to deal with than liquids, because they tend to be everywhere in their location at once (unlike a liquid which might form a pool on the floor) and because they diffuse and mix by themselves (rather than being carried around or brought into contact with each other by the player). On the other hand, unlike liquids, gases are compressible: they can be present at low or high pressures, that is, in low or high concentrations.

The simplest approach is the one in Only You..., where rooms are either filled with smoke or else smoke-free. Smoke gradually fills through the map, obscuring vision: no attempt is made to conserve the total quantity of smoke, as we assume that some fire is churning it out continuously to replace what diffuses away.

Lethal Concentration 1 and 2 simulate a gas diffusing through a three-dimensional maze of rooms, and becoming dangerous above certain concentrations. There is just one possible gas, and it is modelled by giving each room a number which represents the concentration (in parts per million). This enables us to conserve the total amount of gas, or to have it released or captured by sources and sinks of given capacity.

This could be extended by giving each room similar concentration levels for other gases, and providing for the diffusion rule to notice when different gases come into contact; or by giving a concentration (and also, for realism, a volume) to each closed container, applying rules for capturing and releasing gases as containers are opened and closed.


74
*** Example  Only You...
Smoke which spreads through the rooms of the map, but only every other turn.

WI

Suppose we want to have smoke that spreads from room to room, gradually filling the entire map with a clogging smoke. Having it spread every single turn would make for a pretty rapid diffusion, so we temper this by having it spread only on even-numbered turns, instead. Conveniently, Inform by default already knows about even and odd numbers, so we can write:

"Only You..."

Section 1 - The Procedure

Every turn when the turn count is even:
    if every room is smoky, make no decision;
    if location is unsmoky, let current state be 0;
    otherwise let current state be 1;
    repeat with area running through smoky rooms:
        now every room which is adjacent to the area is smoky;
    if current state is 0 and the location is smoky, say "[The location] is filling rapidly with smoke."

A room can be smoky or unsmoky.

Some air is a backdrop. Air is everywhere. Instead of doing something other than examining or smelling to air: say "It's just air." Understand "smoke" as the air when the location is smoky.

Instead of examining the air in a smoky room: say "A thick layer of smoke lies just under the ceiling."

Instead of smelling the air in a smoky room: say "Agh, acrid." Instead of smelling a smoky room: try smelling the air.

After looking in a smoky room: say "A thick layer of smoke has gathered under the ceiling."

Section 2 - The Scenario

The Guide Lodge is a room. "A very spacious room capable of containing several hundred girls while they eat, talk, or do crafts. It is constructed in a not-unappealing rustic style, with floor-to-ceiling windows overlooking the lake below, and a fieldstone hearth at the center." The Guide Lodge is smoky.

The Kitchen is north of the Guide Lodge. "Multiple eight-burner ranges, ovens, and a walk-in refrigerator: you know the sort of thing."

The Industrial Pantry is east of the Kitchen. "Awe-inspiring quantities of food line every shelf, from the three-gallon tub of mayonnaise to the 50-pound tub of rice. Perhaps the most astonishing item is a bag of marshmallows big enough to double as a futon."

The player is in the Pantry.

The Hallway is west of the Guide Lodge. The description of the Hallway is "A perpetually-crammed hallway which has to handle the overflow line for the toilets." A singed sign is fixed in place in the Hallway. The description of the sign is "Where the edge of the sign has not been burnt, the legible words are '...Can Prevent Forest Fires'."

The Toilets are north of the Hallway. "Always in full use, at least when the 12-to-15s are here."

The Coat Closet is south of the Hallway. "Muddy boots may not be worn inside the lodge; instead, about 250 pair are piled here, along with their owners' damp parkas and umbrellas."

The Craft Supply Room is west of the Hallway. "A holding-depot for jugs of white glue and popsicle sticks."

Test me with "x smoke / z / z / z / z / x smoke / look".

392
** Example  Lethal Concentration 1
A poisonous gas that spreads from room to room, incapacitating or killing the player when it reaches sufficient levels.

WI
395
*** Example  Lethal Concentration 2
Poisonous gas again, only this time it sinks.

WI


PreviousContentsNext