group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
HitboxHistory Struct Reference

Ring buffer of recent hitbox snapshots for one entity. More...

#include <HitboxHistory.hpp>

Public Attributes

std::array< HitboxHistorySample, k_capacityring {}
std::size_t head = 0
 Index where the next push lands. Wraps modulo k_capacity.
std::size_t count = 0
 Number of samples written so far, capped at k_capacity.

Static Public Attributes

static constexpr std::size_t k_capacity = 64
 Number of past samples retained per entity.

Detailed Description

Ring buffer of recent hitbox snapshots for one entity.

PR-12 bumped capacity from 32 → 64 ticks (~500 ms @ 128 Hz) so the ring covers the new worst-case rewind: RTT/2 (capped 200 ms = 25 ticks)

  • client cl_interp (capped 8 snapshots × 4 ticks/snapshot = 32 ticks @ 32 Hz snapshot rate) = 57 ticks. Rounded up to the next power of two (64) for cheap modulo arithmetic. Still trivial space cost: at ~12 capsules × 64 samples × ~24 B/capsule per entity ≈ 18 KB, ~540 KB total at 30 players.

Member Data Documentation

◆ count

std::size_t HitboxHistory::count = 0

Number of samples written so far, capped at k_capacity.

Used so consumers know which slots are populated before the ring has wrapped around the first time.

◆ head

std::size_t HitboxHistory::head = 0

Index where the next push lands. Wraps modulo k_capacity.

◆ k_capacity

std::size_t HitboxHistory::k_capacity = 64
staticconstexpr

Number of past samples retained per entity.

PR-12: sized so that the highest-allowed compensated lag (k_maxLagCompTicks = 64 ticks ≈ 500 ms @ 128 Hz) fits inside the ring. Power of two for cheap modulo.

◆ ring

std::array<HitboxHistorySample, k_capacity> HitboxHistory::ring {}

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