From 6be908c90036b076234e013a6d7cf2b0c49ff3ca Mon Sep 17 00:00:00 2001 From: "prompt.ac/@jeffrey" Date: Wed, 29 Apr 2026 19:30:21 -0700 Subject: [PATCH] arena: log first snap + others-roster changes (mp-debug) Browser console will print one line on the first snap arrival showing the wire roster, then a line every time the local `others` map gains or loses a handle. Lets us correlate client-side visibility against server-side join/leave + 5s rate dumps to pin down the mutual-vis bug. Drop once mutual visibility is solid. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../public/aesthetic.computer/disks/arena.mjs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/system/public/aesthetic.computer/disks/arena.mjs b/system/public/aesthetic.computer/disks/arena.mjs index 24618f5e20..e2eb575e0a 100644 --- a/system/public/aesthetic.computer/disks/arena.mjs +++ b/system/public/aesthetic.computer/disks/arena.mjs @@ -202,6 +202,24 @@ function flushCmds() { netStats.lastCmdMs = Date.now(); } +// 🐛 mp-debug — log first snap + roster changes so we can see what's +// actually arriving on the wire. Drop once mutual-visibility is solid. +let _mpFirstSnap = false; +let _mpLastRoster = ""; +function _mpDebug(snap, blobs) { + if (!_mpFirstSnap) { + _mpFirstSnap = true; + console.log( + `🏟️ first snap: msg=${snap.messageNum} you=${snap.you} delta=${snap.deltaNum} players=[${blobs.map((p) => p.h).join(",")}]`, + ); + } + const roster = Object.keys(others).sort().join(","); + if (roster !== _mpLastRoster) { + _mpLastRoster = roster; + console.log(`🏟️ others roster (me=${myHandle}): [${roster || "—"}]`); + } +} + function onSnap(snap) { netStats.snapsRx++; netStats.lastSnapMs = Date.now(); @@ -292,6 +310,8 @@ function onSnap(snap) { if (snap.serverMs - others[h].lastSeenMs > 2000) delete others[h]; } + _mpDebug(snap, blobs); + // M7: client-side prediction reconciliation. reconcileLocal(); } -- 2.51.2