Sub topic 5
Writing Mechanics and Rules Clearly
This chapter assumes you have read the earlier chapters on design intent and spec structure. You should know the template sections (intent, scope, rules, edge cases, tuning, acceptance criteria) and have some experience working with engineers and QA on a game team.
The Rules section is where a spec stops describing a wish and starts describing behavior. An engineer will implement what it says. A tester will check against it. If two readers can finish a rule and picture different results, the rule is not finished.
What a rule is
A rule is one statement about what the game does, under what condition, with what result. Good rules share a few properties:
- Observable. A player, tester, or log can show whether it happened.
- Single-purpose. One rule states one behavior.
- Conditional where needed. The trigger is stated, not implied.
- Free of numbers that will change. Values live in tuning data, which a later chapter covers.
Compare two versions of the same dash rule.
| Vague | Clear |
|---|---|
| The dash should feel fast and let the player escape. | Pressing Dash starts a dash in the direction of movement input. |
| Dashing has a short delay before you can do it again. | The player cannot start a dash while the dash cooldown is active. |
| The dash works in the air too. | The player can air dash once per jump. Landing restores the air dash. |
The left column describes a feeling or leaves out the trigger. The right column can be implemented and tested. Feeling belongs in the design intent. Rules carry behavior.
Use a consistent sentence shape
Most rules fit one of three shapes. Choosing a shape and sticking to it makes a spec easier to scan and review.
- Trigger and effect: "When X happens, Y happens."
- Condition and permission: "The player can (or cannot) do X while Y is true."
- Invariant: "X is always true" or "X never exceeds Y."
Number the rules, as the dash template does. Numbers let reviewers write "rule 3 conflicts with rule 7" and let acceptance criteria point back to the rule they check.
Choose words with one meaning
Ambiguity usually comes from a few kinds of words.
- Soft quantities: "quickly," "a bit," "often," "short." Replace each with a named tuning value or a measurable condition.
- Undefined nouns: "enemy," "hit," "damage," "ground." Does "enemy" include bosses, allies turned hostile, or destructible turrets? Define the term once, in a short glossary, and use it the same way everywhere.
- Modal verbs: "should," "might," "can." In a rule, "should" is unclear: is it required or recommended? Use "can" and "cannot" for permissions, and plain present tense for behavior ("the dash ends").
- Passive voice: "The dash is canceled." By what? Write "Taking damage cancels the dash." The active form names the cause.
- Pronouns across rules: "It" often has two possible referents. Repeat the noun.
Pick one term per concept. If the spec says "cooldown" in one place and "recharge" in another, an engineer may build two systems.
Write the rule, then the reason
A rule says what happens. A short reason says why, so that a person who must make a call the spec did not cover can decide in line with the intent.
3. The player cannot dash while a dash cooldown is active.
Reason: prevents chaining dashes to cross any level at full speed,
which would bypass the platforming challenges.Keep the reason to a line. It is not a place to argue the design; that belongs in design notes. Its job is to let an engineer facing an unlisted situation, such as a dash granted by a pickup, choose the answer that protects the intent.
Order and precedence
When several rules can apply at once, the spec must say which wins. Dash is a good example: pressing Dash while also taking damage in the same frame, or while on cooldown with a buffered input.
State precedence explicitly:
## Rules
1. Pressing Dash starts a dash in the direction of movement input.
2. If there is no movement input, the dash goes in the facing direction.
3. The player cannot dash while a dash cooldown is active.
4. Rule 3 takes precedence over rules 1 and 2.
5. Taking damage during a dash cancels the dash.Rule 4 removes the question of whether a press during cooldown might still start a dash. For larger features, a priority list ("stun beats dash beats attack") is easier to maintain than scattered "unless" clauses.
Describe sequences as states and transitions
Rules written as prose get hard to check once a feature has several phases. If a mechanic has a lifecycle, such as ready, dashing, and cooldown, describe it as states and transitions. The next chapter covers states and edge cases in more detail, but a diagram helps even at the rules stage.
Each arrow becomes a rule with a trigger. If you cannot label an arrow, the behavior is not yet defined. Look for states with no exit, which are a common source of soft locks, and for events that appear in the real game but not on the diagram.
Specify the inputs, outputs, and side effects
For each mechanic, a reader should be able to answer four questions from the Rules section:
- What starts it? Player input, a timer, another system's event.
- What does it read? Facing, movement input, current state, equipped items.
- What does it change? Position, velocity, resource counts, flags, animation state.
- What ends it? A timer, a condition, an interruption.
Side effects are the most commonly missed item. Does a dash grant invulnerability? Does it reset the jump? Does it consume stamina? If the spec is silent, each discipline will guess.
Use examples to pin down the rule
When a rule involves several conditions, add a worked example directly under it. The example is not a replacement for the rule. It is a check that the reader understood it the same way you did.
4. An air dash is available once per jump. Landing restores it.
Example: the player jumps, air dashes, then touches a wall.
The air dash is not restored, because touching a wall is not landing.Examples catch gaps. If you struggle to write one, the rule probably hides a decision you have not made.
Keep rules out of other sections
Spec readers look for things in predictable places. Two habits keep rules findable:
- Put behavior in Rules, not in the intent or scope sections. A sentence such as "the dash should cancel on damage" inside the design intent will be missed.
- Put numbers in tuning data. A rule that says "cooldown is 0.8 seconds" must be edited whenever balance changes, and copies of the number in several places will drift apart. Write "the dash cooldown" and point to the file.
Check the rules before review
Before you send the spec out, read the Rules section as an engineer would. A short checklist helps:
- Does every rule have a stated trigger or condition?
- Is each term defined and used consistently?
- Is there any "should," "might," or unmeasured adjective?
- Where two rules can apply together, is the winner stated?
- Can you imagine a test for each rule?
The last item links to acceptance criteria. A rule you cannot test is a rule you have not finished writing.
Exercise
Rewrite this rule so that it is clear and testable: "The player can sometimes block attacks, and it should feel strong but not too strong." Identify at least three problems in the original, and write two replacement rules, using a tuning value name instead of a number.
Show answer
Problems: "sometimes" gives no condition, "should feel strong" is a feeling rather than behavior, "not too strong" is unmeasurable, and "attacks" is undefined (it may or may not include projectiles or area effects). Replacement rules: 1. While the player holds the Block button and the block is not broken, melee attacks from the front deal damage reduced by the block damage reduction value. 2. Each blocked attack drains block stamina by the attack's stamina cost; when block stamina reaches zero, the block breaks and the player cannot block until the block recovery time has passed. Values such as block damage reduction and block recovery time are named in the tuning file.