How to Make Save Games That Keep the Story
A save has to store what has happened in the story, not only where the player stands. Have your AI model saving and loading as steps in the story, and a checker will show you the exact path where a fact gets lost.
Why does my story reset when I load a save?
In a small castle game, the player frees the prisoner in the tower, saves and quits. The next day they load the game. They stand in the right room with the right amount of gold. But the prisoner is back in the tower, and a guard thanks them for something that has not happened.
When the AI built saving, it saved the obvious things: position, health and coins. The story came later. Each new scene added something new to remember, and nobody told the AI to add that to the save. Reading the save code will not show this, because the problem sits between the save and a scene much later.
Which facts and rules keep the story through a save?
- Facts: every story fact and choice, quest progress, who is alive, where they are, what they know and what the player carries. The model also keeps a copy of what the save holds.
- Saving and loading are steps. So the checker tries saving and loading at every point in the story.
- Nothing is lost. After loading, every fact is the same as when the game saved.
- A later scene only uses what the save kept. The guard only thanks the player if the prisoner is free after loading.
- Old saves still work. When an update adds a fact, a save without it gets a sensible value.
Keep story text out of the save. The save says "the prisoner is free", and the words stay in the game, so a fixed typo reaches every player. Each save also needs a version number, so the game knows how old it is.
What does a real check look like?
Here is the castle as a model. The player frees the prisoner, saves and quits, loads the save, and the guard says thank you. The save does not store the prisoner.
We ran this invented story through TLC 2.19 on 2 November 2026. This is TLC's real output. We only left out its housekeeping lines and put each step on one line.
Error: Invariant GuardOnlyThanksForWhatHappened is violated.
State 1: scene = "Start", prisonerFree = FALSE, savedPrisonerFree = FALSE
State 2: scene = "Tower", prisonerFree = FALSE, savedPrisonerFree = FALSE
State 3: scene = "Free the prisoner", prisonerFree = TRUE, savedPrisonerFree = FALSE
State 4: scene = "Save and quit", prisonerFree = TRUE, savedPrisonerFree = FALSE
State 5: scene = "Load the save", prisonerFree = FALSE, savedPrisonerFree = FALSE
State 6: scene = "Guard thanks you", prisonerFree = FALSE, savedPrisonerFree = FALSE
Watch the prisoner. He is free in step 4 and not free in step 5, right after loading. In step 6 the guard thanks the player anyway. That path is the proof.
The fix: the save now stores the prisoner too. We ran TLC again.
Model checking completed. No error has been found.
8 states generated, 7 distinct states found, 0 states left on queue.
TLC looked at all 7 states the story can reach, and the rule held on every path.
What other save mistakes should I watch for?
- Autosave at a bad moment. A save in the middle of a scene or a fight can trap the player. Autosave at calm moments.
- Only one save slot. One bad save and the whole run is lost. Keep the previous autosave too.
- A crash while saving. It must not destroy the last good save.
Do I have to read any of this?
No. You never have to read the model or the checker's output, because your AI writes it, runs it and tells you the result in plain words. TLA+ is a language for modelling, and TLC is the tool that checks a model. If TLC cannot run on your computer, your AI can get a ready-made checker through our MCP server and run it in your project. Spielerando never looks at your story.
A pass means your rules held on every path in the model. It checks the model of your saves, not your game's real save code, and it does not mean your story is good.
Paste this to your AI
Do not just tell me saving works. Model it and check it with a tool.
1. Look at how my game saves today. If you cannot see my files, ask me to paste the part that saves the game.
2. List everything that changes while playing: story facts, choices, quests, who is alive, what characters know, items, place and time. For each one, show me the part of the game that saves it. If you cannot find that part, say it is not saved or say "I do not know".
3. Write a TLA+ model of the story in a folder called story-check.
- Facts, as state: everything on that list, plus a copy of what the save holds.
- Steps: every scene and choice, plus saving and loading at every point.
- Rules, as invariants: after loading, every fact is the same as when the game saved. No scene uses a fact the save lost. A save from an older version gets a sensible value for anything missing.
4. Run the TLC model checker on the model so that it walks every path. If TLC cannot run here, use get_recipe with story-model-check through Spielerando and run that checker in this project. If you can run neither, tell me, and do not claim that anything was checked.
5. For each broken rule, show me the exact path of scenes the checker found, in plain words, and name the fact that got lost.
6. Do not change my game yet. Suggest a fix for each path and wait for me to pick.
7. Build what I pick: all of this lives in one place, and that one place is what gets saved. Each save has a version number. Story text stays out of the save. A crash while saving cannot destroy the last good save. The game does not autosave in the middle of a scene or a fight, and it keeps the previous autosave.
8. Update the model, run the checker again and show me the result. Then try saving and loading in the real game, and show me what you tried and what happened. How you try it is up to you. If you could not try something, such as loading an old save, say "I do not know if this works".
From now on, whenever you add something the game must remember, add it to the save and the model in the same step, and run the checker again. Report only which rules held, how many states were checked and whether the check was cut off. Never tell me saving works unless you can show it.
Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
How to check it worked
- Play the path it gave you. Follow those exact steps in the game, including saving and loading. You should see the fact get lost.
- Quit for real. Do something that changes the story, save, close the game completely and load. Is it still changed?
- Keep an old save. Keep one save from today. Load it after your next update. Does it still work?
- Save around a big choice. Save just before it and just after it. Load each one. Both should be right.
- Pull the plug. Force the game to close while it saves, then load. You should still have a good save.
If something else breaks after every update, read my game keeps breaking.