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

"Lanista, Part One"

The Arena is a room. "Sand, blood, iron. These festivals are normally held on hot days, but the sun has gone behind a cloud and fat drops of rain now and then spatter the arena floor." The gladiator is a man in the Arena. "A bare-chested Scythian gladiator faces you, wielding a trident."

We start by recording, for each person, a maximum number of points of damage the person can sustain when starting from health, and the current number of points remaining. In the tradition of role-playing games, these are referred to as hit points.

A person has a number called maximum hit points. A person has a number called current hit points.

The maximum hit points of the player is 35. The maximum hit points of the gladiator is 25.

The current hit points of the player is 35. The current hit points of the gladiator is 25.

Now our rule for the actual attack. We want first to calculate how much damage the player's attack does, inflict that damage, and remove the enemy if he's dead; then, if he doesn't die, the enemy counter-attacks, also for a randomized amount of damage, and if this kills the player, the game ends in defeat.

Instead of attacking someone:
    let the damage be a random number between 2 and 10;
    say "You attack [the noun], causing [damage] points of damage!";
    decrease the current hit points of the noun by the damage;
    if the current hit points of the noun is less than 0:
        say "[line break][The noun] expires, and is immediately carried away by the Arena slaves!";
        remove the noun from play;
        end the story finally;
        stop the action;
    let the enemy damage be a random number between 2 and 10;
    say "[line break][The noun] attacks you, causing [enemy damage] points of damage!";
    decrease the current hit points of the player by the enemy damage;
    if the current hit points of the player is less than 0:
        say "[line break]You expire!";
        end the story.

This last bit is a refinement to help the player keep track of how the contest is going:

When play begins:
    now the left hand status line is "You: [current hit points of player]";
    now the right hand status line is "Gladiator: [current hit points of gladiator]".

Test me with "hit gladiator / g / g / g".

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


PreviousContentsNext