Every Order a Player Tries: Scenes That Fire Twice or Too Soon

The demo is playing itself. Press a key or a button to take over.
The scene starts only on the patch and only with the smoker. It runs 6 seconds and always gives control back. A skip counts from 1 second in, and a skipped scene hands over the jar just like a finished one. Here it may play twice: after the first, she has to step off the patch before it can start again.
Try it: Press skip the moment the bars close in: nothing happens, the key is still grey. Press again once it lights up: the scene ends and the jar still arrives. Stay on the grey patch after a scene: it does not start again until you step off and back on.
←→ walk X skip the scene
A player does things in an order nobody wrote. She steps onto the spot before she has what the scene needs, presses skip at once, stands still where the scene ended. Each of those orders can make a scene play twice, never, or before what should cause it. The scene in the game above holds against all of them: try them by hand here, then hand the rest to a checker that tries every order and prints the one that breaks a rule.
Also in this lesson 5 things to read up on 3 questions to check yourself
The idea
Your story has one order, the one you wrote. A player makes her own, and a rule that holds in yours may not hold in hers. With a scene, it breaks in three ways: the scene plays twice, it never plays or stops half done, or it plays before its cause.
You cannot try every order by hand. Even in the small scene above, something can change at every moment: where she stands, whether she holds what the scene needs, whether she presses skip, how far the scene has run. An article in the reading list says it of programs in general: most of the time a design behaves as expected, and the bug sits in very particular orderings of events.
That is what a checker is for. It tries every sequence of things a player can do, one step after the other, and checks your rules after each step. When a rule breaks, it prints the order that led there, step by step, so that you can play it yourself. You do not need to read the checker's language. Your AI writes the model and runs it, and you read what it prints.
How it works
In the game above, a patch of meadow in front of the big hive is where the scene starts, and the scene needs the smoker, which stands on a stump at the far right. The scene runs 6 seconds, a skip counts from 1 second in, and its result is a jar of honey. The blueprint lets a scene play once; the game above lets it play twice, so that you can see the state in which she must step off first.
Try these orders. Each one is a rule.
- The place before the cause. Walk right onto the patch with empty hands. Nothing starts, and a smoker with a red question mark appears over the hive: what is missing.
- The cause, then the place. Fetch the smoker and walk back onto the patch, which now glows. Black bars close in, and you have no control until the scene ends.
- Skip at once. Press skip the moment the bars come. A red cross shows: the press came too early and is dropped, not kept for later.
- Skip in time. Press again once the skip key lights up. The scene ends, and the jar still comes: a skipped scene counts like one that ran to its end.
- Stand still. Stay on the patch, now grey. Nothing starts: after a scene she must step off before it can play again.
- Step off and on. The patch glows, and the scene plays its second time. Let it run: after 6 seconds you have control again, the patch is gone, and a moment later the meadow starts over.
That is six orders. The blueprint's page shows a check that tried every order, not six: TLC, a model checker, walked every tick of being on the patch or not, holding what the scene needs or not, and pressing skip or not, for small scenes, and found no rule broken. Then the mistake was planted that a scene gives its result only when it runs to its end. TLC printed the way there in three states: she walks in, the scene starts, a skip ends it, and the scene counts as played with its result never given.
This site has its own case. When we checked every one of our blueprints this way, the checks found bugs in code that already had tests and passed them. One was a pop-up for achievements: a summary pop-up kept its count after it ended while another pop-up was waiting, so the next summary told the same unlocks again. TLC found a path on which one unlock was set to be told twice. That is the scene that plays twice, in another form, in an order our own tests had missed.
What goes wrong
The shortcut is that the AI plays the story once, in the order it wrote it, and says it works. For the hive that run is: fetch the smoker, walk onto the patch, watch to the end, take the jar. It passes. It never crossed the patch with empty hands, never skipped, never stood still after the end.
Each order it skipped can hide a bug that ships. The result is given only when the scene runs to its end, so a skip leaves the story half done: no jar, a door that never opens. The scene starts again at once because she is still standing in it. A press of skip from just before the scene throws away a scene she never saw. The scene starts on the patch before the smoker is in her hand.
You notice the shortcut in the report. "I tested it and it works" names one order, or none. A checker's report names how many states it walked, whether it was cut off, and the order of every broken rule. A walk speaks only for the small version it walked, so a good report also says how big that was.
Tell your AI
Do not tell me my story works because you played it once. Check every order a player can try.
1. Write the part that worries me [a scene, a quest, a door] as a small model: what the game remembers (where the player is, what she holds, what has happened, what each scene has done), how it starts, and every move a player can make at any time, in any order: walk in and out, pick up, skip, stand still, save and load, come back later.
2. Write the rules that must hold after every move: a scene starts only when its cause is true, never plays twice unless it may, always gives control back, and gives the same result whether it was watched or skipped. Add my own rules: [your rules].
3. Let a checker walk every order of those moves: a model checker such as TLC, or the story-model-check recipe from spielerando.com. Tell me how many states it walked and whether it was cut off. If you can run neither, say so and claim nothing.
4. Plant one mistake on purpose, such as the result given only when the scene runs to its end, and show me that the checker catches it and prints the order that breaks the rule.
5. For every broken rule, tell me the order in plain words, so that I can play it myself. Do not fix anything yet. Paste the checker's real output, not your summary.
Try it
- In the game above, look for an order the six do not cover, and play it. Walking off the patch while the scene runs is one: you cannot, because you have no control, and the blueprint's rule is that leaving would not stop a scene that has begun anyway.
- Skip one play and watch the other to its end. The dots at the top left and the jars at the top right go up by one each time, whichever way the scene ended. That is the rule a checker tests after every step: the result is never lost and never given twice.
- Ask your AI to write one quest or chapter of your game as data for the plot hole finder, and paste it into the checker on this site. Read what it prints: how much it walked, and the path to every problem. Then play one of those paths in your game.
Read up
Where to go deeper: the pages of ours this lesson builds on, and what others have written about its point.
The blueprint behind the hive: its five rules, the tested code, and the walks of every order with their real output, the planted mistake and the path that caught it.
The Bugs Our Proofs Found in Our Own Code
Every bug the checks found in our own tested code, in plain words: what went wrong, which check caught it and how, the fix, and what such checks do not cover.
The checker your AI can run on a story written as facts, scenes and rules: it walks every way the story can go and reports each broken rule with its path of scenes.
TLA+ for Game Makers: Let a Checker Walk Every Path
For the curious and for your AI: what a model for TLC looks like, a small puzzle that can softlock, a rule broken on purpose, and how to install and run the checker.
Learn TLA+: Conceptual Overview
A short tour of model checking outside games: a design that works in most orders and breaks in one, and why a passing check speaks only for the sizes it was given.
Check yourself: three questions
Each answer is checked and explained at once. The questions are part of the quiz, so they count for your Game Coder IQ like any other.
In the game above, the player walks onto the patch before she has fetched the smoker. What happens, and which rule does it show?
Next lesson Game Characters Who Remember: One Number Every Line Reads
How useful was this page?
Nobody has rated this page yet.