Sub topic 10
Worked example: from a design goal to rules
This chapter assumes you know the three MDA layers (mechanics, dynamics, aesthetics) and the eight kinds of fun. It also assumes you have read about feedback loops. You should be able to read short Python functions. Here you apply those ideas to one small design problem, from the feeling you want down to code you can run.
The design problem
Suppose you are designing a two-player racing game. The goal is stated as a feeling, not a rule: races should feel close and tense. In MDA terms this is an aesthetic, and the closest match in the eight kinds of fun is challenge. Players should feel that the outcome is in doubt until late in the race.
Designers work from mechanics toward aesthetics when they build, but a good design process starts at the aesthetic and works downward. Each step below turns a vague statement into something you can test.
Step 1: turn the aesthetic into target dynamics
"Tense" cannot be coded. A dynamic is behavior of the running system, so you restate the goal as behavior you could observe:
- Lead changes happen often during a race.
- The gap between racers at the finish is small.
- No player is ever hopelessly behind.
Each of these can be counted or measured, which is what makes it a usable target. Notice that these are still not rules. Nothing in the list says how the game produces lead changes. Skipping this layer is a common error, and the table near the end of the chapter lists others.
Choosing the dynamics is itself a hypothesis: you are betting that these behaviors produce the feeling of challenge. If players later report that races feel fake, the bet may have been wrong, even if the numbers are met.
Step 2: propose mechanics that could produce the dynamics
The next question is which rules would push the system toward those dynamics. From the feedback-loops chapter, a negative feedback loop counteracts a lead: the further ahead you are, the more the system pulls you back. A catch-up mechanic is the standard example. One candidate is to give a trailing racer a speed bonus proportional to the gap, capped so the bonus cannot grow without limit.
def racer_speed(base_speed, gap_behind_leader, boost_per_unit=0.05, max_boost=0.3):
"""Mechanic: a trailing racer gets a speed bonus proportional to the gap, capped at max_boost."""
gap = max(gap_behind_leader, 0.0)
boost = min(gap * boost_per_unit, max_boost)
return base_speed * (1 + boost)This is a mechanic in the strict sense: a small algorithm with explicit parameters. Three details matter:
max(gap_behind_leader, 0.0)means the leader gets no penalty. Only the trailing racer is helped, so the loop corrects deficits without punishing skill directly.boost_per_unitcontrols how quickly help ramps up. A larger value pulls racers together faster.max_boostis a safety limit. Without it, a very large gap would produce an enormous speed multiplier and the trailing racer would teleport past the leader.
These two parameters are the designer's knobs. You will tune them later without rewriting the rule.
A second candidate from the design chain is item drops weighted toward trailing racers. It is a different mechanic that aims at the same dynamic. You can implement either one, or both, and compare them.
Step 3: measure the dynamic instead of guessing it
You cannot tell from the rule alone whether it produces more lead changes. The dynamic only exists when the rules run, so run them. The simulation below races two racers for 100 steps. Each step, a racer's base speed is random between 0.8 and 1.2, and the catch-up boost applies only when the flag is on.
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))Each line printed is a pair: the number of lead changes, then the final gap between the racers. Run it and compare the two lines against your targets. You should expect the catch-up run to show a smaller final gap, because the boost pulls a trailing racer back toward the leader. Lead changes are the less certain measure, so check them rather than assume.
Reading a single run carefully
One run with one seed is an anecdote, not evidence. The seed makes the run repeatable, which is useful for debugging, but it also means you have seen one possible race. To judge the mechanic, run many seeds and compare averages:
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):
results = [simulate_race(flag, seed=s) for s in range(200)]
avg_changes = sum(r[0] for r in results) / len(results)
avg_gap = sum(r[1] for r in results) / len(results)
print("catch_up =", flag, "avg lead changes =", round(avg_changes, 1), "avg final gap =", round(avg_gap, 2))Averages over 200 seeds smooth out luck. If catch-up does not move the numbers toward your targets, the mechanic needs different parameters or a different design.
Step 4: record the chain
The simulation tests one link. To keep the whole argument visible, write the chain down in a form you can revisit as the design changes:
design_chain = {
"aesthetic_goal": "challenge: close, tense races",
"target_dynamics": ["lead changes happen often", "no player is ever hopelessly behind"],
"candidate_mechanics": ["catch-up speed boost for trailing racers", "item drops weighted toward trailing racers"],
}
for layer, value in design_chain.items():
print(layer, "=", value)This is deliberately plain. Its value is that each layer can be tested on its own. The simulation tests whether mechanics produce dynamics. A playtest tests whether the dynamics produce the aesthetic. A failure at one link tells you where to look.
What can go wrong
| Error | What it looks like | Fix |
|---|---|---|
| Jumping from aesthetic to mechanic | "Make it tense, so add a speed boost," with no stated dynamic | Write target dynamics first and decide how you will measure them |
| Treating a dynamic as a rule | Writing "lead changes happen" into the rules instead of building rules that cause them | Keep dynamics as observed behavior, never as a coded outcome |
| Tuning from one run | Changing parameters after a single seeded race | Average over many seeds before judging |
| Over-correcting | Strong catch-up makes the leader's effort feel pointless | Lower `boost_per_unit` or `max_boost` and retest |
| Meeting the numbers but missing the feeling | Close finishes that players call "rubber-banded" or fake | Revisit the target dynamics and playtest with real players |
The last row matters most. Catch-up mechanics are a known source of this problem. The dynamics can satisfy every target on paper while the aesthetic of challenge weakens, because players feel the game is deciding the outcome for them. Simulation cannot detect that. Only players can.
Where this leads
You now have a working design chain. The goal fixed the target dynamics, the dynamics suggested a mechanic, and a simulation gave a first measurement. The next step is iteration. You change boost_per_unit or max_boost, rerun the measurement, and keep the change only if the dynamics move toward their targets.
Exercise
In the racing example, a designer says: "Races should feel tense, so I will add a catch-up boost with max_boost set to 0.3." Which layer did the designer skip, and what should they write down before choosing the mechanic?
Show answer
The designer skipped the dynamics layer. They went straight from the aesthetic (tense, challenging races) to a mechanic. Before choosing the boost, they should write measurable target dynamics, such as frequent lead changes, a small final gap, and no hopelessly trailing racer. Those targets let them test whether the boost actually produces the behavior they want.
Exercise
You run simulaterace(True) once and see fewer lead changes than simulaterace(False). Give two reasons you should not conclude the catch-up mechanic fails, and name one change to the experiment.
Show answer
First, one seeded run is a single sample, and random variation in base speeds can produce an unrepresentative result. Second, lead changes are only one target dynamic. The mechanic may have improved the other target, the final gap, and a boost that is too strong can also make leaders and trailers swap in ways the count does not capture. To improve the experiment, run many seeds (for example range(200)) for each setting and compare the averages of both lead changes and final gap.