Sub topic 11
Observing Emergence Through Playtesting
This chapter assumes you can read short Python programs. It also assumes you know the earlier chapters' ideas: simple rules acting on shared state, tag-based interactions, and positive and negative feedback loops. Here we look at how to find out what your rules actually do once people (or bots) play with them.
Why you cannot read emergence off the rules
You wrote the rules, so you can predict the situations you designed. You cannot predict the situations that come from rule combinations, because the number of combinations grows much faster than the number of rules. Ten tags that can interact pairwise give 45 pairs, and play adds order, position and timing on top of that.
Emergent behavior has to be observed. A playtest is a structured way of doing that: you put the rules in front of players, record what happens, and compare it with what you expected. Three kinds of findings come out of this:
- Confirmed intent. The rule did what you designed it to do.
- Pleasant surprises. A combination you did not plan is fun and worth protecting.
- Harmful surprises. An exploit, a runaway lead or a dead state that no one wants to be in.
Your job in a playtest is to sort observations into these three groups, then decide what to change.
Two sources of evidence
Human playtests and automated simulation answer different questions.
| Source | Good at | Weak at |
|---|---|---|
| Human playtests | Finding what feels fun, confusing or unfair; discovering strategies you never imagined | Small samples; slow; players adapt, so a second session differs from the first |
| Automated simulation (bots, random play) | Measuring distributions over thousands of matches; checking that a parameter change moves a number | Bots only try what you let them try; they say nothing about fun |
Use both. Humans find the surprises, and simulation tells you how common each surprise is.
Planning a human playtest
A playtest without a question produces anecdotes. Before the session, write down one to three questions, each tied to a rule interaction:
- "Do players use fire offensively, or only avoid it?"
- "When one player gets an early lead, can the other come back?"
- "Is there any strategy that players converge on within three matches?"
Then decide what you will record.
- Event log. Record every state-changing action with a turn number and a player id. Log the rule-level event ("fire ignited wood at (4, 2)"), not only the player input. The log lets you replay a surprising moment later.
- Seeds. If the game uses randomness, store the random seed for each match. A surprise you cannot reproduce is hard to fix.
- Observation notes. Watch the player, not the screen. Note pauses, laughter, frustration and questions. A long pause often marks a decision the rules made interesting or confusing.
- Outcome data. Record the winner, the match length and the score gap over time.
Running the session
Give players a goal and stay quiet. If you explain the clever trick, you will never learn whether anyone would have found it. Ask for think-aloud commentary ("say what you are trying to do"), and ask questions only after the match ends.
Prefer sessions with different players. Designers know the intended path, so they play it. New players misread rules in ways that expose which combinations are not obvious. Players who love optimizing find exploits quickly, which is useful, but their behavior is not typical.
The playtest loop
Playtesting is a loop. The key discipline is to change one thing between rounds, so you can attribute the change in behavior to that thing.
Measuring with a simulation harness
Once you have a hypothesis, a simulation can check it cheaply. Recall the income function from the feedback loops chapter. Its two terms push in opposite directions: interest rewards the player who already has gold, and catch_up pays the player who is behind.
Playtesters might tell you that "the early leader always wins". A harness lets you test whether that comes from the rules or from the players. The program below tracks the gold gap between two players with identical income rules.
def income(gold, leader_gold, base=10, interest=0.05, catch_up=0.1):
return base + interest * gold + catch_up * (leader_gold - gold)
def simulate(turns, interest, catch_up, start=(120, 100)):
"""Return the absolute gold gap after each turn."""
a, b = start
gaps = [abs(a - b)]
for _ in range(turns):
lead = max(a, b)
a, b = (
a + income(a, lead, interest=interest, catch_up=catch_up),
b + income(b, lead, interest=interest, catch_up=catch_up),
)
gaps.append(abs(a - b))
return gaps
for catch_up in (0.0, 0.1):
gaps = simulate(20, interest=0.05, catch_up=catch_up)
print(catch_up, round(gaps[10], 2), round(gaps[20], 2))Running it prints:
0.0 32.58 53.07
0.1 11.97 7.17The gap starts at 20. Each turn the gap is multiplied by 1 + interest - catch_up. With no catch-up the factor is 1.05, so the lead grows. With catch_up = 0.1 the factor is 0.95, so the lead shrinks. If you see "early leaders always win" in playtests and your simulation shows a shrinking gap, the cause is not this income rule. Look at other rules, such as how gold converts to board power.
Testing spatial rules with random scenarios
For a systemic rule like fire spread, simulate many random maps and look at the distribution of outcomes. The harness below reuses the fire rule from earlier chapters, scatters terrain, lights one tile, runs until the fire is out, and records what fraction of the fuel burned.
import random
from collections import Counter
FLAMMABLE = {"grass", "wood"}
NEIGHBORS = ((1, 0), (-1, 0), (0, 1), (0, -1))
def tick(grid):
h, w = len(grid), len(grid[0])
new = [row[:] for row in grid]
for y in range(h):
for x in range(w):
if grid[y][x] == "fire":
new[y][x] = "ash"
for dx, dy in NEIGHBORS:
nx, ny = x + dx, y + dy
if 0 <= nx < w and 0 <= ny < h and grid[ny][nx] in FLAMMABLE:
new[ny][nx] = "fire"
return new
def random_grid(rng, w=12, h=12):
tiles = rng.choices(
["grass", "wood", "water"], weights=[5, 2, 3], k=w * h
)
grid = [tiles[y * w:(y + 1) * w] for y in range(h)]
grid[rng.randrange(h)][rng.randrange(w)] = "fire"
return grid
def burn_fraction(grid):
fuel = sum(t in FLAMMABLE or t == "fire" for row in grid for t in row)
while any("fire" in row for row in grid):
grid = tick(grid)
ash = sum(t == "ash" for row in grid for t in row)
return ash / fuel
rng = random.Random(42)
buckets = Counter()
for _ in range(500):
fraction = burn_fraction(random_grid(rng))
buckets[min(int(fraction * 4), 3)] += 1
for b in range(4):
print(f"{b * 25}-{b * 25 + 25}% burned: {buckets[b]}")The seed makes the run reproducible. The exact counts depend on your Python version's random implementation, but the shape is what matters. If most fires die within a few tiles while a minority consume most of the map, you have a two-outcome system. Whether that is good depends on your design goal. A game about firefighting might want rare catastrophes. A game about tactical fire use might want fires that reliably reach moderate size, and then the water share or the flammable density is your first parameter to adjust.
Reading what you collect
Match each observation to a likely cause before changing anything.
| Observation | Likely cause | First thing to check |
|---|---|---|
| Every match ends the same way | A dominant strategy or runaway positive feedback | Log of the winner's first actions; the gap-over-time curve |
| Matches stall with no progress | Negative feedback too strong, or a safe position with no counter | Match length distribution |
| Players ignore a mechanic | Cost exceeds benefit, or the interaction is not discoverable | Whether any player tried it, and what they said |
| One player surprises everyone with a trick | Possible pleasant emergence, or an exploit | Whether others can use or counter it |
| Results vary wildly between sessions | Too much randomness, or small sample | Seed logs and the number of matches |
The surprising trick deserves special care. Ask two questions. Can another player counter it? Does it make other choices pointless? A trick that opens new play passes both tests. A trick that makes the rest of the game irrelevant is an exploit, and the chapter on exploits covers the response.
Common errors
- Changing several parameters at once. When behavior improves, you do not know which change did it. When behavior worsens, you cannot undo only the harmful part.
- Fixing a symptom with a special case. If players burn their own bridge in a way you dislike, adding "bridges never burn" breaks the tag system. First ask which general rule produces the problem, and adjust that.
- Trusting a small sample. Five matches can show any pattern. Use humans for discovery and bots for frequency.
- Testing only with people who know the design. They steer around unclear rules and never reveal them.
- Treating bot results as player behavior. A bot that maximizes gold does not tell you what players enjoy.
- Forgetting to log seeds and versions. Without them you cannot tell whether a change fixed the problem or the dice changed.
- Declaring victory after one pass. A fix is a rule change, and rule changes create new interactions. Re-run the earlier scenarios.
When to stop
You cannot prove that no harmful interaction exists, because the state space is too large. Stop when new sessions stop turning up new categories of surprise, the distributions from simulation match your design goals, and the remaining odd cases are rare or counterable. Then keep a regression list: a saved set of seeds and scenarios that once produced a problem. Run them after every rule change.
Exercise
Your income simulation with interest=0.08 and catch_up=0.05 starts with a gap of 20 gold. By what factor is the gap multiplied each turn, and does the lead grow or shrink? Which parameter would you change first to make comebacks possible, and why only one?
Show answer
The factor is 1 + interest - catchup = 1 + 0.08 - 0.05 = 1.03, so the lead grows slowly. Raise catchup above 0.08 (or lower interest) so the factor falls below 1. Change only one parameter so that any change in the simulated gap or in player behavior in the next playtest can be attributed to it.
Exercise
In a playtest, a player lights a wooden bridge to strand a pursuing opponent, and everyone is delighted. A second player complains that they lost because a wildfire burned their only bridge. What would you log, what would you test with simulation, and what would you avoid doing?
Show answer
Log the ignition events with tile, turn and cause, plus the seed, so the moments can be replayed. Simulate many random maps to measure how often fire cuts a player off from the goal, and whether the victim had a counter such as water or an alternate path. Avoid adding a special case like "bridges never burn", because it removes the pleasant emergent tactic and breaks the general flammability rule. Prefer a parameter or placement change, such as more water or more routes, tested one at a time.