|
group2 0.1.0
CSE 125 Group 2
|
Per-tick history of stamped input snapshots, keyed by clientPredictTick. More...
Go to the source code of this file.
Classes | |
| class | InputRingBuffer |
| struct | InputRingBuffer::Entry |
Per-tick history of stamped input snapshots, keyed by clientPredictTick.
Phase 5b uses this to replay inputs during reconciliation. When a server snapshot arrives ack'ing client-tick T, we know the server's authoritative state at tick T. We snap the local player to that state and replay every stored input from tick T+1 up through the current predict tick — feeding each one into runMovement + runCollision — landing on the correct predicted state for the current tick.
Capacity: 256 entries ≈ 2 s of input history at 128 Hz physics. Far more than typical RTT (10–200 ms = 1–26 ticks); the slack absorbs spikes.
Ring writes are O(1); lookup by tick is O(N) but N is bounded at 256 and the access pattern is "find the most recent entry with tick ≥ T", which usually walks just a handful of slots.