From a00caff4dbb59faef44d0b4a423058d9caacd368 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 08:38:37 +0530 Subject: [PATCH] Replay clips: free each clip's memory when its panel closes - **Fix: replay clips no longer pile up in memory.** Each finished clip (~10 MB) was kept for as long as the game page stayed open, even after its panel closed, so a long session in Slipstream, Boostball or Driftfall grew by roughly that much per match. Closing the panel (or the next clip replacing it) now stops the preview and frees the clip 10 s later. - Files: `e63334287a3deaa3/replay.js` (a cleanup step in the panel), README. - No What's new entry: players won't notice anything except fewer slowdowns in very long sessions (`no-news`). - Tested: after closing the panel, the clip's data is gone; the clip itself is unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016ZY4GY6KEVGmw5xYZiPbvp --- README.md | 2 +- e63334287a3deaa3/replay.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6fc75a0c..fec23692 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ Personal site hosted with GitHub Pages at **https://ascoding11.github.io**, the - `e63334287a3deaa3/layout.js`: Edit layout (Back Room). Each player can put the page's big blocks in their own order, and choose which games have big cards. It's loaded with one ``) and calls `BackRoomElo.report({ id, won, opp: [{ u: uid, s }, { bot: 1, s }] })` once where its online match or round ends (search each game for `BackRoomElo`): `opp` is everyone you played against, not teammates, and `s` is your result against that one opponent (1 beat them or your team won, 0 lost, 0.5 drew), so team games give every opponent the same `s`, races and free-for-alls go by finishing place, Driftfall counts everyone already out as beaten and everyone still alive as a loss, Tumble Trials rates once per show (when you go out or the final ends), and in Chromaflage a seeker beats each hider that was found while a hider beats the seekers by staying hidden. Hush Pools is co-op, so it has no opponents in that sense: when an online party escapes, each player is compared with each teammate by what they did for the party (`runScore`: 10 a rescue, 4 a valve opened or the keypad solved, minus 6 for each time they went down), and the one with the higher score "beats" the other (equal is a draw). The change is the usual Elo one (K 36 for the first 10 matches, then 24), averaged over the opponents and multiplied by the number of real opponents (×1 for one, 25% more for each extra, at most ×3); bots count as rated 1000, and a match with no real opponent isn't rated, so practice and bot-only rooms never move a rating. Everyone starts at 1000 and stays in 100–3000. `id` stops a match being rated twice (results screens can be drawn more than once). Storage: this browser's `elo:` (`{ r, g, wn, pk, uid }`) and the Realtime Database at `rooms/elo-/players/` (`n, c, x, z, h, ts` as the shared rules need, plus `r, g, wn, pk`), written by the player's own browser; on load the account's saved rating wins, and opponents' ratings are read from their nodes when a match is reported. So, like every Back Room stat, it is self-reported and not cheat-proof. It never signs in or makes a Firebase app itself (it uses the game's), and every call swallows its own errors, so it can't stop a game. After a rated match a small pill at the top shows the new rating and the change. stats.js reads `elo:` into the game's `elo` stat (the list of folders is next to `READ`), and leaderboard.js has an Elo board first for each of these games (for Slipstream, after its lap and record boards); as with Shell Crackers, the board keeps the best value it has seen, so it shows a player's highest rating. To rate another game: add the script tag and one `report` call, add its folder to the list in stats.js, and add the Elo row to its entry in leaderboard.js. -- `e63334287a3deaa3/replay.js`: **replay clips** (Slipstream, Boostball and Driftfall so far). While a match or race is on, it records the game's canvas in the browser (`canvas.captureStream(30)` into a MediaRecorder, restarted every 6 s so each piece is a complete file; only the last 4 pieces are kept). When it ends, the newest pieces adding up to at least 15 s are played back into a 2D canvas (at most 1280 px wide) with a small "ascoding11.com/" watermark and a 2.5 s end card, "Play this game now ▶ ascoding11.com/", and recorded once more into one file (MP4/H.264 where the browser can, else WebM; video only). A panel (bottom-right on computers, near the top on phones) shows progress, then a looping preview with **Share replay** (share sheet with the video), **Save video** and **Copy game link**, and a **Turn off replays** link (localStorage `replay:on` = `'0'`). Nothing is uploaded. **Hooks in each game:** `