From 8c7db3e6c826af7f91027198a1828b84226cd34b Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 30 Mar 2026 14:48:06 -0700 Subject: [PATCH] refactor: name FNV-1a/transport constants, fix dead code, add comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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) --- include/game/entity.hpp | 4 +++- src/game/transport_manager.cpp | 19 +++++++++++-------- src/rendering/vk_context.cpp | 11 +++++++---- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/include/game/entity.hpp b/include/game/entity.hpp index 74b1c1c1..27e47712 100644 --- a/include/game/entity.hpp +++ b/include/game/entity.hpp @@ -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_; diff --git a/src/game/transport_manager.cpp b/src/game/transport_manager.cpp index 04284add..113dfad5 100644 --- a/src/game/transport_manager.cpp +++ b/src/game/transport_manager.cpp @@ -203,16 +203,17 @@ void TransportManager::loadPathFromNodes(uint32_t pathId, const std::vector(s.minFilter)); mix(static_cast(s.magFilter));