You have a character that moves, attacks, and operates inside a core loop. You have a prototype that knows what the player does. But right now, your prototype has a problem that sounds strange until you think about it: the player can do too much.
In This Chapter
- 7.1 Why More Rules Often Means More Interesting Games
- 7.2 What Is a Rule?
- 7.3 The Rule Hierarchy: Constitutive, Operational, and Implicit
- 7.4 Designing Rules That Create Interesting Choices
- 7.5 Constraints as Creative Fuel
- 7.6 The Possibility Space
- 7.7 Rules and Fairness: The Player's Implicit Contract
- 7.8 Rule Breaking as a Design Tool
- 7.9 Formal Rules vs. Emergent Rules
- 7.10 Writing a Rule Set for Your Game
- 7.11 GDScript: BoundarySystem.gd --- Collision Layers
- 7.12 GDScript: DoorLock.gd --- The Key-and-Lock Gate Pattern
- 7.13 Constraints in Action: Five Design Patterns
- 7.14 The Rule Cascade: How One Rule Changes Everything
- 7.15 Case Study Preview: Chess and Minecraft
- 7.16 Progressive Project: Adding Rules to Your World
- 7.17 The Aesthetics of Rules
- 7.18 Summary
Chapter 7: Rules, Constraints, and the Paradox of Freedom Through Limitation
You have a character that moves, attacks, and operates inside a core loop. You have a prototype that knows what the player does. But right now, your prototype has a problem that sounds strange until you think about it: the player can do too much.
Walk through walls? Sure. Walk off the edge of the world? Why not. Attack the same enemy from inside its body, standing on its head, clipping through a boulder? Go for it. Everything is permitted because nothing is defined. There are no boundaries. No locked doors. No walls that push back. No rules about where you can go, what you can touch, or what happens when you try something the designer did not intend.
That is not freedom. That is a void.
Here is the idea that will reshape how you think about design: constraints do not limit the player's experience --- they create it. A game with no rules is not a sandbox. It is a screensaver. A game with strict, well-designed rules is a space where every action has meaning, every choice has consequences, and every boundary creates a question: what if I could get past that?
Chess has six piece types, a sixty-four-square board, and a small set of movement rules. It has been played for over a thousand years, and humans have not exhausted its strategic depth. Breath of the Wild gives you a paraglider, a stamina meter, and the constraint of gravity --- and players have spent years discovering new ways to exploit the interaction between those three things. Baba Is You gives you the ability to push word tiles that literally are the rules, and the entire game is about discovering what happens when constraints change.
The rules are not the cage. The rules are the game.
This chapter is about understanding why that is true, learning how to design rules that produce interesting play, and building the first real constraints in your project. By the end, your prototype will have walls that stop you, doors that require keys, objects you can interact with, and a formal rule set that defines what is and is not possible. And it will feel, for the first time, like a place with shape and purpose rather than an empty field with a moving sprite.
7.1 Why More Rules Often Means More Interesting Games
This is the paradox that trips up every beginner designer: the instinct is to give the player more options, more freedom, more "things to do." The assumption is that freedom equals fun. Remove all restrictions. Let the player go anywhere, do anything, break everything.
The result is almost always boring.
Give a child a box of every crayon ever made and an infinite sheet of blank paper, and they will draw for ten minutes and wander off. Give the same child three crayons and a coloring book, and they will sit for an hour. The constraints --- limited colors, defined shapes --- do not limit creativity. They focus it. The child is not choosing from an overwhelming palette. They are solving a problem: how do I make this picture look good with these three colors?
Games work the same way.
💡 Intuition: Constraints are what turn "do whatever you want" into "figure out how to do what you want." The first is aimless. The second is a puzzle. And puzzles are inherently engaging because they give the brain a problem to solve with specific tools and specific limitations.
Consider two hypothetical games:
Game A: You are in a large open world. You can go anywhere. There are no enemies, no obstacles, no locked areas, no resource constraints. You can walk, run, jump, fly, teleport. Nothing stops you. Nothing challenges you. Nothing requires thought.
Game B: You are in a single room. There is a locked door. You have no key. There is a box. There is a pressure plate. The box is too heavy to carry. There is a slope.
Game A has infinite freedom and zero engagement. Game B has severe constraints and an immediate, compelling question: how do I open that door?
The difference is not about the size of the world or the number of mechanics. The difference is that Game B's constraints create a problem space --- a specific set of conditions that the player must understand and manipulate to achieve a goal. Game A has no problem space because nothing resists the player's will.
This principle scales up to the most complex games ever made. Dark Souls is compelling because of its constraints: limited healing, punishing death, enemies that do not scale to your level, and a stamina meter that prevents button-mashing. Remove those constraints and you have a mediocre action game. With them, you have a game that millions of people consider a transformative experience.
Tetris is compelling because of its constraints: pieces fall at a constant rate (which accelerates), the board has fixed dimensions, pieces cannot be rotated after placement, and the only way to clear space is to complete full rows. Remove any of those constraints and the game collapses. Without gravity, there is no pressure. Without fixed dimensions, there is no spatial reasoning. Without the row-clearing rule, there is no strategy.
The lesson: you do not design the fun. You design the constraints that force the player to find the fun.
7.2 What Is a Rule?
Before we go further, we need a clear definition. A rule is a statement about the game world that determines what is possible, what is forbidden, what changes, and under what conditions.
Rules are the physics of your game universe. Real physics says you cannot walk through walls, cannot exceed the speed of light, and will fall if unsupported. Game rules say whatever you decide they say. You are the god of this universe. Every law is yours to write.
But there is a catch: unlike real physics, which is consistent and discoverable, game rules must be communicated. The player cannot intuit your rules the way they intuit gravity. You must teach every rule, either explicitly (a tutorial message) or implicitly (through level design, feedback, and consistent behavior). A rule the player does not understand is a rule that produces frustration rather than engagement.
Rules come in three layers, and understanding these layers is essential for designing games that feel fair, learnable, and deep.
7.3 The Rule Hierarchy: Constitutive, Operational, and Implicit
This framework comes from game studies, but it is practical enough to use every day. Every game has three layers of rules, and they serve different purposes.
Constitutive Rules (The Abstract Logic)
Constitutive rules are the mathematical and logical foundations of the game. They define the system at an abstract level, independent of how the player interacts with it. They are the rules a programmer implements --- the invisible logic running under the hood.
In chess, the constitutive rules include: the board is an 8x8 grid; each square has coordinates; a bishop can move to any square along a diagonal from its current position, provided no piece occupies an intervening square; if a piece moves to a square occupied by an opposing piece, the opposing piece is captured and removed from the game.
In Minecraft, the constitutive rules include: the world is divided into 16x16x256 blocks of cubes; each block has a material type with defined properties (hardness, blast resistance, transparency); when a block's integrity reaches zero, it is destroyed and an item entity is spawned at its coordinates.
Players do not think about constitutive rules. They think about what they do. But constitutive rules determine what is possible. If your constitutive rules are poorly designed --- if the math is broken, the logic has edge cases, or the system produces degenerate states --- the game will feel wrong even if the player cannot articulate why.
📐 Technical Note: Constitutive rules are where bugs live. When a player clips through a wall, the constitutive rule (collision detection) has failed. When an item duplication glitch lets players copy resources, a constitutive rule about inventory management has an edge case. When designing your rules, think about the constitutive layer first: what does the math say? What does the logic permit? What edge cases exist?
Operational Rules (What Players Do)
Operational rules are the rules as the player understands and performs them. They are the instructions you would give someone sitting down to play your game for the first time.
In chess, the operational rules are: "You and your opponent take turns. On your turn, move one piece according to its movement rules. If you land on an opponent's piece, you capture it. The goal is to trap the opponent's king so it cannot escape."
In Minecraft, the operational rules are: "Left-click to break blocks. Right-click to place blocks. Walk into items to pick them up. Open your inventory to craft. Don't fall into lava."
Notice the difference. The constitutive rules of chess involve coordinates, diagonals, and set theory. The operational rules involve "take turns" and "move one piece." The constitutive rules of Minecraft involve block integrity values and entity spawning. The operational rules involve "left-click to break."
Operational rules are what the player consciously thinks about. If these are unclear, the game is confusing. If these are boring, the game is boring. The operational layer is where most of your design attention should go, because it is the layer that determines the player's experience.
Implicit Rules (The Social Contract)
Implicit rules are the unwritten agreements between players, or between the player and the game, that are not encoded in the system but are essential for the experience to work.
In chess, implicit rules include: do not take ten minutes per move in a casual game. Do not distract your opponent by talking. Do not hover your hand over a piece to fake them out (some tournament rules formalize this, but in casual play it is social convention).
In multiplayer video games, implicit rules include: do not grief your teammates. Do not use exploits in competitive play. Do not trash-talk in ways that cross from banter into abuse. Do not go AFK without warning.
In single-player games, implicit rules include: the game will be fair. If I die, it will be because I made a mistake, not because the game cheated. If the game presents a puzzle, there will be a solution. If the game tells me to "explore," there will be something worth finding.
⚠️ Common Pitfall: When implicit rules are violated, players feel betrayed, not just frustrated. If a game presents a door that looks openable but is permanently locked with no indication, the implicit rule ("doors can be opened") has been violated. If an enemy kills the player with an undodgeable attack, the implicit rule ("I can avoid damage through skill") has been violated. These violations damage trust, and trust is the foundation of the player-game relationship.
The three layers interact constantly. The constitutive rules define what is technically possible. The operational rules define what players do. The implicit rules define what players expect. A well-designed game aligns all three: what is possible is consistent with what players do, which is consistent with what they expect. When the layers misalign, you get confusion, frustration, and broken trust.
7.4 Designing Rules That Create Interesting Choices
Now we get to the practical question: how do you write rules that produce good gameplay?
The answer begins with a distinction that is deceptively simple and extraordinarily important: the difference between a situation and a choice.
A situation is when something happens to the player. An enemy appears. A timer starts. A wall blocks the path. Situations are events.
A choice is when the player must decide how to respond, and the decision has meaningful consequences. Do I fight the enemy or sneak past? Do I rush the timer or play carefully? Do I find a way around the wall or break through it?
Bad rules create situations. Good rules create choices.
The Anatomy of a Meaningful Choice
A meaningful choice has four properties:
1. Multiple viable options. The player must have at least two things they could reasonably do. If there is only one viable option, the "choice" is an illusion --- the player is just executing the obvious solution. Dark Souls gives you multiple options for every encounter: fight head-on, dodge and backstab, use ranged attacks, lure enemies one at a time, or run past entirely. Each option is viable depending on your build, skill level, and risk tolerance.
2. Differentiated outcomes. Each option must lead to a meaningfully different result. If all options produce the same outcome, the choice is cosmetic, not strategic. In XCOM 2, choosing between a shotgun flanking maneuver and a long-range sniper shot produces different risk/reward profiles: the shotgun does more damage but requires exposing your soldier to danger. The outcomes are not just different numbers --- they are different situations for the next turn.
3. Information to reason with. The player must have enough information to make a deliberate decision, not a random guess. This does not mean full information --- uncertainty can enhance choices. But the player should understand the trade-offs involved. Slay the Spire shows you the map of upcoming encounters, so your decision about which card to take is informed by what you know you will face.
4. Irreversibility (or at least cost). The choice must commit the player to something. If you can trivially reverse any decision, nothing matters. Celeste's assist mode lets players adjust difficulty, but the core game commits you to your movement decisions: a mistimed dash means death and restart. The stakes make the choice feel real.
🧩 Design Lens: When testing your rules, ask: "Is the player making a choice or executing a procedure?" A procedure is a sequence of inputs where the correct answer is obvious. A choice is a moment where the player pauses, thinks, weighs options, and decides. If your game has long stretches without choices, the player is on autopilot. That is a rule design problem, not a content problem.
Meaningful Choices vs. False Choices
False choices are everywhere in games, and they are design poison.
The No-Brainer. "Do you want 100 gold or 10 gold?" This is not a choice. One option is objectively better. If your game presents options where one is clearly superior, you have not created a choice --- you have created a test of whether the player is paying attention.
The Uninformed Gamble. "Pick door A or door B. We will not tell you what is behind either one." Without information, there is no reasoning, only guessing. Random guessing is not a meaningful choice. (This can work if the game has taught the player to read environmental clues --- in Slay the Spire, the question mark rooms are gambits, but the player has meta-knowledge about what might be behind them.)
The Delayed Revelation. "Choose a class at character creation. You will find out if it was the right choice thirty hours later." If the consequences of a choice are so distant that the player cannot connect the decision to the outcome, the choice is not meaningfully informed. It is a coin flip the player evaluates retrospectively.
The Cosmetic Fork. "Go left or go right. Both paths lead to the same room." If the player discovers that their choice was illusory, trust erodes. This is acceptable occasionally (linear games often use this to maintain pacing), but overuse creates the feeling that choices do not matter.
🎯 Design Principle: Every choice in your game should pass the "interesting trade-off" test: can you articulate what the player gains and what the player loses by choosing each option? If one option has no downside, it is not a choice. If the trade-off is unclear, the choice needs more information. If the trade-off is trivial, the choice needs higher stakes.
7.5 Constraints as Creative Fuel
Here is a story every veteran game developer has experienced. You are working on a project with unlimited resources, unlimited time, and no restrictions. The project drifts. Scope creeps. Nobody can agree on a direction because every direction is possible. The game ships two years late, over budget, and mediocre --- or it never ships at all.
Now here is the other story. You have 48 hours in a game jam. The theme is "only one." You must use a specific engine and produce a playable build by Sunday at midnight. You make the best thing you have ever made.
Why does the second scenario produce better work? Because constraints eliminate options. When you can do anything, you have to decide what to do, which is paralyzing. When you can only do certain things, you ask how to do them, which is energizing. Constraints transform an infinite canvas into a specific problem, and humans are problem-solving machines.
Hardware Constraints as Design Innovation
Some of the most celebrated games in history exist because of limitations, not despite them.
The NES (1983). The Nintendo Entertainment System could display 64 sprites on screen, used an 8-bit processor, and had 2 KB of RAM. Super Mario Bros. was designed within these constraints. The scrolling levels, the enemy patterns, the power-up system, the tight jump physics --- all of it was shaped by what the hardware could and could not do. The famous clouds and bushes in Super Mario Bros. are the same sprite with different color palettes. That is not laziness. That is creativity under constraint: how do I make a rich-feeling world with extremely limited tile memory?
The Game Boy (1989). Four shades of grey. A screen resolution of 160x144 pixels. No backlight. Tetris was perfect for it. The game needed only simple shapes, no color, and minimal screen space. Pokemon Red and Blue told a 40-hour RPG story with sprite-based graphics and a four-channel sound chip. The constraints forced Game Freak to invest in systems design --- the type chart, the evolution system, the catch-and-trade mechanic --- because they could not rely on visual spectacle.
Early Doom (1993). The id Tech 1 engine could not render rooms above rooms. Every level in DOOM is technically flat --- a 2D map with height variation. This constraint forced the level designers to think in terms of horizontal space, producing the tight, maze-like corridors that defined the game's feel. The limitation became the aesthetic.
🛠️ Design Tool: If you are stuck on a design problem, add a constraint. Limit your color palette. Restrict the number of mechanics. Give yourself a page limit for the design document. Reduce the scope to one room. Constraints do not shrink the possibility space --- they concentrate your attention on the part of the possibility space that matters.
Game Jam Constraints
Game jams are the purest demonstration of constraint-as-fuel. Ludum Dare, the Global Game Jam, and dozens of smaller events give developers 24 to 72 hours to build a complete game, often with a mandatory theme and specific tools.
The results are disproportionately creative. Superhot started as a 7-day game jam prototype. Celeste originated from a game jam called PICO-8 Jam, where the console was limited to 128x128 pixels, 16 colors, and 256 8x8 sprite tiles. The PICO-8 version of Celeste has the same core mechanics --- jump, dash, climb, wall-jump --- as the full commercial release. The constraints did not limit the design. They distilled it to its essence.
The reason game jams produce such focused results is that the time constraint eliminates scope creep. You cannot build a 40-hour open world in 48 hours, so you do not try. You build the tightest, most focused experience you can, and often that is better than what you would have built with unlimited time, because you are forced to identify the core of your idea and execute only that.
Constraints in Your Design
As you build your project across this book, you will encounter constraints constantly:
- Your prototype uses placeholder art. That constraint forces you to focus on mechanics rather than aesthetics, which is the correct priority at this stage.
- Godot is free but less feature-rich than Unreal or Unity in some areas. That constraint means you solve problems differently, often more elegantly.
- This is a 2D game. That constraint eliminates an entire axis of spatial complexity, which lets you focus on the two-dimensional problem space.
- You are one person (or a small team). That constraint determines scope.
Every one of these constraints is a gift. They tell you what not to worry about, which is the most valuable information a designer can have.
7.6 The Possibility Space
When a game's rules are defined, they create something designers call the possibility space: the complete set of states, actions, and outcomes that the rules permit.
Think of it this way. Before you add any rules to your prototype, the possibility space is infinite. The character could be anywhere, doing anything, in any state. There are no constraints, so there are no boundaries to the space.
The moment you add a rule --- "the player cannot walk through walls" --- the possibility space shrinks. There are now positions the player cannot occupy. Paths they cannot take. Walls create corridors, and corridors create routes, and routes create decisions about which route to take.
Add another rule --- "doors require keys" --- and the space shrinks again. But something else happens: the space develops structure. There are now areas the player can access and areas they cannot. There is a sequence implied by the key-and-lock pattern: find key, then open door. The possibility space is smaller but more interesting because it has internal logic.
Add another rule --- "enemies patrol specific paths" --- and now the player must reason about timing, positioning, and risk. The space develops dynamics: things change over time, and the player must adapt.
💡 Intuition: The possibility space is like a sculpture. The raw marble is infinite potential. Every cut removes material. But the sculpture emerges only through removal. The rules are the chisel. The possibility space is the marble. And the experience --- the actual game --- is the shape that remains after you have cut away everything that does not serve it.
Possibility Space and Depth
Two games can have the same size of possibility space but very different depths. Size is the number of possible states. Depth is the number of meaningfully different strategies for navigating those states.
Tic-tac-toe has a small possibility space (fewer than 6,000 possible games) and shallow depth (optimal play is solvable, and the game always ends in a draw between competent players). Chess has an enormous possibility space (more legal positions than atoms in the observable universe) and extraordinary depth (after thousands of years, humans are still discovering new strategies).
The difference is not about the number of rules. Tic-tac-toe has simple rules. Chess has simple rules too --- only slightly more complex. The difference is in how the rules interact. In tic-tac-toe, each move is largely independent. In chess, each move affects every other piece's possibilities, creating cascading consequences that propagate through the entire board state.
This is the key insight: depth comes from rule interactions, not from rule quantity. A game with twenty poorly interacting mechanics will be shallower than a game with five mechanics that interact richly. Baba Is You has two mechanics (move and push). But because one of those mechanics can alter the rules themselves, the game's possibility space has enormous depth. Two mechanics, hundreds of puzzles, and every one feels genuinely different.
When you design rules, always ask: "How does this rule interact with my existing rules?" If the answer is "it doesn't --- it operates independently," the rule is adding breadth (more stuff to do) but not depth (more ways to think). Breadth without depth produces shallow games that feel wide but thin. Depth without breadth produces focused games that reward mastery. The best games have both, but depth is harder to achieve and more valuable.
7.7 Rules and Fairness: The Player's Implicit Contract
When a player starts your game, they make an unspoken agreement with you. The terms are something like this:
"I will invest my time and attention. In return, I expect the game to be consistent, honest, and fair. If I fail, it should be because I made a mistake, not because the game broke its own rules. If I succeed, it should be because I earned it, not because the game let me win."
This is the player's implicit contract, and violating it is one of the fastest ways to destroy engagement.
Consistency
Rules must be consistent. If a wall blocks the player in one room, it must block them in every room. If fire damages the player on one level, it must damage them on every level. If a key opens one locked door, it should open (or have a clear reason not to open) other locked doors.
Inconsistency destroys learning. Players understand your game by building a mental model of its rules. Every consistent interaction reinforces that model. Every inconsistency forces the player to ask: "Is this a new rule, a special case, or a bug?" If they cannot tell, they lose trust in the model, and without a reliable model, they cannot make meaningful decisions.
⚡ Design Pitfall: The most common source of inconsistency in indie games is special-casing. A designer wants a specific moment to work a certain way, so they code an exception to the normal rules. The moment feels good in isolation, but the player's mental model now has a crack. Design systems, not moments. If you need a moment where fire does not deal damage, do not turn off fire damage --- create a fireproof item that the player can equip. The system is preserved. The moment works. The model holds.
Transparency
The player should be able to understand why things happen. This does not mean showing them the code or the formulas. It means ensuring that every outcome the player experiences can be traced, at least approximately, to something they did or something they can observe.
If the player dies, they should know why. "That enemy's attack hit me because I failed to dodge" is transparent. "I suddenly lost half my health and I don't know what happened" is opaque. Dark Souls is brutally difficult but widely considered fair because every death is traceable to a player mistake. The enemy telegraphed the attack. The player failed to dodge. The feedback was clear. The death was earned.
If damage is calculated using a complex formula with twelve variables, the player does not need to see the formula. But they should be able to observe the pattern: "Fire does more damage than ice against this enemy. Upgrading my sword increased my damage. Attacking from behind does extra damage." The patterns are discoverable through play, even if the underlying math is hidden.
The Unwritten Rules of Fairness
Players bring expectations from their experience with other games. Some of the most important unwritten rules include:
- If it looks deadly, it is deadly. Spikes, lava, bottomless pits --- the visual language of danger is well-established. Do not put harmless aesthetic lava next to a deadly lava pit unless you clearly differentiate them.
- If it looks interactive, it is interactive. A lever on a wall should do something when pulled. A door with a handle should open or clearly indicate why it cannot. A chest should contain something. Decorative objects that look interactive but are not are violations of this contract.
- If the game teaches a rule, it will follow the rule. If the tutorial teaches you that crouching makes you invisible to enemies, that rule must work for the entire game. Introducing an enemy that can see through crouch in chapter 15 without warning is a betrayal.
- Death should be the player's fault. Unavoidable damage, invisible traps with no warning, enemies that appear behind the player with no telegraph --- these feel unfair because they violate the implicit rule that skill and attention should determine the outcome.
🪞 Reflection: "Fairness" does not mean "easy." Celeste is brutally difficult. Dark Souls is punishing. Super Meat Boy kills you hundreds of times. All three are widely considered fair. Fairness is about consistency, transparency, and the player's ability to learn from failure. A hard game that is fair produces determination: "I can do this if I play better." A hard game that is unfair produces resentment: "The game cheated." The rules are the same. The trust is different.
7.8 Rule Breaking as a Design Tool
Everything in the previous section was about why rules should be consistent. Now we talk about why breaking them can be extraordinary.
The most memorable moments in games are often moments where the rules change. Not because the game is inconsistent --- but because the designer deliberately subverts the player's expectations for dramatic or mechanical effect.
Baba Is You: Rules as Physical Objects
Baba Is You (2019) is the purest example of rule-breaking as a mechanic. The game's rules are physically present on each level as pushable word tiles. "BABA IS YOU" means you control Baba. "WALL IS STOP" means walls block movement. "FLAG IS WIN" means touching the flag wins the level.
But you can push those tiles. You can rearrange them. "WALL IS STOP" becomes "WALL IS YOU" --- and now you are the wall. "FLAG IS WIN" becomes "BABA IS WIN" --- and you have won by redefining what winning means. "ROCK IS PUSH" can become "ROCK IS YOU AND WIN."
The game's constitutive rules (tiles on a grid, pushing mechanics) are simple. But the operational rules (what you do) change constantly because the rules themselves are objects in the game world. The possibility space is not static --- it is something the player actively reshapes.
This works because the meta-rules are consistent. You can always push tiles. Sentences always read left-to-right or top-to-bottom. The syntax of the rule language is learnable and predictable. The game does not break its own rules --- it gives the player the power to break them within a consistent framework.
🧩 Design Insight: Baba Is You works because rule-breaking is the mechanic, not an exception. The player expects rules to be malleable because the game teaches this from the first level. Expectations are set correctly, so nothing feels unfair. This is the difference between a rule violation (betraying the player's trust) and a rule mechanic (making rule-manipulation part of the game's design).
Undertale: The Genocide Route
Undertale (2015) has two primary play styles: the Pacifist route (spare every enemy) and the Genocide route (kill every enemy). The Pacifist route plays like a conventional RPG with a twist --- the battle system has a "mercy" mechanic that lets you resolve encounters without violence.
The Genocide route breaks the game's own rules. It is boring on purpose. The random encounters dry up, and you have to walk back and forth in empty rooms grinding for kills that are not fun. The music changes to something ominous. NPCs flee from you. The game becomes hostile to the player, not the character.
And then, at the end, the game addresses you --- not your character, but you, the player. It acknowledges that you chose this route knowing what it would cost. It asks whether you want to reset the world, and if you do, it remembers. The Genocide route permanently alters the Pacifist ending, even in subsequent playthroughs. You cannot undo what you did.
This works because it uses rule-breaking for narrative and emotional purposes. The implicit contract is deliberately violated, and the violation is the point. The game is saying: "You assumed you could do anything without consequences. You assumed the reset button erased everything. You were wrong."
The Stanley Parable: Narrator vs. Player
The Stanley Parable (2013) builds its entire experience around the tension between the narrator's instructions (the rules) and the player's desire to deviate. Follow the narrator's directions and you reach a conventional ending. Disobey and the narrator becomes increasingly frustrated, the level geometry changes, and the game spirals into meta-commentary about choice, free will, and the nature of game design.
The "rules" in The Stanley Parable are the narrator's voice. Breaking them is the game. And the game rewards breaking them with the most interesting content.
When Rule-Breaking Works (And When It Doesn't)
Rule-breaking works when:
- The game has established clear, consistent rules first. You cannot subvert expectations without first building expectations.
- The break is intentional and meaningful, not accidental. Players can tell the difference between a deliberate design choice and a bug.
- The break creates a more interesting experience than the rule would have. If breaking the rule is less fun than following it, why bother?
- The break respects the player. It may surprise them, challenge them, or provoke them --- but it should not waste their time or punish them for trusting the game.
Rule-breaking fails when:
- It happens before the player understands the rules being broken.
- It feels arbitrary or random rather than deliberate.
- It invalidates the player's prior investment. "Everything you did for the last ten hours was meaningless" is rarely compelling.
- It is used to cover up a design failure. "We could not figure out how to make this section work, so we just broke the rules" is not clever design.
🔄 Loop Back: Notice how this connects to the implicit contract from Section 7.7. Rule-breaking works when it transforms the contract rather than violating it. Undertale does not break its promise. It changes the meaning of the promise. That is the difference.
7.9 Formal Rules vs. Emergent Rules
There is a distinction that becomes critical as your game grows more complex: the difference between the rules you designed and the rules that emerge from the interaction of your designed rules.
Designed Rules (Formal)
These are the rules you wrote down, programmed, and tested. "The player moves at 200 pixels per second." "Enemies take 10 damage per hit." "Keys open locked doors." These rules are explicit, intentional, and under your control.
Emergent Rules (Discovered)
These are rules that arise from the interaction of formal rules, but that you never explicitly designed. They are behaviors the system produces that you did not anticipate.
In Breath of the Wild: - Formal rule: Fire spreads to grass. - Formal rule: Fire creates updrafts. - Formal rule: The player can paraglide. - Emergent rule: The player can set grass on fire to create an updraft and use it to fly.
Nobody at Nintendo wrote a rule that says "setting grass on fire enables flight." That behavior emerges from three separate systems interacting. And it is one of the most celebrated aspects of the game's design.
Emergent rules are both the greatest promise and the greatest risk of systems design. When they produce unexpected, delightful interactions, they make your game feel alive and deep. When they produce exploits, softlocks, or game-breaking loops, they make your game feel broken.
We will go much deeper into emergence in Chapter 9. For now, the takeaway is this: your formal rules are the ingredients. Your emergent rules are the recipe. You control the ingredients. The recipe writes itself based on how the ingredients interact. The better you understand the interactions, the more you can predict --- and steer --- the emergent behavior.
📝 Design Note: When playtesting reveals an emergent behavior you did not intend, your first question should not be "How do I fix this?" Your first question should be "Is this fun?" Some of the best features in game history started as bugs. Combos in Street Fighter II were an accident that players discovered and loved. Rocket jumping in Quake was unintended physics behavior that became a defining mechanic. If an emergent behavior is fun, consider making it a formal rule.
7.10 Writing a Rule Set for Your Game
So far this chapter has been theoretical. Now we make it concrete. Every game needs a rule set --- a clear, written list of the rules that govern the game world. Writing this document forces you to make implicit assumptions explicit, which is where design problems reveal themselves.
Here is a template for a rule set document:
Movement Rules
- What directions can the player move? (4-directional, 8-directional, free)
- What is the player's movement speed?
- Can the player move while attacking? While taking damage?
- What stops movement? (Walls, obstacles, terrain)
Collision Rules
- What does the player collide with? (Walls, enemies, objects, projectiles)
- What happens on collision with each type? (Stop, take damage, bounce, slide)
- Can the player collide with other players? (Multiplayer consideration)
Interaction Rules
- What objects can the player interact with? (Doors, chests, NPCs, switches)
- How does the player initiate interaction? (Walk into the object? Press a button? Stand nearby?)
- What are the conditions for interaction? (Requires a key? Requires a specific item? Requires a dialogue trigger?)
Combat Rules
- How does the player deal damage? (Hitbox overlap, projectile collision, area of effect)
- How do enemies deal damage? (Contact damage, projectile, area of effect)
- What determines damage amount? (Flat value, calculated from stats, random range)
- What are the invincibility frames? (How long after taking damage is the player invulnerable?)
Resource Rules
- What resources exist? (Health, currency, keys, items)
- How are resources gained? (Enemy drops, chests, exploration, purchase)
- How are resources spent? (Health by taking damage, currency at shops, keys at doors)
- Are resources persistent (saved between sessions) or temporary (reset on death)?
Death and Failure Rules
- What causes failure? (Health reaches zero, time runs out, falling off the map)
- What happens on failure? (Respawn at checkpoint, restart level, game over screen)
- What does the player lose on failure? (Progress, resources, items, nothing)
- What does the player keep on failure? (Knowledge, permanent upgrades, map data)
📝 Design Note: You do not need to answer all of these for your prototype right now. Some will be determined in later chapters. But write down the ones you know, even if they are simple: "The player moves in 8 directions at 200 pixels per second and is stopped by walls." Making it explicit makes it testable. And testable rules are how you find the rules that do not work before your players do.
7.11 GDScript: BoundarySystem.gd --- Collision Layers
Your prototype needs walls. Not invisible barriers the player guesses at, but solid, visible walls that stop movement and define the space. Godot's collision layer system makes this straightforward once you understand the concept.
Collision layers are categories. You assign objects to layers and tell Godot which layers interact with each other. The player is on one layer. Walls are on another. Enemies are on a third. Collectibles on a fourth. You decide which layers "see" each other.
Here is a script that sets up a clean boundary system for your project:
# BoundarySystem.gd
# Attach to a Node2D that parents your level's wall tilemap.
# Collision layer assignments:
# Layer 1: Player
# Layer 2: Walls / Environment
# Layer 3: Enemies
# Layer 4: Collectibles
# Layer 5: Interactables (doors, switches, NPCs)
extends Node2D
@export var player: CharacterBody2D
@export var tilemap: TileMapLayer
func _ready() -> void:
# Walls collide with everything that moves
tilemap.collision_layer = 2
tilemap.collision_mask = 0 # Walls don't need to detect others
# Player collides with walls, enemies, collectibles, interactables
if player:
player.collision_layer = 1
player.collision_mask = 2 | 3 | 4 | 5
Fifteen lines. That is all the code you need to define which things in your world are solid and which things pass through each other. The real design is in the decisions: should the player collide with enemies (contact damage) or pass through them (only hitboxes deal damage)? Should collectibles have collision (the player walks into them) or use an Area2D trigger (the player gets near them)?
Every collision decision is a rule decision. And every rule decision shapes the possibility space.
7.12 GDScript: DoorLock.gd --- The Key-and-Lock Gate Pattern
The key-and-lock pattern is one of the oldest and most versatile design tools in game design. It is not limited to literal keys and doors. Any time a player must acquire something (a key, a skill, an item, a piece of information) to access something else (a door, a new area, a reward, a story beat), they are experiencing a key-and-lock pattern.
Metroid: Missiles unlock red doors. Morph Ball unlocks narrow passages. Super Missiles unlock green doors. Each "key" is an ability that also serves as a combat and traversal mechanic.
Zelda: The hookshot unlocks gaps. Bombs unlock cracked walls. The bow unlocks eye switches. Each item is both a key and a tool.
Dark Souls: The Lordvessel unlocks late-game areas. Various keys unlock shortcuts. But the most common "key" is skill --- the boss blocking your path is a lock that only player mastery can open.
Here is a clean implementation of the key-and-lock pattern:
# DoorLock.gd
# Attach to an Area2D node with a visible sprite and collision shape.
# The door blocks passage until the player has the required key item.
extends Area2D
@export var required_key: String = "blue_key"
@export var door_sprite: Sprite2D
@export var locked_color: Color = Color(0.6, 0.2, 0.2)
@export var unlocked_color: Color = Color(0.2, 0.6, 0.2)
var is_locked: bool = true
func _ready() -> void:
body_entered.connect(_on_body_entered)
if door_sprite:
door_sprite.modulate = locked_color
func _on_body_entered(body: Node2D) -> void:
if not body.is_in_group("player") or not is_locked:
return
if GameManager.has_item(required_key):
unlock()
else:
# Feedback: door is locked, player lacks key
print("Locked. Requires: ", required_key)
func unlock() -> void:
is_locked = false
if door_sprite:
door_sprite.modulate = unlocked_color
# Disable collision so player can pass through
set_deferred("monitoring", false)
# Disable the associated static body if present
for child in get_children():
if child is StaticBody2D:
child.set_deferred("process_mode", Node.PROCESS_MODE_DISABLED)
Twenty-five lines. But look at what this pattern does for your game:
- It creates a goal. The player sees a locked door and wants to open it.
- It creates a sub-quest. The player must find the key before they can progress.
- It gates content. The designer controls the sequence of player experience.
- It rewards exploration. The key is somewhere in the world, waiting to be found.
- It provides feedback. The color change from red to green tells the player the rule has changed.
The key-and-lock pattern is not just a mechanic. It is a design philosophy: progress requires earning access, and earning access requires engaging with the game's systems.
🔗 Connection: The key-and-lock pattern is a constraint that creates choice. When the player encounters a locked door and does not have the key, they must decide: explore to find the key, or go a different direction and come back later? That decision engages spatial reasoning, memory, and planning --- all from a rule that is simple enough to explain in one sentence. "You need the key to open the door." That is the entire constitutive rule. The depth comes from the context --- where the key is, what stands between the player and the key, and what is behind the door.
7.13 Constraints in Action: Five Design Patterns
Theory is useful. Patterns are more useful. Here are five constraint patterns you will encounter and use constantly.
Pattern 1: The Timer
Rule: The player must accomplish a goal within a time limit.
Effect: Urgency. The timer eliminates the "optimal play" problem --- when the player has unlimited time, they can always find the perfect solution. The timer forces good-enough solutions made under pressure, which produces exciting, improvisational play.
Examples: Super Mario Bros. stage timer. XCOM mission timers. Cooking time in Overcooked. Speedrun communities impose timers on games that do not have them, because the timer adds depth.
Warning: Timers that are too tight produce frustration rather than urgency. The player should feel "I need to move" not "I have already failed." Give 10-20% more time than the best case solution requires.
Pattern 2: The Resource Limit
Rule: The player has a finite quantity of something critical (ammo, health, mana, inventory space).
Effect: Conservation and decision-making. When resources are limited, every expenditure is a choice. Do I use the powerful weapon now or save it? Do I heal now or risk pushing forward? Resident Evil's survival horror depends entirely on scarce ammunition and limited inventory space. Remove the resource limits and it becomes a generic action game.
Examples: Stamina in Dark Souls. Ink ribbons in Resident Evil. Durability in Breath of the Wild. Card hand size in Slay the Spire.
Pattern 3: The One-Way Gate
Rule: Once the player passes a point, they cannot return.
Effect: Commitment and consequence. One-way gates force the player to decide: am I done with this area? Have I found everything I want to find? The commitment makes the decision feel weighty. Dark Souls' shortcuts work as one-way gates in reverse --- they are permanently opened, creating a feeling of irreversible progress.
Examples: Point-of-no-return warnings in RPGs. Collapsing bridges. Consumable items that are gone once used. Roguelike room progression.
Pattern 4: The Trade-Off
Rule: Gaining one thing requires losing another.
Effect: Strategic depth. Every choice has a cost, which means every choice has meaning. Slay the Spire's card rewards force a trade-off: adding a card to your deck makes it larger, which makes your best cards appear less frequently. Taking a card is not purely beneficial. It is a bet that the card's value exceeds the cost of deck dilution.
Examples: Equipping one weapon means un-equipping another. Spending gold means not having gold. Building a farm on a tile means not building a mine. Choosing one dialogue option means not choosing the other.
Pattern 5: The Gating Mechanic
Rule: Access to content requires demonstrating mastery of a skill or acquiring a specific capability.
Effect: Pacing and motivation. Gating ensures the player encounters content in a designed sequence and has the skills to engage with it. Metroidvania games are defined by ability-gating: areas that are visible but inaccessible until the player acquires the right ability, creating the satisfying "aha, NOW I can get there" moment.
Examples: Boss gates in Dark Souls. Ability-locked areas in Metroid. Skill checks in RPGs. Level requirements for equipment.
7.14 The Rule Cascade: How One Rule Changes Everything
Here is something that catches new designers off guard: you cannot add or change a rule in isolation. Every rule interacts with every other rule, and changing one often cascades through the entire system.
Suppose you add a simple rule to your game: "the player can now double-jump." Straightforward, right? One new rule. But watch what happens:
- Level design: Every gap, platform, and vertical challenge must be re-evaluated. Previously unreachable areas are now accessible. Some puzzles are trivially solved. New puzzles become possible.
- Enemy design: Enemies that could only be reached by specific paths can now be attacked from new angles. Flying enemies that were a threat at single-jump height are now within melee range.
- Pacing: The player traverses the world faster. Areas that took thirty seconds to navigate now take fifteen. The rhythm of exploration changes.
- Balance: If the double-jump has no cost (no stamina, no cooldown), the player has strictly more capability, which makes the game easier across the board. Every difficulty curve shifts.
- Feel: The character feels floatier. The weight and momentum that defined single-jump movement are altered. The game feels different.
One rule. Five cascading effects. And I could list more.
⚠️ Common Pitfall: "Feature creep" is often "rule creep" --- the accumulation of small rules that individually seem harmless but collectively create a system that is unpredictable, unbalanceable, and untestable. Every rule you add multiplies the number of interactions in your system. A game with 5 rules has 10 possible pairwise interactions. A game with 10 rules has 45. A game with 20 rules has 190. Complexity grows quadratically. Add rules slowly. Test after every addition. Remove rules that do not justify their interaction cost.
This is why experienced designers talk about "elegance" --- the quality of a design that achieves maximum depth with minimum rules. Celeste is elegant: four movement mechanics produce a game with hundreds of hours of challenge content. Baba Is You is elegant: two mechanics produce hundreds of puzzles. Adding more mechanics would not have made either game better. It would have made them more complex, which is a different thing entirely.
7.15 Case Study Preview: Chess and Minecraft
This chapter includes two extended case studies that illustrate opposite ends of the rules spectrum.
Case Study 1: Chess demonstrates how strict rules produce infinite strategic depth. Six piece types. One board. Simple movement rules. Over a thousand years of play, and humans still have not solved it. Chess is the proof that constraints create depth --- the tighter the rules, the deeper the strategy.
Case Study 2: Minecraft demonstrates how minimal rules produce infinite creative freedom. Almost no restrictions on block placement. No objectives. No win condition. The world's best-selling game. Minecraft is the proof that the absence of certain rules can be as powerful as their presence --- but only when the rules that do exist create a compelling material system.
Both case studies confirm the same principle from different angles: rules are not the enemy of player expression. They are the medium through which expression becomes meaningful.
7.16 Progressive Project: Adding Rules to Your World
It is time to give your prototype structure. Here is what you will build in this chapter's exercises:
Collision and Boundaries
Add a tilemap with collision to your level. The player should not be able to walk through walls or off the edge of the world. Use the BoundarySystem.gd approach from Section 7.11 to organize your collision layers.
This sounds trivial, but it transforms the experience. A character that can go anywhere has no sense of place. A character that is confined to corridors and rooms has a world to explore --- because exploration requires the existence of places you cannot go.
Interactable Objects
Add at least three interactable objects to your world:
- A locked door that requires a key (use
DoorLock.gdas a starting point). - A collectible key that the player picks up by walking over it.
- A destructible object (a crate, a barrel, a bush) that the player can break with their attack action.
Each of these objects is a rule expressed as an entity. The locked door is the rule "you cannot pass without a key." The key is the rule "acquiring this item enables new access." The destructible object is the rule "your attack verb applies to the environment, not just enemies."
Define Your Rule Set
Write a one-page rule set document for your game using the template from Section 7.10. You do not need to fill in every category. Focus on the rules you have implemented: movement, collision, interaction, basic combat, and resource collection. The document should be specific enough that another designer could read it and understand exactly how your game works.
Test Your Rules
Play your prototype for ten minutes and answer these questions:
- Do the walls feel solid? Does the collision feel right, or does the player slide along walls awkwardly?
- Does the locked door create a clear goal? Does the player know they need to find the key?
- Does breaking the destructible object feel satisfying? (If not, note this for Chapter 8, where you will add feedback.)
- Is there a moment where you, as the designer, feel the prototype become more game-like than before? What is the moment? What rule is responsible?
🎮 Checkpoint: After completing this section, your project should have: collision with walls and world boundaries, at least one locked door with a key, at least one destructible object, and a written rule set document. This is the foundation upon which every future system will be built. The rules are the ground floor. Everything else --- feedback, emergence, narrative, economy --- is the building that sits on top.
7.17 The Aesthetics of Rules
Before we close this chapter, one more idea worth sitting with.
Rules have an aesthetic quality. They are not just functional --- they are expressive. The rules you choose for your game say something about what kind of experience you are making and what kind of world the player inhabits.
Dark Souls' rules say: This world is hostile. You will die. But death is a teacher, and the world is consistent. Learn its rules, and you will prevail. The aesthetic is earned mastery through suffering.
Minecraft's rules say: This world is yours. Build whatever you want. The only limits are the materials and your imagination. The aesthetic is infinite creative potential within a physical system.
Animal Crossing's rules say: This world runs in real time. The shop closes at night. Flowers take a day to grow. You cannot rush. The aesthetic is gentle patience and daily ritual.
Celeste's rules say: You will fail. You will fail a lot. But you will respawn instantly, and the challenge is always fair. The aesthetic is persistence and the courage to try again.
Every one of these aesthetics is created by rules. Not by story. Not by graphics. Not by music. By the rules that define what the player can and cannot do, what happens when they succeed, and what happens when they fail.
When you design your rules, you are not just designing a system. You are designing a feeling. The rules are the first thing the player experiences (even before they are aware of experiencing them), and they are the last thing the player remembers (even when they think they are remembering the story or the visuals).
💡 Intuition: The next time you describe a game to a friend, listen to what you actually say. "You have to manage your stamina" (rules). "You can build anything" (rules). "If you die you lose all your souls" (rules). "The world changes in real time" (rules). The stories we tell about games are stories about rules dressed in aesthetic clothing. The rules are the skeleton. Everything else is skin.
7.18 Summary
Rules are not restrictions on the player's experience. They are the architecture of the player's experience. Without rules, there is no possibility space, no meaningful choice, no sense of achievement, and no reason to play.
The three layers of rules --- constitutive, operational, and implicit --- work together to create a game that is logically sound, intuitively playable, and emotionally trustworthy. Designing good rules means creating meaningful choices with clear trade-offs, building constraints that focus rather than limit, and maintaining the implicit contract of fairness and consistency.
Constraints are the engine of creativity, for designers and players alike. The NES had 2 KB of RAM and produced Super Mario Bros. Game jams give 48 hours and produce some of the most creative games in the medium. Chess has six piece types and has been played for over a thousand years. The tight box produces the best work.
The possibility space is defined by rules, and its depth is determined by rule interactions. A few rules that interact richly produce more depth than many rules that operate independently. Every rule you add has cascading effects on the entire system. Add rules deliberately. Test constantly. Remove rules that do not justify their interaction cost.
And rule-breaking, when done deliberately and respectfully, produces some of the most powerful moments in gaming. Baba Is You makes rule-breaking the core mechanic. Undertale uses it for emotional impact. The Stanley Parable uses it for philosophical commentary. The key is to build expectations first, then subvert them for a purpose.
Your project now has walls, doors, keys, and a written rule set. It has shape. It has structure. It has the beginning of a designed experience rather than an empty sandbox. The rules you wrote today will change --- they will be refined, extended, and occasionally broken. But they exist, and their existence transforms your prototype from a collection of scripts into a world with logic.
In Chapter 8, we add the layer that makes all of these rules feel right: feedback systems. The door lock clicks. The wall collision thuds. The enemy hit flashes. The rules define what happens. The feedback tells the player that it happened. Together, they create the thing we call "game feel."
The rules are the bones. The feedback is the nervous system. We build that next.