Two players save at the same moment and one of them loses their gold
When two people change the same shared record, the last write quietly erases the first. Here is how to combine both changes the way people expect, which things add up and which cannot, and how to report a clash instead of hiding it.
Why this works
What matters is what each person changed, not what they ended up with. Comparing both against the shared starting point shows who touched what, so independent edits combine and nobody's gain is erased, while a real clash is reported openly.
When not to use it
Too much for a game where saves are rare and one person owns the record, or where a clash must never be settled by software, such as trading valuable items. Then make players save one after the other and show the newer state.
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
- 29 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 "Two players save at the same moment and one of them loses their gold" (read_entry merge-two-saves-made-at-once) 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