Players are kicked for a lag spike, or ghosts stay in the game for minutes
A fixed timeout is either too short, and a hiccup throws someone out, or too long, and a player who closed the lid stays in the game as a frozen figure. This entry shows a middle stage and a timeout that adapts to the connection.
Why this works
Silence has more than one cause: a hiccup, a bad patch or a real exit. Deciding in steps lets you react gently at first and only take the drastic step when waiting longer has really stopped being reasonable.
When not to use it
Overkill for a two-player turn-based game, where the other person is simply there or not and a plain timeout works. It also does not help when you need an exact answer about who left, such as in a ranked match.
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
- 17 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 "Players are kicked for a lag spike, or ghosts stay in the game for minutes" (read_entry heartbeat-suspect-before-dead) 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