10.2. Liquids

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

| 10.2. Liquids

Liquids are notoriously difficult to simulate well. A fully thorough approach consumes endless storage and can be very finicky to write and keep realistic. It is essential to decide what aspect of a liquid's behaviour is actually needed in a given story, and to simulate only that. For instance, if we only need a little chemistry, where a player can add (say) water to salt and make a solution, we do not want to fool around with calculating quantities or concentrations: what's important is that "some water" (amount unspecified) combines with "some salt" to produce "some salty water". We should no more calculate precisely here than we would work out where all the furniture is to the nearest inch. Good advice for handling liquids is to simulate the least amount of realism possible, but no less.

Sometimes all we want is a down-in-one drink: we needn't simulate the actual liquid, just the bottle it comes in, and all we need is to handle the "drinking" action. See Beverage Service, and also 3 AM, where carbonated drinks can be shaken - again simulating the vessel, not the liquid.

Some elementary biochemistry in Xylan is done simply by... well, the point is that two different liquids are represented by single things each, and a chemical reaction simply switches one for the other.

In Frizz, we allow any container to be filled (only) with water (only) and we simulate what happens to any solid objects also inside: some waterproof, some not. Flotation provides a well (always full of water), with rules to determine whether things dropped into it should sink or float.

Next we move up to quantitative approaches, where we remember not just whether a liquid is present, but how much of it. In its simplest form, we could have a drinking vessel from which we draw in sips, so that it can be full, half-empty or empty: see Thirst.

The example with the best compromise between simulation quality and complexity is Lemonade. Here we provide a kind of container called a "fluid container", not just a single cup, and each such vessel has a given "fluid capacity". Each holds only a single liquid at a time (so no mixtures) and can be empty or full to any level (rounded off to the nearest 0.1 fl oz). We can fill one vessel from another (unless it would make a mixture). But liquids leaving these vessels must be consumed - drunk or poured away without trace: we cannot make pools on the floor, or carry liquids in our cupped hands. There is no object representing "lemonade": there are only fluid containers, but which can be called LEMONADE if that is what they now contain.

Savannah is a light elaboration of Lemonade, showing how liquids might be poured on other objects, as for instance to extinguish a fire.

Noisy Cricket extends Lemonade to allow for mixing, though then the number of different possible mixtures is so large that complexity increases greatly. Lakeside Living extends Lemonade differently to add a "liquid source" kind, a form of fluid container which has infinite fluid capacity and is scenery - ideal for a lake, river or spring.

See Bags, Bottles, Boxes and Safes for stoppered bottles which could also be used for carrying liquids around in

See Heat for keeping liquids warm in insulated containers

122
| Example Beverage Service A potion that the player can drink. |
WI

193
| Example 3 AM A shake command which agitates soda and makes items thump around in boxes. |
WI

192
| Example Frizz Liquid flows within containers and soaks objects that are not waterproof; any contact with a wet object can dampen our gloves. |
WI

Suppose we have some items that get wet in contact with other damp things; in particular, if we touch anything wet while wearing a pair of gloves, the gloves too get damp. This requires that we be systematic about detecting all cases where contact occurs. So: "Frizz" A thing can be waterproof or porous. A container is usually waterproof. An animal is usually waterproof. A thing can be sodden or dry. A container can be waterfilled or empty. Before printing the name of a sodden thing: say "sodden ". Understand the sodden property as describing a thing. The player wears a pair of woolly gloves. Instead of wearing a sodden thing: say "You dubiously contemplate [the noun], and decide it's best to wear dry clothing." Every turn: follow the liquid distribution rules. The liquid distribution rules is a rulebook. A liquid distribution rule: repeat with item running through containers: if the item is open and the item is empty and the item is in a waterfilled container: now the item is waterfilled; if the player can see the item, say "[The item] fills up with water, of course.". A liquid distribution rule: repeat with item running through things in a waterfilled container: if the item is porous and the item is dry: if the player can see the item, say "[The item] soaks through."; now the item is sodden. A liquid distribution rule: repeat with item running through sodden things in the airing cupboard: if the item is not The Last Man, now the item is dry. The last liquid distribution rule: if the player carries a dry copy of The Last Man, end the story finally. Instead of examining a waterfilled container: say "[The noun] is full of water[if the noun contains something visible]; it also contains [the list of things in the noun][end if]." Instead of examining a container: say "Dry inside[if the noun contains something visible], and containing [a list of things in the noun]." A book is a kind of thing. Instead of examining a sodden book, say "[The noun] is too soaked to read, thanks to someone's carelessness." Understand "book" as a book. The copy of The Last Man is a book. The description of The Last Man is "Mary Shelley's very own original copy, loaned to you under the strictest of agreements[if the pond encloses the copy]. How it came to be in its present position is a long story, and not important at the moment: the critical thing is not to blame oneself - who could have anticipated the cricket bat, anyway? - but to fix it immediately, before anything worse occurs[end if]." The The Last Man is in the ziploc bag. The ziploc bag is waterproof and empty. It is openable, transparent, and closed. The Back Garden is a room. The Back Garden contains a pond. The pond is a waterfilled container. In the pond is the ziploc bag. A carp is in the pond. The carp is an animal. Instead of taking the carp, say "You're not fast enough." Rule for writing a paragraph about the pond: if the pond encloses the Last Man: say "It is a beautiful day just at the end of spring and beginning of summer. The sun shines, the trees blossom, the world conspires in Edenic cheerfulness. You can take in none of it. Your eye is on [the Last Man]."; otherwise: say "The pond[if something is in the pond] (containing [the list of things in the pond])[end if] remains a figure of menace in an otherwise lushly verdant landscape." Before printing the name of the Last Man when the Last Man is enclosed by the Pond: if the Last Man is dry, say "delicate, valuable ". After printing the name of something (called the target) while writing a paragraph about something: if the Last Man is enclosed by the Pond: if the target is in something (called the parent), say " - which is in [the parent]". The Kitchen is west of the Back Garden. "Not in any sense your province: Mrs Peaswell gets agitated if anyone besides herself so much as boils a kettle. In general it is best to sneak through, disturbing as little as possible and preserving the cosy domestic fiction that academics cannot cook. The nearby stairwell leads up to the second floor." The Stairwell is above the Kitchen. "Halfway up and halfway down." The airing cupboard is a container in the Stairwell. "An airing cupboard here contains the heating system, and is the ideal place for restoring wet items to a dry state." The airing cupboard is fixed in place. Now: whenever the player definitely touches something, we want to follow certain rules about the transfer of liquid. These rules need to come after an action's check rules (to make sure the action really occurs) and before the carry out rules (so that nothing has moved or changed yet). So we'll borrow from the chapter on rulebooks to create a whole new stage to the action, occurring between the check and the carry out phases: The post-check rules are a rulebook. This is the post-check stage rule: abide by the post-check rules. The post-check stage rule is listed before the carry out stage rule in the specific action-processing rules. A post-check rule (this is the dry glove rule): if we get wet: if the player wears the gloves and the gloves are dry: now the gloves are sodden; say "(soaking your gloves in the process)"; continue the action. A post-check rule (this is the wet glove rule): if the player wears the sodden gloves: if the The Last Man must be touched and the Last Man is not sodden: say "(soaking the parched pages of The Last Man with the rude touch of your sodden gloves)"; now the The Last Man is sodden; continue the action. Before doing something when the player does not wear the gloves: if The Last Man must be touched: if The Last Man is dry, say "[The The Last Man] is too precious to endanger when you are not wearing gloves." instead; otherwise say "You hesitate instinctively, then recollect that you can hardly harm [The The Last Man] any more than it has already been harmed...". To decide whether we get wet: if the noun is not a thing, no; if the noun dampens us, yes; if the second noun is not a thing, no; if the second noun dampens us, yes; no. To decide whether (item - a thing) dampens us: if the item is not liquiferous, no; if item must be touched, yes; no. To decide whether (item - a thing) must be touched: if the item is the noun and the action requires a touchable noun, yes; if the item is the second noun and the action requires a touchable second noun, yes; no. Definition: a thing is liquiferous: if it is sodden, yes; if it is in a waterfilled container, yes; no. Test me with "x book / x bag / get bag / take off gloves / w / u / put gloves in cupboard / z / open bag / touch book / push book / turn book / get gloves / wear gloves / get book". Test disaster with "open bag". Test mishandling with "get bag / open bag / get book".

385
| Example Flotation Objects that can sink or float in a well, depending on their own properties and the state of the surrounding environment. |
WI

277
| Example Xylan Creating a new command that does require an object to be named; and some comments about the choice of vocabulary, in general. |
WI

118
| Example Thirst A waterskin that is depleted as the player drinks from it. |
WI

255
| Example Lemonade Containers for liquid which keep track of how much liquid they are holding and of what kind, and allow quantities to be moved from one container to another. |
WI

256
| Example Savannah Using the liquid implementation demonstrated in Lemonade for putting out fires. |
WI

265
| Example Noisy Cricket Implementing liquids that can be mixed, and the components automatically recognized as matching one recipe or another. |
WI

320
| Example Lakeside Living Similar to "Lemonade", but with bodies of liquid that can never be depleted, and some adjustments to the "fill" command so that it will automatically attempt to fill from a large liquid source if possible. |
WI

Previous | Contents | Next