10.8. Fire

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

| 10.8. Fire

Fire exhibits some of the properties of a gas: it is only vaguely located and tends to spread out, though it passes by touch rather than on the air. It is hazardous to life, through direct contact, heat, and smoke. Better governed, it provides light and warmth. Worse governed, it consumes almost anything it comes into contact with. Here the problem with "debris" is not so much that we need potentially hundreds of new objects to represent broken items: instead, fire could sweep through a work of IF destroying so much that no play is possible any longer. Setting up a problem in which the player must defeat a fully-capable fire is difficult to balance.

As with liquids, it is best to simulate the least amount of fire that the design will allow. Bruneseau's Journey provides a single candle which can be lit, or blown out, but where fire can never transfer from the candle's end to anything else - or vice versa: the player's source of fire, with which to light the candle, is discreetly neglected.

In the more realistic Thirst 2, a campfire is lit using a tinderbox, so that fire does transfer from one thing (tinder) to another (the campfire): but it is always confined to just these two items, and can be used only for light and warmth.

The Cow Exonerated provides a class of matches that can light any flammable object, but assumes that burning objects requires only one turn; lighting one thing does not burn another.

In Fire or in Flood provides a complete simulation of what we might call "wild-fire": combustion which spreads through arbitrary objects and rooms, destroying all in its path.

See Examining for a way to describe objects as charred once they have been partly burnt

See Heat for one consequence of fire having touched something

See Gases for an implementation of smoke without fire, if this can exist

See Liquids for water being used to extinguish a simple fire

See Lighting for other uses of candles and torches as light sources

151
| Example Bruneseau's Journey A candle which reacts to lighting and blowing actions differently depending on whether it has already been lit once. |
WI

117
| Example Thirst 2 A campfire added to the camp site, which can be lit using tinder. |
WI

407
| Example The Cow Exonerated Creating a class of matches that burn for a time and then go out, with elegant reporting when several matches go out at once. |
WI

Here we create a class of matches that can be used to burn other objects. Our objectives are as follow: Burned objects other than matches should be removed from play instantly (just as edible objects are instantly eaten). We could give everything its own burning duration, but that complicates matters and allows for fire to spread from one object to another; for an example of how to do that, see the example "In Fire or in Flood". Matches should be described to show whether they are burning or extinguished, and when the parser chooses one of several identical matches, it should make very clear which match it has selected. The game must sensibly select and, if necessary, automatically light new matches to carry out a >BURN THING command. The matches must burn for a set number of turns before going out, never to be used again. And finally, the part for which the indexed text will be useful: when several matches go out in the same turn, we want the game to print Four matches go out. rather than A match goes out. A match goes out. A match goes out. A match goes out. This last function appears down in Section 3, if we wish to skip ahead and look at it. "The Cow Exonerated" Section 1 - Simple Burning Understand the commands "light" and "burn" as something new. Understand "burn [something] with [strikable-match]" as burning it with. Understand "burn [something] with [something preferably held]" as burning it with. Burning it with is an action applying to one thing and one carried thing. Understand the command "light" as "burn". A thing can be flammable or impervious. A thing is usually impervious. Check burning something with something (this is the burn only with flaming matches rule): if the second noun is not a strikable-match, say "You can only light things with matches." instead; if the second noun is not flaming, say "[The second noun] needs to be burning first." instead. Check burning something with something (this is the burn only flammable things rule): if the noun is impervious, say "[The noun] cannot be burned." instead. Check burning something with something (this is the burn only things not held rule): say "[one of]It occurs to you to set down [the noun] before burning, just for safety's sake. [or]Again, you decide to put down [the noun] prior to burning. [or]You try setting down [the noun] as usual. [stopping][run paragraph on]"; silently try the player dropping the noun; if the player encloses the noun, stop the action. Carry out burning something with something (this is the simplistic burning rule): remove the noun from play. Report burning something with something: say "You burn up [the noun]." Rule for implicitly taking the second noun while burning something with something which is not a strikable-match: say "You can only light things with matches."; stop the action. Section 2 - Matches The word "matches" is used by Inform to compare snippets of text (see "Reading a command" in the Activities chapter). This can sometimes cause awkwardness if we also have a kind called "match", so for the occasion we will give our matches a more specialized name, never visible to the player: A strikable-match is a kind of thing. The plural of strikable-match is s-matches. A strikable-match has a number called duration. The duration of a strikable-match is usually 3. Rule for printing the name of a strikable-match: say "match". Rule for printing the plural name of a strikable-match: say "matches". Understand "match" as a strikable-match. Understand "matches" as a strikable-match. Flame-state is a kind of value. The flame-states are burnt, flaming, and new. Understand "burning" or "lit" as flaming. Understand "unused" as new. A strikable-match has a flame-state. A strikable-match is usually new. Understand the flame-state property as describing a strikable-match. Before printing the name of a strikable-match while asking which do you mean: say "[flame-state] ". Before printing the name of a strikable-match while taking inventory: say "[flame-state] ". Before printing the plural name of a strikable-match while taking inventory: say "[flame-state] ". Before printing the name of a strikable-match while clarifying the parser's choice of something: if not taking inventory, say "[flame-state] ". After printing the name of a strikable-match (called special-target) while clarifying the parser's choice of something: if the player carries the special-target: say " you're carrying"; otherwise if the special-target is in the location: say " on the ground"; otherwise: say " [if the holder of the special-target is a container]in[otherwise]on[end if] [the holder of the special-target]". Understand "strike [something]" as attacking. Understand "strike [strikable-match]" as striking. Striking is an action applying to one carried thing. Understand "burn [strikable-match]" as striking. Does the player mean striking a new strikable-match: it is very likely. Does the player mean striking a burnt strikable-match: it is unlikely. Check striking a strikable-match (this is the strike only new matches rule): if the noun is burnt, say "[The noun] has already burnt down and cannot be relit." instead; if the noun is flaming, say "[The noun] is already burning." instead. Carry out striking a strikable-match (this is the standard striking rule): now the noun is flaming; now the noun is lit. Report striking a strikable-match (this is the standard report striking rule): say "You light [the noun]." Before burning something with a new strikable-match (this is the prior lighting rule): say "(first [if the player does not carry the second noun]taking and [end if]lighting [the second noun])[command clarification break]"; silently try striking the second noun; if the second noun is not flaming, stop the action. Rule for implicitly taking a strikable-match (called target) while striking: try silently taking the target. Does the player mean burning something with a flaming strikable-match: it is very likely. Does the player mean burning something with a new strikable-match: it is likely. Does the player mean burning something with a burnt strikable-match: it is unlikely. Instead of burning a burnt strikable-match with something: say "[The noun] is completely consumed and cannot be relit." Section 3 - Putting the Matches Out Every turn: let N be 0; [here we track how many matches are being put out during this turn, so that we don't have to mention each match individually if several go out during the same move] repeat with item running through flaming s-matches: decrement the duration of the item; if the duration of the item is 0: now the item is burnt; now the item is unlit; if the item is visible, increment N; if N is 1: say "[if the number of visible flaming s-matches is greater than 0]One of the matches [otherwise if the number of burnt visible s-matches is greater than 1]Your last burning match [otherwise]The match [end if]goes out."; otherwise if N is greater than 1: let enumeration be indexed text; let enumeration be "[N in words]"; if N is the number of visible s-matches: if N is two, say "Both"; otherwise say "All [enumeration]"; otherwise: say "[enumeration in title case]"; say " matches go out[if a visible strikable-match is flaming], leaving [number of visible flaming s-matches in words] still lit[end if]." Section 4 - Scenario Old Chicago is a room. The player carries a flammable thing called a log. Understand "wooden" and "wood" as the log. The player carries two s-matches. The matchbox is an open openable container. It contains five s-matches. The player carries the matchbox. When play begins: now every strikable-match carried by the player is flaming; now every strikable-match carried by the player is lit. Test me with "i / burn match / i / i / burn log with match / burn matchbox with match / i".

384
| Example In Fire or in Flood A BURN command; flammable objects which light other items in their vicinity and can burn for different periods of time; the possibility of having parts or contents of a flaming item which survive being burnt. |
WI

Previous | Contents | Next