group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
Server::ClientNetState Struct Reference

PR-2b (server-perf): bulk-snapshot every connected client's last-reported network state in one (mostly lock-free) operation. More...

#include <Server.hpp>

Collaboration diagram for Server::ClientNetState:
[legend]

Public Attributes

ClientId id
uint16_t rttMs
uint8_t interpDelaySnapshots
uint16_t interpDelayMs
 PR-31: client's measured render delay in ms (EMA-derived).

Detailed Description

PR-2b (server-perf): bulk-snapshot every connected client's last-reported network state in one (mostly lock-free) operation.

PR-12 expanded this from "just RTT" to "RTT + interp-delay" so the game thread's updateLagCompTargets can compute the rewind formula targetServerTick = currentServerTick − (RTT/2 + interp) from a single snapshot. At 100 bots × 128 Hz, the per-client form was ~13 k mutex ops/sec on stateMutex_, contending hard with the network thread; bulk snapshot collapses to 1 op/tick (PR-4 atomic publish makes the read itself lock-free).

Parameters
outCleared and filled with ClientNetState records in unspecified order. Caller is expected to reuse the same vector across ticks to avoid allocation churn.

Member Data Documentation

◆ id

ClientId Server::ClientNetState::id

◆ interpDelayMs

uint16_t Server::ClientNetState::interpDelayMs

PR-31: client's measured render delay in ms (EMA-derived).

Zero when interp is off or the client predates the field, which selects the snapshot-count fallback in computeRewindTicks.

◆ interpDelaySnapshots

uint8_t Server::ClientNetState::interpDelaySnapshots

◆ rttMs

uint16_t Server::ClientNetState::rttMs

The documentation for this struct was generated from the following file: