7.5. Combat and Death

| Chapter 7: Other Characters |

| 7.5. Combat and Death

Not all characters are friendly, and there are times when we may want to include a fight sequence. There are a number of ways to approach this, depending on whether we want to offer the player a random outcome, a predetermined one, or a combat sequence that depends partly on strategy or on having the proper equipment.

Lanista 1 demonstrates randomized combat in the style of a role-playing game. The player has a partially random chance of doing any given amount of damage; both the player and his opponent have hit points, and whichever one runs out first dies. Lanista 2 continues this idea, but includes weapons that affect the amount of of damage done. Red Cross by itself implements a command that we might use to find out how strong characters are at the moment.

A word of warning about designing such sequences: a player who gets a roll he doesn't like always has the option of UNDOing a turn and re-rolling. This means that he can always win a random battle sooner or later; bad luck only means that it takes him longer (so he gets more bored and irritated as he plays through). It is possible to turn off UNDO implementation with

> Use UNDO prevention.

...but there is a good chance that this will irritate players in itself. Role-playing-style combat scenarios need careful design, lest they actively make a game less fun.

In a slightly more realistic setting, combat leaves physical remains behind, unless we're wielding some kind of futuristic weapon that evaporates our opponents entirely: Puff of Orange Smoke demonstrates characters who leave corpses behind when they die, while Technological Terror more tamely explodes robots into numerous component parts.

Finally, we can imagine some scenarios in which, instead of allowing characters to strike at each other for random damage, we want to introduce an element of strategy. Don Pedro's Revenge shows the rudiments of a system in which the characters can make different kinds of attack depending on where they are in a room filled with perches, barrels, and other swashbuckler props.

See Saving and Undoing for more discussion of handling random behavior in games

191
| Example Red Cross A DIAGNOSE command which allows the player to check on the health of someone. |
WI

130
| Example Lanista 1 Very simple randomized combat in which characters hit one another for a randomized amount of damage. |
WI

282
| Example Lanista 2 Randomized combat in which the damage done depends on what weapons the characters are wielding, and in which an ATTACK IT WITH action is created to replace regular attacking. Also folds a new DIAGNOSE command into the system. |
WI

201
| Example Puff of Orange Smoke A system in which every character has a body, which is left behind when the person dies; attempts to do something to the body are redirected to the person while the person is alive. |
WI

Suppose we want to let the player kill characters, leaving behind corpses. "Puff of Orange Smoke" Paraguay is a room. Bolivia is north of Paraguay. Lydia is a woman in Paraguay. "Lydia is, as usual, here." The description of Lydia is "Long, long legs and a sarcastic attitude." Instead of touching Lydia: say "'Watch it, sailor,' she snaps." A body is a kind of thing. A body is a part of every person. Instead of touching a body: say "[The noun] is grotesquely inert." The description of Lydia's body is "Long, long legs and no attitude at all." The initial appearance of Lydia's body is "Lydia's corpse is sprawled at your feet." Using our "part of every person..." line, we've conveniently assigned one body per person. Since we're going to separate people from their bodies when the bodies die, though, we also want a more permanent relation that will help us keep track of which bodies used to belong to which people: Spirit-possession relates one person to one body. The verb to be owner of implies the spirit-possession relation. When play begins: repeat with victim running through people: let the corpse be a random body which is part of the victim; now the victim is owner of the corpse. When Lydia is alive, we want >TOUCH LYDIA'S BODY to mean the same thing as >TOUCH LYDIA, so we use the setting action variables rules as a convenient point at which to reassign the action: Setting action variables when the noun is a body which is part of a person (called owner): now the noun is the owner. Setting action variables when the second noun is a body which is part of a person (called owner): now the second noun is the owner. This doesn't change Inform's idea about what action is being performed; just about the object it's being performed on. The rest of the action will now proceed as if the player had typed >TOUCH LYDIA. Along similar lines, once Lydia is dead, we want >MOVE LYDIA to mean >MOVE LYDIA'S BODY if the body is in view: Setting action variables when the noun is a dead person and the noun is owner of a visible body (called the mortal remains): now the noun is the mortal remains. The trick is, though, that >MOVE LYDIA will only be understood if there is something called Lydia that the player can see and refer to, even after she's dead. There are various ways to do this, but the least painful here will be to make the deceased Lydia permanently visible, by putting her in an always-accessible backdrop. The backdrop itself will never be mentioned in the game, and we should make its name something that the player is unlikely to type casually; we don't want the player to interact with it directly. So: The worldview is a privately-named backdrop. It is everywhere. The spirit-world is a privately-named transparent closed unopenable container. It is part of the worldview. Definition: a person is dead if he is in the spirit-world. It's also possible that the player will type something like >X LYDIA when Lydia's corpse is not in view, so we should have an appropriate answer to that as well: Before doing something to a dead person: say "[The noun] is dead; or had you blocked that out?" instead. Because the before rules happen after the setting action variables rules, this will only ever happen if the corpse is not visible. Now we define the attack itself, which should discard the body, move the spirit to its eternal resting place, and describe the event to the player: Instead of attacking someone: let the corpse be a random body which is part of the noun; move the corpse to the location; move the noun to the spirit-world; say "With a single blow, you rid the world of [the noun]." And finally a trick borrowed from the chapter on understanding, so that we can refer to "Lydia's body" while Lydia is alive, but "Lydia's corpse" only after Lydia has died: Understand "corpse" as a body when the item described is not part of a person. Test me with "x body / x lydia's body / touch lydia's body / x corpse / kill lydia / look / x lydia's body / x lydia's corpse / x corpse / x lydia / touch lydia / lydia, hello / n / x lydia / touch lydia / lydia, hello".

127
| Example Technological Terror A ray gun which destroys objects, leaving their component parts behind. |
WI

113
| Example Don Pedro's Revenge Combat scenario in which the player's footing and position changes from move to move, and the command prompt also changes to reflect that. |
WI

Previous | Contents | Next