Sub topic 4
Fail States: Setbacks the Player Can Recover From
Assume you understand basic game loops, mechanics, conditionals, and functions. This chapter focuses on the difference between a recoverable failure and a final loss.
A fail state is an event that hurts the player but does not end the run. The player loses progress, resources, position, or time, then continues from a defined recovery point. A lose state ends the current attempt. For example, falling into a pit might return a platform-game character to the last checkpoint. Running out of lives might end the level.
Failure Is Not Defeat
Win and lose states answer whether the current attempt has ended. A fail state answers whether the player has suffered a setback while the attempt continues.
| State | What happens | Can the current attempt continue? |
|---|---|---|
| Win | The player meets the objective | No, the attempt succeeds |
| Lose | The player meets the defeat condition | No, the attempt ends |
| Fail | The player triggers a setback | Yes, after recovery |
The distinction matters because each state needs different feedback. A final loss should explain that the attempt ended and offer a next action. A fail state should explain the cost and show how play resumes.
A useful fail state has three properties:
- The cause is understandable.
- The cost is limited and consistent.
- The player has a clear way to recover.
If a player takes damage, loses an item, and is moved to an unknown location, the event may feel like a loss even if the game technically continues.
Design the Recovery Loop
Start by describing the complete sequence:
- The player performs an action.
- The action triggers a failure.
- The game applies a known cost.
- The game restores the player to a safe state.
- The player decides what to try next.
For example, a dungeon game might use this loop:
- The player dies.
- One life is removed.
- The player returns to the latest checkpoint.
- Collected temporary items are cleared.
- Permanent upgrades remain.
- The player can immediately try again.
The recovery point should be close enough to reduce repetition but not so close that the failure has no meaning. Repeating a long section after every mistake can make players avoid experimentation. A checkpoint that removes every consequence can make danger feel irrelevant.
Decide What Persists
Separate state into information that should survive failure and information that should reset. Permanent upgrades, unlocked shortcuts, and story discoveries often persist. Temporary combat progress, enemy positions, or a room's collected coins may reset.
Write this rule before implementation. Otherwise, different systems may restore different parts of the game and create confusing results.
Model Failure Explicitly
Represent the outcome in code instead of scattering recovery behavior across unrelated systems. The same event can be a fail state while resources remain and a lose state when they run out.
from enum import Enum, auto
class Outcome(Enum):
PLAYING = auto()
WON = auto()
LOST = auto()
class Run:
def __init__(self, lives, checkpoint):
self.lives = lives
self.checkpoint = checkpoint
self.position = checkpoint
def on_player_death(self):
self.lives -= 1
if self.lives == 0:
return Outcome.LOST
self.position = self.checkpoint
return Outcome.PLAYING
run = Run(lives=3, checkpoint="room_2")
print(run.on_player_death())
print(run.lives)
print(run.position)The method returns PLAYING after a recoverable death and LOST after the last life. In a complete game, another system would use the result to show a respawn screen or a game-over screen.
This transition can be described as follows:
Keep Failure Fair
Players judge a setback by more than its numerical cost. They also ask whether they could predict the danger, understand the cause, and improve their next attempt.
Test these questions during play:
- Did the player receive enough warning?
- Was the failure caused by a decision, skill gap, or hidden rule?
- Does the recovery point preserve reasonable progress?
- Can the player tell what will be lost?
- Does the next attempt begin quickly?
Avoid taking away progress that the player could not know was at risk. If a failure removes a rare item, show that consequence clearly before the player commits to danger.
Exercise
A game sends the player back to a checkpoint after death, but resets ten minutes of exploration. Is this necessarily a fail state rather than a lose state?
Show answer
No. The run may continue technically, but the large and unexpected progress loss can make the event feel like a lose state. Reduce the reset cost, move the checkpoint, or communicate the risk clearly.