Sub topic 13
Pity Timers and Bad-Luck Protection
This chapter assumes you understand basic probability, expected value, weighted random tables, and variance. A pity timer is a rule that improves a player's chance after repeated failures. It protects players from an unusually long losing streak without making every reward certain.
Why use a pity timer?
Suppose a loot pack has a 2% chance of containing a rare item. Each opening is independent, so the chance of failing 50 times is:
\[ 0.98^{50} \approx 36.4\% \]
That means a long dry spell is not unusual. Players often interpret this streak as evidence that the system is broken, even when the result matches the stated probability. A pity timer changes the experience by limiting how long failure can continue.
A hard pity timer guarantees success at a limit. For example, a player might have a 2% chance on every opening, but receive the rare item automatically on the 50th unsuccessful attempt.
A soft pity timer increases the chance over time. For example:
- Attempts 1–20: 2% chance
- Attempts 21–30: 5% chance
- Attempts 31–40: 10% chance
- Attempt 41 onward: 25% chance
The soft version preserves more uncertainty, while the hard version gives a clear maximum wait.
A simple implementation
The counter must increase after each attempt and reset after a success. Store it in persistent player state so that reconnecting or changing devices cannot erase the protection.
import random
def open_pack(rng, state, base_chance=0.02, pity_limit=50):
state["attempts"] += 1
forced_success = state["attempts"] >= pity_limit
natural_success = rng.random() < base_chance
if forced_success or natural_success:
state["attempts"] = 0
return True
return False
rng = random.Random(3)
state = {"attempts": 0}
results = [open_pack(rng, state) for _ in range(200)]
print("Rare items:", sum(results))This system does not guarantee one rare item every 50 attempts. A natural success can happen earlier, which resets the counter. It guarantees only that a player cannot fail 50 consecutive attempts.
Design choices and trade-offs
| Choice | Benefit | Risk |
|---|---|---|
| Hard pity | Clear maximum wait | Can make the limit feel predictable |
| Soft pity | Keeps uncertainty | Players may not understand the changing odds |
| Counter per item | Protects a specific reward | Creates more state and interface complexity |
| Counter for any rare reward | Simpler to explain | May not help players seeking one particular item |
Decide whether the counter applies to one item, one rarity, or the entire reward category. State the rule clearly in the user interface. Hidden protection can feel deceptive, even when it improves outcomes.
Exercise
A reward has a 5% base chance and a hard pity limit of 20 attempts. What does the pity limit guarantee?
Show answer
It guarantees a reward by the 20th consecutive failed attempt, unless a natural success happens earlier and resets the counter.