Skip to content

Multiplayer: survive a dropped or reconnecting player #44

Description

@CubeB

From the ROADMAP: "Reconnect / drop handling instead of hard failure." A network game should not end for everyone when one player's connection drops.

Background. The sim is lockstep: peers exchange commands, not state (CLAUDE.md, "Determinism"). A tick cannot advance without every peer's commands for it, so a lost peer stalls everyone.

Needed

  1. Detect a peer that has stopped sending, with a timeout, and show the others a "waiting for player" state rather than a freeze.
  2. Drop the player after the timeout (or on a vote), so the rest carry on. Decide what their units do: in TA a departed player's units stay on the map. Dropping has to happen on the same tick on every remaining peer, or it is a desync.
  3. Rejoin, the harder half. The full-state save (save_util, hash-validated round trip) can serialise the game at a tick boundary. A returning peer could load that, then replay the commands buffered since, and rejoin the lockstep.

Where. GameNetworkService, proto/network.proto, and the launcher's game-server. Split 1+2 from 3.

Done when killing one peer's process mid-game leaves the others playing after the timeout, and with 3, the killed peer can come back.

🤖 Generated with Claude Code

https://claude.ai/code/session_018moxVoyHDBoHqkw8uqS3HX

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions