Sub topic 12
Checking Dynamics with Playtests and Simple Simulations
What this chapter assumes
You should know the three MDA layers: mechanics are the rules, dynamics are the behavior that appears when the rules run, and aesthetics are the feelings players have. You should also know what a feedback loop is, and you should be able to read short Python programs. The catch-up rule from the feedback loops chapter is the running example.
Why rules alone do not settle the question
A designer who adds a catch-up boost expects close races. That expectation is a hypothesis about a dynamic, and reading the rule cannot confirm it. The boost might be too weak to matter. It might be so strong that the leader and the trailing racer swap places constantly, which feels random instead of tense.
You have two ways to check the hypothesis:
- Playtest. Real people play the game while you watch and record.
- Simulate. A program plays the rules many times, usually with simple automated players, and you measure the results.
Neither method measures aesthetics directly. Both measure dynamics, and you then argue from the dynamics to the aesthetic goal. Players can report how a game felt, but the reasons are usually in the dynamics you recorded.
Comparing the two instruments
| Property | Playtest | Simulation |
|---|---|---|
| Players | Real humans | Scripted bots |
| Cost per run | Minutes to hours, and people's time | Milliseconds |
| Sample size | Handfuls | Thousands |
| Strength | Shows surprises, confusion, and feelings | Shows statistical patterns and parameter effects |
| Weakness | Noisy, and too few runs to see averages | Only models what you coded |
| Best used for | Finding problems you did not predict | Checking a specific prediction and tuning numbers |
The methods complement each other. Simulation is cheap enough to try dozens of parameter values. Playtests tell you whether the simulated model resembles real play.
The loop
The loop below works for any mechanic. You write the target dynamic down before you measure anything. Otherwise you will be tempted to call whatever you observe a success.
Turning a dynamic into a metric
The design chain from the earlier chapter had the goal "close, tense races". Its target dynamics were "lead changes happen often" and "no player is ever hopelessly behind". Each needs a number you can compute from a single race:
- Lead changes: how many times the leader switches during the race.
- Final gap: the distance between the two racers at the finish.
You also need a threshold, such as "at least three lead changes on average and a final gap under two units". The thresholds are design decisions. The data cannot supply them.
A first simulation
This simulation runs one race with and without the catch-up boost. Both racers move each step at a random base speed, and the trailing racer gets the boost.
import random
def simulate_race(catch_up, steps=100, seed=1):
rng = random.Random(seed)
pos = [0.0, 0.0]
leaders = []
for _ in range(steps):
for i in range(2):
gap = max(pos[1 - i] - pos[i], 0.0)
base = rng.uniform(0.8, 1.2)
boost = min(gap * 0.05, 0.3) if catch_up else 0.0
pos[i] += base * (1 + boost)
leaders.append(0 if pos[0] > pos[1] else 1)
lead_changes = sum(1 for a, b in zip(leaders, leaders[1:]) if a != b)
return lead_changes, abs(pos[0] - pos[1])
for flag in (False, True):
print("catch_up =", flag, "->", simulate_race(flag))The output is two pairs of (lead changes, final gap). With a fixed seed the output is repeatable. It is also a single race, so it tells you almost nothing. A different seed could reverse the comparison, because one race is one random draw.
From one race to a distribution
Run each configuration many times with different seeds and summarize. The next version also exposes the boost parameters, so you can sweep them.
import random
import statistics
def simulate_race(catch_up, steps=100, seed=1,
boost_per_unit=0.05, max_boost=0.3):
rng = random.Random(seed)
pos = [0.0, 0.0]
leaders = []
for _ in range(steps):
for i in range(2):
gap = max(pos[1 - i] - pos[i], 0.0)
base = rng.uniform(0.8, 1.2)
boost = min(gap * boost_per_unit, max_boost) if catch_up else 0.0
pos[i] += base * (1 + boost)
leaders.append(0 if pos[0] > pos[1] else 1)
lead_changes = sum(1 for a, b in zip(leaders, leaders[1:]) if a != b)
return lead_changes, abs(pos[0] - pos[1])
def summarize(catch_up, runs=1000, **params):
results = [simulate_race(catch_up, seed=s, **params) for s in range(runs)]
changes = [r[0] for r in results]
gaps = [r[1] for r in results]
return {
"mean_lead_changes": round(statistics.mean(changes), 2),
"mean_final_gap": round(statistics.mean(gaps), 2),
"worst_final_gap": round(max(gaps), 2),
}
print("no catch-up:", summarize(False))
for k in (0.02, 0.05, 0.10, 0.20):
print("boost_per_unit =", k, summarize(True, boost_per_unit=k))The exact numbers depend on the random generator, so run it yourself instead of trusting a table in a tutorial. The pattern to expect is that the boost lowers the mean final gap, and larger values of boost_per_unit lower it further. The boost acts as a negative feedback loop on the gap. Lead changes should also rise, because the trailing racer closes in on the leader more often.
Three habits make this reliable:
- Use many seeds. Compare averages, and also look at the worst case. A game that is fair on average can still produce an occasional blowout.
- Change one thing at a time. Sweep
boost_per_unitwhile holdingmax_boostfixed, then do the reverse. - Keep seeds reproducible. When a surprising run appears, you can replay it exactly.
Reading the results against the target
Suppose your threshold was "at least three lead changes on average and a final gap under two units". You now compare each row of the sweep with it. Three outcomes are common:
- Too weak: the final gap barely moves. The loop is too slow to matter, so raise the parameter.
- Just right: both thresholds are met across the sweep's middle values.
- Too strong: lead changes are very high and the gap is near zero. Racing skill no longer matters, and the race may feel arbitrary. That is a dynamic that undermines the challenge aesthetic, so you would lower the parameter.
The third case shows why the numbers are not the goal. A smaller gap is better only up to the point where the player's actions stop affecting the outcome.
Limits of the model
A simulation answers questions about the model you wrote, not about the game. Check these before trusting a result:
- Update order. In the code above, racer 0 moves before racer 1 each step, so racer 1 sees a gap that already includes racer 0's move. This gives a small asymmetry. For a real tuning decision, compute both gaps first and then apply both moves.
- Bot behavior. Both racers move at random. Real players steer, take risks, and exploit rules. A bot that never makes choices cannot reveal dominant strategies.
- Missing mechanics. The program has no items, collisions, or shortcuts. Adding them changes the dynamics, so a result holds only for the rules you included.
- Metric choice. Lead changes can be high because two racers are tangled together, which may look like chaos on screen. A number cannot tell you that.
Running a useful playtest
Playtests find what the simulation cannot model. A few practices improve what you learn:
- Write the prediction first. For example: "players will say the race felt close, and the trailing player will overtake at least once."
- Observe before you ask. Watch for hesitation, confusion about a rule, or a player giving up. Players often cannot say why a game felt flat, but they show it in their behavior.
- Record the same metrics as the simulation. Count lead changes and final gaps in the real sessions, so the two sources can be compared directly.
- Ask about experience last. Ask "Which moment was most tense?" instead of "Did you like the catch-up boost?" Players should not have to know your mechanics to answer.
- Use fresh players. Someone who has seen earlier versions knows the rules too well to show you the learning experience.
A playtest of five to eight people will not give averages you can trust. It will show you recurring problems. If three of five players say the trailing racer "can never lose the boost" or "wins without trying", you have a lead worth testing in the simulation. If the simulation's final gaps match what you recorded, the model is a reasonable stand-in for tuning.
Common errors
- Declaring success from one run. One race, or one playtest session, is an anecdote.
- Tuning to the simulation alone. You end up with a game that is balanced for bots.
- Measuring what is easy. Final gap is easy to compute, but "felt tense" is the actual goal. Keep the link from metric to aesthetic explicit.
- Changing several parameters at once. You can no longer tell which change caused the difference.
- Forgetting the aesthetic check. Dynamics that meet their targets still fail if players do not feel what you intended.
Exercise
Using the multi-seed program, you sweep boost_per_unit and find that at 0.20 the mean number of lead changes is highest and the mean final gap is nearly zero. Playtesters say the race "felt random, like it didn't matter how I drove". Which layer does the problem sit in, and what would you change?
Show answer
The mechanic is the cause and the dynamic is where it shows. The boost is so strong that a player's skill cannot hold a lead, so the dynamic "players' actions affect the outcome" is lost, and this undermines the challenge aesthetic. Lower boost_per_unit (or max_boost), rerun the sweep, and look for a value that keeps lead changes frequent while the leader's earned advantage still matters, then confirm it with another playtest.
Exercise
Give two reasons a simulation with random-speed bots could report a healthy race while real players find the game unbalanced, and name one change to the simulation for each.
Show answer
First, the bots make no decisions, so they cannot find a dominant strategy such as deliberately staying behind to collect the boost. Add a bot that follows that strategy and compare its win rate. Second, the model leaves out rules that real races have, such as items or collisions. Add them to the simulation, or at least test whether the result changes when they are present. Update order in the loop is a third valid answer: compute both gaps before moving either racer.