The game closed while saving and now the only save file is broken
A save that is half written looks fine until you try to load it, and then everything is gone. Here is a way to always keep one good save behind the one being written, and how to tell good from broken when loading.
Why this works
Writing a file is not instant, and power can fail halfway. Never touching the only good copy, and proving every copy with a fingerprint, means a crash costs at most the newest save, never the whole game.
When not to use it
Skip the two copies when saves are tiny and rare, or the storage already guarantees all-or-nothing writes, as many online services do. Then trust it, and spend the effort on the player's backups.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 30 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "The game closed while saving and now the only save file is broken" (read_entry save-never-lose-to-a-crash) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP