A reward message arrives twice after a bad connection and the player is paid double
Online games resend messages when they are unsure whether they arrived, so the same kill can be reported two times. Deleting duplicates sounds easy until messages also arrive out of order. Here is a bookkeeping method that pays each reward once without remembering everything forever.
Why this works
Sending again is the only safe answer to a lost message, so the receiver must be the one that copes with doubles. Numbering each message lets it tell a repeat from something new, and remembering only a recent stretch keeps that memory small.
When not to use it
Skip it when a repeat is harmless anyway, for example when a message says what the total now is instead of what to add. Then simply take the latest value, and numbering every reward only adds work and a place for mistakes.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 18 lines of example code with 3 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "A reward message arrives twice after a bad connection and the player is paid double" (read_entry ignore-a-repeated-reward-message-after-a-network-retry) 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