Spielerando

Lesson 1 of 14A story the game can check8 minFree

Write Your Game Story as Facts the Game Can Check

A pixel art beekeeper greets an older beekeeper, picks up keys and pulls a lever that lowers a drawbridge. A board at the top lights a lamp for each thing remembered, counts keys in three pips, and lists the latest changes. A rusty second lever only brings up a red question mark, a fourth key does not count, and once the board holds all three things the door of the hive house opens.

One memory for the whole world: the bridge, the greeting and the door all ask the board. A name that is not on the board's list, like the rusty lever's misspelled one, is refused and changes nothing. Keys count up to 3 and stop there. Greeting twice adds nothing new.

Try it: Greet the older beekeeper twice: the second time no new line appears in the list at the top. Pull the rusty lever: a red question mark, no lamp, no line. Pick up the fourth key: the pips stay at 3. Pull the good lever again: the bridge rises and the door shuts too.

Keys: ←→ walk Space greet, pick up, pull

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 World State Flags. It runs that blueprint's tested code in your browser.

In the game above, the whole story is three facts on a board: the bridge is down, the older beekeeper was greeted, and how many keys are found. Every place in that small world either changes one of them or asks about them, and the door of the hive house asks about all three. That is what a story is to a game: facts that are true or not, set by some scenes and asked about by others. This lesson has you write those facts down before any prose, so that your AI builds a story the game itself can check.

Also in this lesson 4 things to read up on 3 questions to check yourself

The idea

A story in a book lives in the reader's head. A story in a game has to live in the game, and what the game keeps of it comes down to facts. A fact is a yes or no, or a number, and that is what a game can ask about. "The bridge is down" is a fact. "The old bridge has carried the valley's beekeepers for generations" is lore. It may be lovely, and nothing in the game can ever ask whether it is true.

Every scene in a game story does two things with facts. Before it can happen, it asks about some: may the door open now? After it has happened, it sets some: from now on, the elder has been greeted. If you cannot say for a scene what it asks and what it sets, the game cannot know whether it happened, and neither can a check.

A writer in the reading list describes a unit of game story in three parts that match this: a piece of content, what must be true for it to play, and what it changes in the world once it has played. She sometimes writes such units on index cards before anything is built. That is this lesson's step: facts first, the words for the player after.

How it works

Play the game above once, all the way through the door, and keep an eye on the board at the top. It has a lamp for the bridge and one for the greeting, three pips for keys, and a row of the latest changes, newest on the right. The blueprint keeps the last 20 changes like this, so that when a door stays shut you can see what set what.

Now take a sheet of paper and make a table with three columns: the fact, what sets it, and what asks about it. Fill it in from what you just saw.

Look at the front of the hive house. Three small pictures there, a bridge, a hat and a key, light up one by one as each part of the door's question holds. The door keeps no notes of its own. It asks the board.

Now check your table in both directions. Every fact that something asks about needs something that sets it, or the question can never be answered yes. Every fact that is set needs something that asks about it, or it is lore wearing a name. In the game above, both directions hold for all three facts.

Then play it in another order: the keys and the bridge first, the greeting last. The door opens just the same, because it asks about the facts and not about the order in which they became true. A story written as facts holds in orders you never wrote down.

Last, pull the rusty lever. It is wired to the name bridge-dwon, a typing mistake for the real one. The board refuses it: a red question mark, no lamp, no new entry in the row. It can refuse because the list of names was written before anything else. Without that list, the lever would have made a second fact that nothing asks about, and a player who pulled only that lever would wait at the river for a bridge that never comes down.

What goes wrong

The shortcut is to ask an AI for "the story of my beekeeper game" and take what comes: pages of lore about the elder's past, how the bridge came to be, the old legend of the hive house. It is often well written, and there is not one line in it the game can ask about.

Then the AI builds the scenes and has to invent the facts on the spot. It puts talkedToElder into the greeting's code. A week later, in a new chat, it builds the door and has it ask for elderMet. Nothing complains: the game runs, every scene works on its own, and the door stays shut for a player who did everything right. This is the rusty lever again, only this time nothing refuses it.

You notice it when you ask your AI for a list of every fact the game remembers, with what sets and what asks about each one. If it has to search the code to answer, there is no list. If one fact turns up under two names, or something asks about a fact that nothing sets, the shortcut was taken. And if "has the player met the elder yet?" gets a sentence of lore instead of a name from a list, the story lives in prose, where the game cannot check it.

Tell your AI

Before you write any story text for my game, write the story down as facts. No dialogue and no descriptions yet.

My game: [two sentences about it]. The story so far: [paste it, or say "read it from the project"].

1. Make one list of every fact the game has to remember: a name, whether it is a yes or no or a number, and for a number its lowest and highest value. From now on, use only names from this list.
2. Make a table with one row per scene, place or object: what it asks about before it can happen, and what it sets or changes after it has happened. Use only names from the list.
3. Mark every piece of story we already have that is not a fact on the list as "lore". The game cannot ask about lore.
4. Write a small check in code that reads the list and the table and prints three things: every name in the table that is not on the list, every fact something asks about that nothing sets, and every fact that is set and nothing asks about. Run it and show me what it printed, word for word.
5. Write one test for every row: start from a fresh game, make true what the row asks for, run the scene, and check that exactly the facts in the row changed and nothing else. Run the tests and show me their output.

Only when the check prints nothing I have not decided, write the scenes, each one true to its row. If we need a new fact later, add it to the list first and run the check again.

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

Your notes for the story of a game hold four lines. Which one is a fact the game itself can ask about?

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

Next lesson Meaningful Choices in Games: Something Has to Read Them

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