After a crash a player's gold no longer matches what they earned and spent
Keeping only the current amount means that one lost write leaves a number nobody can explain, and one repeated write gives free money. Here is a simple record of every change that can check the total, refuse a bad spend and repair itself.
Why this works
A single number can be wrong without anyone noticing, but a full list of every change can be added up again and checked. Treating the list as the truth and the number as a shortcut makes any mismatch visible and fixable without guessing.
When not to use it
Too heavy for a currency that does not matter, such as points in a small free game, and the list grows without end if it is never trimmed. For minor values keep one number; for money-like values, archive old lines and keep a checked total.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- A diagram of every state
- 22 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 "After a crash a player's gold no longer matches what they earned and spent" (read_entry balance-that-matches-its-history) 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