From 59460111fd1eb4f326358c95d394223dd7bca4b0 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Wed, 21 Oct 2026 20:50:40 -0400 Subject: [PATCH] chore(minigames): log Bomperator transport kind and raw ping samples in debug stats The rtt fields in __bompDbg.stats() are the smoothed EMA (seeded at 100ms, one WS sample per 2s), so short playtests read as 35ms+ even on a 5ms path. Record every raw RTT sample and the active transport (logged on mount, not only on fallback) so the next playtest shows the real numbers. --- .../minigames/bomperator/BomperatorGame.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/components/frontend/minigames/bomperator/BomperatorGame.tsx b/src/components/frontend/minigames/bomperator/BomperatorGame.tsx index 1b9d771d..4402dc5e 100644 --- a/src/components/frontend/minigames/bomperator/BomperatorGame.tsx +++ b/src/components/frontend/minigames/bomperator/BomperatorGame.tsx @@ -57,6 +57,10 @@ const BOMP_DEBUG = } })(); +/** Raw transport readings for the debug stats: every RTT sample as measured + * (not the smoothed EMA the rows carry) and the transport actually in use. */ +const dbgTransport: { pings: number[]; kind: string } = { pings: [], kind: "unknown" }; + interface DbgRow { /** ms since page epoch (performance.now at record). */ t: number; @@ -511,6 +515,11 @@ export function BomperatorGame({ ghostRows: r.filter((x) => x.gh > 0).length, rttMin: r.length ? Math.min(...r.map((x) => x.r)) : 0, rttMax: r.length ? Math.max(...r.map((x) => x.r)) : 0, + transport: dbgTransport.kind, + pingN: dbgTransport.pings.length, + pingP50: pct(dbgTransport.pings, 0.5), + pingP95: pct(dbgTransport.pings, 0.95), + pingMax: dbgTransport.pings.length ? Math.max(...dbgTransport.pings) : 0, }; console.table(out); return out; @@ -576,13 +585,22 @@ export function BomperatorGame({ () => transport.onRttSample((ms) => { rttAvgRef.current = rttAvgRef.current * 0.8 + ms * 0.2; + if (BOMP_DEBUG) { + dbgTransport.pings.push(Math.round(ms)); + if (dbgTransport.pings.length > 1000) dbgTransport.pings.shift(); + } }), [transport], ); useEffect(() => { if (!BOMP_DEBUG) return undefined; - const off = transport.onKindChange?.((k) => console.info(`[bompDbg] transport kind -> ${k}`)); + dbgTransport.kind = transport.kind; + console.info(`[bompDbg] transport kind = ${transport.kind}`); + const off = transport.onKindChange?.((k) => { + dbgTransport.kind = k; + console.info(`[bompDbg] transport kind -> ${k}`); + }); return () => off?.(); }, [transport]);