Radar ping: anchor sweeps to seek start so they stay in sync with the HUD
RunSeekPhase fired the interval ping from an accumulating countdown that discarded each cycle's frame overshoot and drifted seconds late over a match, while the HUD ping countdown is anchored absolutely to _seekStartTime. Fire on absolute interval boundaries (n*interval from _seekStartTime) instead, sharing the HUD's anchor so the on-screen timer hits 0:00 the same moment the sweep fires. A missed boundary is skipped, never bursted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
ee01b3b8ab
commit
1fbd66095c
1 file changed
+9
-4
@@ -704,7 +704,7 @@ public class MatchManager : MonoBehaviour
|
||||
{
|
||||
_skipPhase = false; // drop a stale debug-skip from the previous phase; only this phase may set it
|
||||
float t = seconds;
|
||||
float pingTimer = radarPingInterval; // first sweep one interval into Seek
|
||||
int pingsSent = 0; // sweeps fired so far; boundaries anchored to _seekStartTime (the HUD's ping anchor)
|
||||
while (t > 0f)
|
||||
{
|
||||
if (_pendingHiders.Count == 0) yield break;
|
||||
@@ -712,11 +712,16 @@ public class MatchManager : MonoBehaviour
|
||||
|
||||
if (radarPingInterval > 0f)
|
||||
{
|
||||
pingTimer -= Time.deltaTime;
|
||||
if (pingTimer <= 0f)
|
||||
// Fire on absolute interval boundaries from Seek start (n*interval), sharing the exact anchor the
|
||||
// HUD countdown uses (LocalNextPingIn's modulo) - so the on-screen ping timer hits 0:00 the same
|
||||
// moment the sweep fires. An accumulating countdown would discard each cycle's overshoot and drift
|
||||
// seconds late over a match (worse with frame spikes). A missed boundary (huge hitch) is skipped,
|
||||
// not caught up - one late sweep, never a burst.
|
||||
int due = Mathf.FloorToInt((Time.time - _seekStartTime) / radarPingInterval);
|
||||
if (due > pingsSent)
|
||||
{
|
||||
BroadcastRadarPings();
|
||||
pingTimer = radarPingInterval;
|
||||
pingsSent = due;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user