From e26e931040f0e4b9f1c6146c22989c38b9d8ec8a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 10:21:59 +0000 Subject: [PATCH] Account save: stop pausing with "signed in as someone else" in the phone frame - party.js: in the home page's phone frame, use the home page's SiteAccount (wait for its boot(), guess names from it) and name the frame's Firebase app like the home page's account app, so both share one saved sign-in and the frame follows a Google sign-in made on the home page. - account-nudge.js: when Party's uid differs from the Google uid, show "Connecting your account save..." and re-sync as soon as Party's auth becomes that account (and once more after 15 s, then say it's paused). The uid check stays, so nothing is ever written to another account's node. - README and a What's new fix entry. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Cw2rM74nXSN426CQRHrrjU --- README.md | 2 +- e63334287a3deaa3/account-nudge.js | 45 ++++++++++++++++----- e63334287a3deaa3/news/account-save-fix.json | 17 ++++++++ e63334287a3deaa3/party.js | 28 +++++++++++-- 4 files changed, 76 insertions(+), 16 deletions(-) create mode 100644 e63334287a3deaa3/news/account-save-fix.json diff --git a/README.md b/README.md index 545818dc..04785aed 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ Personal site hosted with GitHub Pages at **https://ascoding11.github.io**, the - `e63334287a3deaa3/netrelay.js`, `colyseus.js` and `netrelay-config.js`: the game relay. Online rooms of the games listed in `netrelay-config.js` (`RELAY_PREFIXES`, and Rumble Karts, whose rooms have no prefix) go through our own Colyseus server instead of the Firebase Realtime Database: the code is in the separate `ASCoding11/game-server` repo, hosted on Colyseus Cloud (US East, Newark) at the address in `netrelay-config.js`, and redeployed by every push to that repo's `main`. `netrelay.js` (copied from that repo's `client/`) wraps `firebase.database()` and looks like it, so a game only changes the line that makes its database: `NetRelay.database(firebase.database(), window.RELAY_ROOMS)`. **On the relay (20 Nov 2026):** the real-time games: Coil, Slipstream, Boostball, Kartwheel, Rumble Karts, Shell Crackers, Backrooms 1v1, Driftfall, Blockstorm, Sky Duel, Hail Mary, Updraft, Spire, Tumble Trials, Turbo Trail, Escapade, Chromaflage, Hush Pools, Putterby, Lokop and Lanternhold (Coil first, the rest the same evening). **Still on Firebase:** the turn-based and word games (Showdown, Deepword, Odd One Out, Puffer Party), Quarry (its worlds stay in the room for days), Rampline (boards and community tracks), and the shared nodes `sc-ratings`, `br-queue` and `hm-queue` (`KEEP_ON_FIREBASE`), which hold ratings and matchmaking across rooms. Only that game's `rooms/-` go to the relay; leaderboards, ratings, parties and the lobby stay on Firebase. Players still sign in with Firebase, and the relay checks their sign-in token. Relay rooms live in the server's memory, so they last while someone is in them and 2 minutes after; games that keep data in their room for days (Quarry's worlds) must stay on Firebase. `colyseus.js` is the Colyseus browser library (MIT). **Off switch:** blank the `url` in `netrelay-config.js` and every game goes back to Firebase at once. **One game back to Firebase:** take its prefix out of `RELAY_PREFIXES` (for Rumble Karts, set `RELAY_RUMBLE_KARTS` to false). **Moving another game over:** load the three files before its script, change its database line, add its prefix to `RELAY_PREFIXES` (`playingnow.js` reads `RELAY_ROOMS` too, so it counts players in relay rooms), and test with two browser windows in the same room. - `e63334287a3deaa3/netsmooth.js`: smooth movement for other players in the online games. Updates over school Wi-Fi and Firebase arrive late and in bursts, so a game that moves someone to their newest update makes them lurch and stall, and one that shows them a fixed time in the past freezes them whenever an update is later than that. Each remote player gets a `NetSmooth.lag()`, which measures how late their updates really arrive and shows them just far enough in the past that the next one is almost always already here (about a tenth of a second on good Wi-Fi, more on bad, never more than 0.45 s), easing that delay so the timeline never jumps; `NetSmooth.sample()` draws them between the two updates around that moment and carries them on for up to 0.3 s if an update is late. Used by Shell Crackers, Backrooms 1v1–4v4, Hail Mary, Coil, Quarry, Chromaflage, Odd One Out, Spire, Turbo Trail, Escapade, Updraft, Driftfall, Blockstorm, Lanternhold (teammates' pointers), Sky Duel and Putterby. Kartwheel, Slipstream, Boostball, Rumble Karts and Tumble Trials keep their own approach: cars, karts and racers are projected forward to the present from their speed, which matters more there than perfectly even motion. Settings were tuned with a simulation of good, school and bad Wi-Fi: compared with chasing the newest update, other players stall about a fifth as often and almost never lurch, for roughly a tenth of a second more delay. - `e63334287a3deaa3/autores.js`: automatic resolution for the 3D games, so they stay smooth on school laptops. Every three.js game except Quarry (which has its own version) loads it right after `three.min.js`. It watches the frame rate, and when frames drop below about 45 a second it makes every three.js renderer on the page draw at a lower resolution, a tenth at a time, down to half; when frames stay smooth it steps back up (more slowly towards a resolution that was too slow before, so it doesn't keep flipping). It multiplies whatever `setPixelRatio` the game asks for, so a game's own graphics setting still counts. The scale each game settles on is remembered in the browser (`localStorage` key `autores:`), so the next visit starts there. No game code calls it; it wraps `THREE.WebGLRenderer`. `AutoRes.scale` shows the current scale and `AutoRes.off()` turns it off for a visit. -- `e63334287a3deaa3/account-nudge.js`: the sign-in nudge and account save (Back Room). Loaded on the Back Room page and the phone page (one `