Undo and redo while planning a city, with money that stays right
Planning a layout is easier when every placement can be taken back. Two things usually go wrong: money gets out of step with the buildings after a few undos, and a new action after an undo leaves a redo that makes no sense. Here is a history that stays consistent.
Why this works
Money and buildings must never be set by hand, only by doing or reversing a recorded action. Then they cannot drift apart, and going back is simply the same record read in reverse.
When not to use it
Not for a game where actions have consequences that cannot be reversed, such as a fight, a random draw or time passing, because a take-back would hide that. Use it for planning only, and make the player confirm the plan for real.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 45 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 "Undo and redo while planning a city, with money that stays right" (read_entry sandbox-undo-redo-with-money-and-commit) 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