From 567ffacaae319e158bac8b66a78c498f323f08da Mon Sep 17 00:00:00 2001 From: Joe DiPrima Date: Thu, 13 Aug 2026 19:54:24 -0500 Subject: [PATCH] cadence census item 5: ring registry productionized -- the 16-slot bench-era fixed registry becomes the heat.cpp #119 static-map pattern (unbounded, per-instance, no layout growth). The old registry's silent overflow would have reverted a 17th mech to render-cadence |a| sampling with zero receipts -- exactly the failure class gotcha 32 exists to kill. Smoke bench (identical rig to the sway run): instab median 0.130 vs 0.109, |a| p90 13.8 vs 14.5 -- the same 28Hz signature within run-to-run noise, nowhere near the render-cadence control (16.8/48). Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_016bw71WVsccjwW7uKRg4aWD --- game/reconstructed/mech4.cpp | 39 +++++++++++++----------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/game/reconstructed/mech4.cpp b/game/reconstructed/mech4.cpp index f890a58..c484fe2 100644 --- a/game/reconstructed/mech4.cpp +++ b/game/reconstructed/mech4.cpp @@ -159,6 +159,7 @@ #include // MP match forensics (DEATH/PROJ/SPLASH/RAM event lines) #include "btinput.hpp" // the CONTROLS.MAP + XInput binding engine #include // [aud-tail] strchr -- BT_FIRE_PULSE "on,off" parse (Gitea #5, instrumentation only) +#include // the ring 28Hz dt-accumulator registry (heat.cpp #119 pattern, census item 5) #if !defined(PLAYER_HPP) # include // Player::VehicleDeadMessage -- the death->respawn notification (task #52) #endif @@ -8813,32 +8814,20 @@ void } if (s_ringHz > 0.0f) { - // per-instance dt accumulator (tiny fixed registry -- bench - // scaffolding; a solo bench has one mech, MP a handful) - static const void *s_raKey[16]; - static Scalar s_raAcc[16]; - int slot = -1, freeSlot = -1; - for (int k = 0; k < 16; ++k) + // per-instance dt accumulator -- the heat.cpp #119 static-map + // pattern (unbounded, keyed per instance, no layout growth). + // Replaces the bench-era 16-slot fixed registry, whose silent + // overflow would have reverted a 17th mech to render-cadence + // sampling (cadence census item 5, night17). + static std::map s_ringClock; + Scalar &acc = s_ringClock[this]; + acc += dt; + if (acc < 1.0f / s_ringHz) + ringPush = 0; + else { - if (s_raKey[k] == (const void *)this) { slot = k; break; } - if (s_raKey[k] == 0 && freeSlot < 0) freeSlot = k; - } - if (slot < 0 && freeSlot >= 0) - { - slot = freeSlot; - s_raKey[slot] = (const void *)this; - s_raAcc[slot] = 0.0f; - } - if (slot >= 0) - { - s_raAcc[slot] += dt; - if (s_raAcc[slot] < 1.0f / s_ringHz) - ringPush = 0; - else - { - ringDt = s_raAcc[slot]; - s_raAcc[slot] = 0.0f; - } + ringDt = acc; + acc = 0.0f; } } }