Desync auto-resync — client receives and loads state #7

Closed
opened 2026-08-25 06:03:46 +02:00 by pbwraith · 1 comment
Owner

Repo: gopher64-netplay (fork of https://github.com/gopher64/gopher64)
Context: Full scope doc at upstream analysis — see commit history. Netplay uses GGRS over WebRTC (matchbox_socket), reliable channel carries NetplayMessage { name, data } in 16KB chunks. Savestates serialize full Device via postcard + compress.

Goal: The desynced peer receives resync_state, loads it, acks, and resumes.

Background:

  • Reliable-channel receive path already accumulates messages in process_reliable_messages → netplay.messages map (keyed by name)
  • Downstream of #1, #2, #6

Acceptance:

  • Poll for resync_state message key during the frame loop (in process_netplay — check the loop in netplay::process_requests)
  • On receipt:
    • Client loads state via load_savestate_from_data
    • Client sends resync_ready ack
    • Client calls frame reset (#5) to match the host frame (frame travels inside the state message)
    • Client resumes frame loop
  • State must swap device AND rdp_state AND ra_state (full parity with disk savestates)
  • Tests: mock host → client message flow, assert client loads state and frame matches host.

Verification: cargo test.

**Repo:** gopher64-netplay (fork of https://github.com/gopher64/gopher64) **Context:** Full scope doc at upstream analysis — see commit history. Netplay uses GGRS over WebRTC (matchbox_socket), reliable channel carries `NetplayMessage { name, data }` in 16KB chunks. Savestates serialize full Device via postcard + compress. **Goal:** The desynced peer receives `resync_state`, loads it, acks, and resumes. **Background:** - Reliable-channel receive path already accumulates messages in `process_reliable_messages` → `netplay.messages` map (keyed by name) - Downstream of #1, #2, #6 **Acceptance:** - Poll for `resync_state` message key during the frame loop (in `process_netplay` — check the loop in `netplay::process_requests`) - On receipt: - Client loads state via `load_savestate_from_data` - Client sends `resync_ready` ack - Client calls frame reset (#5) to match the host frame (frame travels inside the state message) - Client resumes frame loop - State must swap device AND rdp_state AND ra_state (full parity with disk savestates) - Tests: mock host → client message flow, assert client loads state and frame matches host. **Verification:** `cargo test`.
pbwraith added the
netplay
p2
rust
labels 2026-08-25 06:04:35 +02:00
pbwraith added the
in-progress
label 2026-08-25 07:46:38 +02:00
pbwraith added
in-review
and removed
in-progress
labels 2026-08-25 07:49:38 +02:00
Author
Owner

/tmp/comment_7.md

/tmp/comment_7.md
pbwraith added the
manual-only
label 2026-08-26 20:25:33 +02:00
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: pbwraith/gopher64-netplay#7
No description provided.