Sub topic 4
Variance: How Swingy a Choice Feels
Assume you know basic probability and expected value. Expected value is the probability-weighted average result of a choice. This chapter adds variance, which measures how widely possible results spread around that average.
Average Is Not the Whole Story
Consider two choices:
| Choice | Possible outcomes | Expected value |
|---|---|---|
| Safe | 10 points every time | 10 |
| Risky | 25 points or -2 points, each with 50% probability | 11.5 |
The risky choice has the higher expected value:
def expected_value(outcomes):
return sum(probability * value for probability, value in outcomes)
safe = [(1.0, 10)]
risky = [(0.5, 25), (0.5, -2)]
print(expected_value(safe)) # 10.0
print(expected_value(risky)) # 11.5However, the risky choice can produce either a large gain or a loss. The safe choice never changes. Expected value describes the center of the results, but not their spread.
Variance Measures Spread
Variance is the probability-weighted average of each outcome's squared distance from the expected value:
def expected_value(outcomes):
return sum(probability * value for probability, value in outcomes)
def variance(outcomes):
mean = expected_value(outcomes)
return sum(probability * (value - mean) ** 2
for probability, value in outcomes)
safe = [(1.0, 10)]
risky = [(0.5, 25), (0.5, -2)]
print(variance(safe)) # 0.0
print(variance(risky)) # 182.25The safe choice has variance of zero because every result equals its average. The risky choice has variance of 182.25 because its outcomes are far from its average of 11.5.
Variance uses squared distances, so its units are squared. Designers often use standard deviation, the square root of variance, when they want a measure in the same units as the score. For the risky choice, the standard deviation is 13.5 points.
How Variance Changes Player Experience
High variance creates more dramatic outcomes. It can support excitement, comeback stories, and memorable failures. It can also make a player's decisions feel powerless when results swing too far.
Low variance makes progress more predictable. That can support planning, mastery, and long-term strategy. It may feel dull if the consequences are too small to notice.
Variance does not automatically make a choice good or bad. Its effect depends on the player's situation. A player ahead in a competitive match may prefer low variance because protecting a lead matters. A player far behind may prefer high variance because a comeback requires an unusually good result.
Common Design Errors
- Comparing only expected values: Two choices with similar averages can feel completely different if one has much higher variance.
- Using large losses without recovery: A single unlucky result can erase meaningful progress and make later choices irrelevant.
- Assuming equal odds feel equal: Players usually notice a possible loss more strongly than an equally likely gain.
- Ignoring the game state: The same variance can be exciting near the beginning and frustrating near the end.
When tuning a mechanic, record both its expected value and variance. Then ask whether the spread matches the decision's importance, the player's available information, and the cost of failure.
Exercise
Which choice has greater variance: receiving 8 points every time, or receiving either 0 or 16 points with equal probability? What are their expected values?
Show answer
The fixed choice has variance 0 and expected value 8. The second choice also has expected value 8, but greater variance because its outcomes spread away from 8.