refactor: name FNV-1a/transport constants, fix dead code, add comments

- vk_context: name FNV-1a hash constants (kFnv1aOffsetBasis/kFnv1aPrime)
  with why-comment on algorithm choice for sampler cache
- transport_manager: collapse redundant if/else that both set
  looping=false into single unconditional assignment, add why-comment
  explaining the time-closed path design
- transport_manager: hoist duplicate kMinFallbackZOffset constants out
  of separate if-blocks, add why-comment on icebreaker Z clamping
- entity: expand velocity smoothing comment — explain 65/35 EMA ratio
  and its tradeoff (jitter suppression vs direction change lag)
This commit is contained in:
Kelsi 2026-03-30 14:48:06 -07:00
parent a940859e6a
commit 8c7db3e6c8
3 changed files with 21 additions and 13 deletions

View file

@ -93,7 +93,9 @@ public:
float impliedVX = (destX - fromX) / durationSec;
float impliedVY = (destY - fromY) / durationSec;
float impliedVZ = (destZ - fromZ) / durationSec;
// Exponentially smooth velocity so jittery packet timing doesn't snap speed.
// Exponential moving average on velocity — 65% new sample, 35% previous.
// Smooths out jitter from irregular server update intervals (~200-600ms)
// without introducing visible lag on direction changes.
const float alpha = 0.65f;
velX_ = alpha * impliedVX + (1.0f - alpha) * velX_;
velY_ = alpha * impliedVY + (1.0f - alpha) * velY_;