Sub topic 11
The cost of failure and how players recover
A risk is only as heavy as what happens after it goes wrong. Two games can offer the same 40% chance of failure and feel completely different. In one, failure costs you ten seconds. In the other, it costs you an hour of progress. This chapter covers how designers measure the cost of failure, the tools that shape recovery, and how to check that those tools work.
This chapter assumes you know expected value from earlier in the tutorial (the probability-weighted average of outcomes), and that you can read short Python programs.
Failure has more than one price
"Lose the fight" sounds like one cost, but it is a bundle. Splitting it up helps you see which part to tune.
| Component | What the player loses | Example |
|---|---|---|
| Resources | Currency, items, health | Dropping your carried gold on death |
| Progress | Position or completed work | Restarting a level from the start |
| Time | Minutes spent repeating content | Walking back to your boss fight |
| Tempo | Standing relative to opponents | Skipping a turn while rivals advance |
| Status | Rank, streak, or reputation | Losing rating points after a defeat |
Time is the component designers most often forget. A penalty that takes only 50 gold may still cost five minutes of retracing steps. Players feel the five minutes more.
A rough model treats the cost of failure as the immediate loss plus the effort needed to get back to where you were:
effective cost = immediate loss + (recovery time × value of that time)Recovery time is often the larger term. It is also the easier one to change, because you can shorten it without touching the underlying stakes.
Stakes and recovery are separate dials
A choice with high stakes and fast recovery (a hard boss with a checkpoint right outside the door) feels tense but fair. A choice with low stakes and slow recovery (a trivial hazard that sends you back twenty minutes) feels irritating. Many frustrating designs make this second mistake: the risk looks small, but the recovery path is long.
Keep the two dials apart when you tune:
- Stakes decide how much the player cares before the attempt.
- Recovery cost decides how willing the player is to try again after a loss.
Stakes make the decision interesting. Recovery cost decides whether players keep playing after a bad outcome.
Checkpoints change the math
A checkpoint is a saved position the player returns to after failing. It limits how much progress one failure can destroy. You can see the effect with a simulation of a level made of several sections. Each section takes the same time and has the same chance of success. On failure, the player restarts either the whole level or only the current section.
import random
def clear_time(sections, p_success, seconds, checkpoints, rng):
# Total seconds spent until every section is cleared.
total = 0
cleared = 0
while cleared < sections:
total += seconds
if rng.random() < p_success:
cleared += 1
elif not checkpoints:
cleared = 0 # no checkpoint: back to the start of the level
return total
def average_time(checkpoints, runs=20_000, seed=3):
rng = random.Random(seed)
return sum(
clear_time(3, 0.7, 60, checkpoints, rng) for _ in range(runs)
) / runs
print("no checkpoints: ", round(average_time(False)))
print("with checkpoints:", round(average_time(True)))Solving the expected values by hand gives about 383 seconds without checkpoints and about 257 with them. The simulation should land close to both. The difficulty is identical, since every section still has a 30% failure chance. Only the price of failing changed, and the total time dropped by about a third.
Designers use this to keep a challenge hard without making it tedious. You can lower the success rate and still keep the experience tolerable by shortening the way back.
Common recovery structures
Different games let players recover in different ways. Each one suits a different kind of risk.
- Checkpoints and quicksave. Progress is protected. Good for long, skill-based challenges.
- Partial retention. The player keeps some of what they had. A common version is dropping a fraction of currency in a retrievable pile. This keeps the sting while leaving a way to win it back.
- Meta-progression. Failed runs still grant permanent upgrades or knowledge. Roguelikes lean on this. A run ends in loss, but the account is stronger.
- Catch-up mechanics. Players who are behind receive a boost. Examples are better draws for the last-place racer or extra income for the trailing team.
- Cheap retry. Restarting costs seconds, so failure functions as practice.
None of these is free. Strong protection weakens the original risk. If death costs nothing, then risking death is no longer a meaningful decision, which connects to the dominant-strategy problem covered later in this tutorial.
Spirals: when failure feeds on itself
A failure can change the odds of the next attempt. This is feedback, and it comes in two kinds.
- Negative feedback pushes the player back toward the middle. Catch-up bonuses and rubber banding are examples.
- Positive feedback amplifies the current trend. Winning gives power, power makes winning easier, and the leader runs away.
A death spiral is positive feedback working against the loser. You lose a fight, so you lose your gear, so you are weaker, so you lose the next fight. The player did not make worse choices. The system made the next failure more likely.
Death spirals are not always bad. In a long, serious strategy game, falling behind may be the intended consequence. The question is whether the spiral ends the player's fun before it ends the match. If a player is mathematically beaten after ten minutes of a ninety-minute game, you have a design problem, even though the penalty looks fair on paper.
Simulating a spiral and a fix
The next program models a player who fights enemies of fixed strength. Winning adds one power. Losing subtracts loss power. A "pity" bonus raises the win chance after each consecutive loss and resets on a win. The program reports the share of runs that collapse to very low power.
import random
def simulate(loss, pity, fights=40, trials=5000, seed=7):
rng = random.Random(seed)
collapsed = 0
total_power = 0
for _ in range(trials):
power, streak = 10, 0
for _ in range(fights):
p = 0.5 + 0.05 * (power - 10) + pity * streak
p = min(0.95, max(0.05, p))
if rng.random() < p:
power += 1
streak = 0
else:
power = max(0, power - loss)
streak += 1
total_power += power
if power < 5:
collapsed += 1
return total_power / trials, collapsed / trials
for pity in (0.0, 0.1, 0.2):
avg, collapse = simulate(loss=2, pity=pity)
print(f"pity={pity:.1f} avg power={avg:.1f} collapse rate={collapse:.2%}")Run it and compare the three rows. With no pity, a loss of two power against a gain of one gives a negative drift at an even matchup, so many runs sink. As pity rises, long losing streaks become rarer and the collapse rate should fall.
The model is deliberately crude. Power has no upper limit, and the enemy never scales. It is still useful for one reason: it makes a feeling ("I can't climb back") into a number you can change and measure.
Tuning recovery without gutting the risk
When failure feels too harsh, resist the instinct to shrink the penalty first. Try these in order:
- Shorten the way back. Move checkpoints, cut unskippable cutscenes, shorten loading.
- Make loss recoverable. Let the player retrieve what they dropped, or keep a fraction.
- Add a floor. Set a minimum below which the player cannot fall.
- Smooth the spiral. Add a pity bonus or comeback income.
- Only then lower the stakes.
Each step preserves more of the original tension than the one after it. The order reflects the earlier point: stakes make the choice interesting, so reduce them last.
Edge cases
- Permanent loss. Permadeath removes recovery entirely. It works when runs are short and the game offers meta-progression, because the loss stays bounded. It fails when a single mistake erases dozens of hours.
- Multiplayer fairness. Catch-up help for one player is a handicap for another. A winning player may feel punished for playing well. Keep the boost small enough that skill still matters.
- Learning versus losing. In skill games, failure teaches. A fast retry turns failure into practice. A long retry turns it into a chore. Pick which one the challenge needs.
- Hidden penalties. If players cannot see the cost before taking the risk, they cannot weigh it. This links back to the information chapter: a recovery cost the player cannot predict is a hidden stake.
Exercise
A platformer level has four sections. Each has a 75% success rate and takes 30 seconds. Without checkpoints a failure restarts the level. Without running code, explain why adding a checkpoint after every section lowers the average clear time even though the difficulty per section is unchanged. State what the expected time with checkpoints would be.
Show answer
With checkpoints, each section is retried on its own. The expected number of attempts per section is 1 / 0.75, about 1.33, so each costs about 30 × 1.33 = 40 seconds. Four sections give about 160 seconds. Without checkpoints, a failure in section four throws away the three sections already cleared, so the player repeats work. The per-section odds are the same in both cases. Only the amount of progress lost on failure differs, and the loss is what raises the clear time.
Exercise
In the death-spiral simulation, a designer wants to cut the collapse rate without making losses hurt less. Name two changes that fit that goal and say which part of the failure cost each one reduces.
Show answer
One option is a pity bonus (or a larger one). It changes the odds after a loss and shortens recovery, so the penalty itself stays the same. Another is a strength floor, which caps how far a single loss streak can drop the player and limits the progress lost. A third valid answer is making lost power partly retrievable. All three reduce recovery time or compounding loss while leaving the immediate penalty intact.