Sub topic 3
Retry, Checkpoints, and Recovery Cost
This chapter assumes you know how to write Python classes and conditionals, and that you have read the earlier chapters on win and lose conditions.
Retry, checkpoints, and recovery cost
A retry system decides what happens after a fail state. A checkpoint is a saved position the player returns to. Recovery cost is what the player loses on the way back, such as time, items, or progress.
Keep recovery cost low enough that retrying feels worth it. A checkpoint placed too far back makes each failure feel like a penalty.
from enum import Enum, auto
class Outcome(Enum):
PLAYING = 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=2, checkpoint=10)
print(run.on_player_death(), run.position)
print(run.on_player_death())Choosing the stakes: what failure takes away
Stakes define what a failure costs. Common costs are lives, currency, time, and saved progress. Choose one primary cost per failure so the player can predict the penalty.
Difficulty tuning and adaptive assistance
Difficulty tuning adjusts enemy strength, checkpoint spacing, or lives. Adaptive assistance changes these values based on the player's recent failures. Limit adaptation to a small range, and tell the player when help is active. Hidden help can make wins feel unearned.
Outcomes in multiplayer and competitive games
In multiplayer games, one player's loss can be another player's win. Decide whether a round ends when one player is eliminated or when all players are. Make sure simultaneous outcomes follow a fixed rule, such as a tie or a specific precedence order.
Playtesting and tuning outcome design
Playtesting shows whether players understand why they failed and whether retries feel fair. Track where players quit, how many retries they attempt, and whether they describe the penalty correctly afterward. Change one variable at a time, then test again.
Exercise
A run has 3 lives and a checkpoint at position 10. The player dies twice. What are the lives and position afterward, and what does the second death return?
Show answer
Lives are 1 and position is 10. The second death returns Outcome.PLAYING, because one life remains.