Sub topic 6
Making failure fair and readable
This chapter assumes you know the difference between win, lose, and fail states from the earlier chapters. It also assumes you can read short Python functions and have played a few genres, so you have felt both fair and cheap defeats.
A player's reaction to a loss depends less on how often they lose than on what they conclude about it. If they think "I made a mistake and I know which one," they usually retry. If they think "the game did that to me," they often quit. This chapter covers the design choices that produce the first reaction.
Fairness is a judgment the player makes
Fairness is not a number you can balance in a spreadsheet. Two games can have the same death rate and feel completely different. The player judges each failure against three questions:
- Could I have seen it coming? The threat or rule was visible before it hurt me.
- Do I know what happened? I can name the cause of the failure.
- Could I have done something different? A better choice or a faster reaction would have changed the result.
A failure that passes all three feels earned. A failure that fails one of them feels arbitrary, and the player blames the game instead of themselves.
The questions also tell you what to fix. The first is about telegraphing, the second is about feedback, and the third is about whether the challenge is solvable by the player's skill.
Readability: telegraphing the threat
A telegraph is any signal that a threat is coming before it takes effect. The window between the signal and the impact is the player's chance to react. Its length must match the action you ask for.
If the player must dodge, the warning has to outlast their reaction time plus the time the dodge takes. Human reaction to a visual cue is commonly around 200 to 250 milliseconds, and the movement itself takes longer. A warning shorter than that makes the attack unavoidable on first sight, even if it is technically dodgeable.
Use more than one channel when the stakes are high:
| Channel | Example | Weakness |
|---|---|---|
| Animation | A boss raises an arm before swinging | Easy to miss at the screen edge |
| Sound | A rising tone before an explosion | Fails for players who mute the game or are deaf |
| Color and shape | A red ground marker where a hit will land | Fails for color-blind players if color is the only signal |
| UI | A flashing health bar or arrow toward an off-screen enemy | Pulls the eye away from the action |
| Rules text | A tooltip stating that fire spreads on grass | Players do not read it during play |
Two channels cover most of the weaknesses in the table. A red marker with a distinct outline shape, plus a sound, works for most players.
Telegraph consistency
Players learn a signal the first time it appears and then trust it. If the same animation sometimes comes with a delay and sometimes does not, the player cannot build a rule from it. Keep timings fixed per enemy or hazard type. If you want variation, vary which attack is chosen and not the timing of a given attack.
Information the player cannot see
Hidden state is a common source of unreadable failure. Examples include a poison counter that is not displayed, a stealth detection meter that fills out of sight, or a morale stat that silently triggers a surrender. If a value can end the run, show it. If you cannot show it, make sure the game shows its effects early, such as a character coughing before poison becomes lethal.
Patterns that make failure feel unfair
These patterns appear in many games. Most can be diagnosed with the three questions.
| Pattern | Question it fails | Typical fix |
|---|---|---|
| Off-screen damage from an unseen source | Seen coming? | Add an indicator, or move the threat into view |
| Instant death with no warning on first encounter | Seen coming? | Add a safe preview, or reduce the damage so the first encounter is a lesson |
| Damage totals that jump (a hit does 5, then 80) | Seen coming? | Show the enemy's strength before the fight |
| Death screen that says only "You died" | Know what happened? | Show the killing source and recent damage |
| Chain stun, where one hit leads to a series of hits with no control | Avoidable? | Add invulnerability frames after recovery |
| Randomness that can lose a run with no counterplay | Avoidable? | Give the player information or an option to mitigate |
| Controls that drop an input (a jump not registered) | Avoidable? | Add input buffering and coyote time |
| Checkpoint after the hard part, or far before it | Not one of the three, but it affects retry cost | See the retry chapter |
Input forgiveness
Many unfair-feeling deaths come from input handling and not from level design. Two small techniques address most of them. Input buffering stores a button press for a few frames so that a jump pressed slightly early still fires when the character lands. Coyote time lets a jump work for a few frames after the character walks off a ledge. Both widen the window where the player's intent matches the result, so the player's judgment of "I pressed it in time" matches the game's.
Randomness
Random outcomes are not unfair by themselves. They become unfair when the player cannot influence them or cannot see the odds. Three practices help:
- Show probabilities in the interface, and make them honest. A displayed 90% chance that fails often enough to be noticed will feel like a lie. Some games hide the true value and bias small percentages in the player's favor for this reason.
- Let the player reduce risk with a choice, such as a safer route with a lower reward.
- Prevent runs of bad luck with a pity counter, where each failure raises the next success chance.
Make the cause of failure explicit in code
The second question, "do I know what happened?", needs data. If the game only stores current health, it cannot tell the player what killed them. Keep a short rolling log of damage events, then summarize it when the player fails.
from collections import deque
from dataclasses import dataclass
@dataclass(frozen=True)
class DamageEvent:
time: float # seconds since the run started
source: str # for example "archer" or "lava"
amount: int
warned: bool # True if a telegraph was shown before this hit
class DamageLog:
def __init__(self, window=5.0):
self.window = window
self.events = deque()
def record(self, event):
self.events.append(event)
self._trim(event.time)
def _trim(self, now):
while self.events and now - self.events[0].time > self.window:
self.events.popleft()
def cause_of_death(self, now):
"""Return the source that dealt the most damage in the window."""
self._trim(now)
totals = {}
for e in self.events:
totals[e.source] = totals.get(e.source, 0) + e.amount
if not totals:
return None
return max(totals, key=totals.get)
def unwarned_share(self, now):
"""Fraction of recent damage that had no telegraph."""
self._trim(now)
total = sum(e.amount for e in self.events)
if total == 0:
return 0.0
unwarned = sum(e.amount for e in self.events if not e.warned)
return unwarned / total
log = DamageLog(window=5.0)
log.record(DamageEvent(10.0, "lava", 30, True))
log.record(DamageEvent(11.5, "archer", 20, False))
log.record(DamageEvent(12.0, "archer", 25, False))
print(log.cause_of_death(12.0)) # archer
print(log.unwarned_share(12.0)) # 0.6The log serves two audiences. The player sees cause_of_death on the failure screen, which answers "what happened?" The designer collects unwarned_share across many runs, which answers "where do players take damage they could not have seen coming?" A high unwarned share for one enemy points to a missing telegraph.
The rolling window matters. The last hit is often not the real cause. A player at 5 health who steps on a spike was killed by the earlier fight. Summing damage over a window of a few seconds names the source that actually did the work. Choose the window length to match your game's pace, and test it against deaths you can explain by hand.
Edge cases to plan for
- First-encounter deaths. A new threat will kill some players before they understand it. That is acceptable if the death teaches the rule and the retry is cheap. It is not acceptable if the same unseen threat guards a long unskippable stretch.
- Simultaneous failures. If the player takes lethal damage in the same frame they reach the goal, the precedence rule from the state machine chapter decides the result. Make the rule match what the screen shows. A player who sees themselves cross the line first will feel cheated by a loss.
- Latency in online games. A player may see themselves dodge while the server records a hit. Rewind-based hit validation and a visible indicator of ping reduce these disputes. When the server overrules the client, show it clearly so the player can tell it was a network problem and not their own mistake.
- Accessibility. Telegraphs that rely on one sense exclude some players. Offer alternate cues, adjustable timing windows, and options such as a larger telegraph size. These changes make failures fairer for everyone, not only the players who need them.
- Escalating skill requirements. A challenge that needs frame-perfect input is fair only if the game has taught and rewarded smaller versions of it first. Introduce a mechanic in a safe setting, test it with a low-stakes challenge, then combine it with others.
Fair does not mean easy
Fairness is about the relation between a failure and the player's understanding of it. A hard game can be fair, and an easy game can be unfair. Some games kill the player often, but every death comes with a clear cause and a fast retry, and players describe them as fair. Others rarely kill the player but do so through a hidden rule, and players describe them as cheap.
Difficulty is tuned through numbers such as enemy health, damage, and timing windows, which the adaptive difficulty chapter covers. Fairness is tuned through information and control. Treat them as separate dials. When players complain, ask first whether the complaint is about the amount of challenge or about not understanding the result. The fix is different in each case.
Checklist for a single failure
Before you ship a threat or rule that can fail the player, check these points:
- The threat has a telegraph in at least two channels, and the window is longer than reaction time plus movement time.
- The telegraph timing is consistent every time the threat appears.
- Any value that can cause failure is visible, or its effects are visible early.
- The failure screen or feedback names the cause, based on a damage window and not only the last hit.
- The player has at least one action that would have prevented the failure.
- Input handling forgives small timing errors.
- Random elements show their odds and offer mitigation.
- Simultaneous end conditions resolve in the way the screen suggests.
Exercise
A platformer has an enemy that charges at the player. The charge starts 150 ms after the enemy's eyes flash red, moves fast, and kills in one hit. Playtesters say the enemy "kills me for no reason." Which of the three fairness questions does this most likely fail, and name two changes that would fix it without making the enemy weaker.
Show answer
It most likely fails "could I have seen it coming?", and arguably "could I have avoided it?" A 150 ms warning is shorter than a typical visual reaction time of about 200 to 250 ms, so players cannot react to the cue before the charge starts. Two fixes that keep the enemy's strength: lengthen the wind-up to well over reaction time plus dodge time (for example 500 ms) and keep it the same on every charge, and add a second cue such as a sound or a ground marker showing the charge path. Adding an animation pose such as the enemy crouching also helps.
Exercise
Using the DamageLog above with a 5-second window, a player dies at time 20.0 after these events: ("spikes", 10 damage, warned, time 16.0), ("wolf", 15 damage, unwarned, time 18.0), ("wolf", 15 damage, unwarned, time 19.0), ("spikes", 10 damage, warned, time 19.5). What do causeofdeath(20.0) and unwarned_share(20.0) return, and what would a designer conclude?
Show answer
At time 20.0 the window covers events after time 15.0, so all four events count. Totals are spikes 20 and wolf 30, so causeofdeath returns "wolf". Total damage is 50 and unwarned damage is 30, so unwarned_share returns 0.6. If many deaths show a high unwarned share tied to the wolf, the designer should add a telegraph for the wolf's attack, such as a growl or a lunge animation.