Spielerando

Lesson 6 of 14Quests that cannot get stuck9 minFree

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

A pixel art beekeeper walks across a glowing patch of meadow in front of a big hive, and nothing happens. She fetches a smoker, steps back onto the patch, and black bars close in: smoke rises and bees fly a circle. She skips the scene and still gets a jar of honey; the patch turns grey until she steps off, and the second time the scene plays to the end. Then the patch is gone.

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.

Keys: ←→ walk X skip the scene

This little game runs this blueprint's tested code in your browser. Nothing you press is sent anywhere. Its code on GitHub.

The game above is the playable demo of our blueprint Cutscene Triggers. It runs that blueprint's tested code in your browser.

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. Stand still. Stay on the patch, now grey. Nothing starts: after a scene she must step off before it can play again.
  6. 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

Read up

Where to go deeper: the pages of ours this lesson builds on, and what others have written about its point.

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.

Question 1 of 3Easy

In the game above, the player walks onto the patch before she has fetched the smoker. What happens, and which rule does it show?

All questions of this course · The quiz and the Game Coder IQ

Next lesson Game Characters Who Remember: One Number Every Line Reads

How useful was this page?

Nobody has rated this page yet.

One click, no account. It tells us which pages to make better next.

Last updated: 2026-11-27