Chapter 10: Physics: Substances, Ropes, Energy and Weight

§10.1. Gases; §10.2. Liquids; §10.3. Dispensers and Supplies of Small Objects; §10.4. Glass and Other Damage-Prone Substances; §10.5. Volume, Height, Weight; §10.6. Ropes; §10.7. Electricity and Magnetism; §10.8. Fire; §10.9. Heat; §10.10. Magic (Breaking the Laws of Physics); §10.11. Mathematics

arrow-up-left.pngContents of The Inform Recipe Book
arrow-left.pngChapter 9: Props: Food, Clothing, Money, Toys, Books, Electronics
arrow-right.pngChapter 11: Out Of World Actions and Effects
arrow-down-right.pngIndexes of the examples

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

arrow-up.pngStart of Chapter 10: Physics: Substances, Ropes, Energy and Weight
arrow-left.pngBack to Chapter 9: Props: Food, Clothing, Money, Toys, Books, Electronics: §9.12. Cameras and Recording Devices
arrow-right.pngOnward to §10.2. Liquids

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

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

***ExampleLethal Concentration 2
Poisonous gas again, only this time it sinks.