Repository navigation
A phone that takes the 3D view away gets a dialog with Reload, and the casino yacht draws lighter - #220
Merged
ChefControl merged 3 commits intoOct 28, 2026
Conversation
…blank world, and Auto goes to Low A player's Android Chrome crashed its graphics process walking to the casino yacht: the world went black, then white behind the HUD, and later loads stopped at the red "Error creating WebGL context" box. The game had no handling for either. - render.ts: if the browser won't make a 3D view, or takes it back and doesn't give it back within 3 s of the game being on screen, a dialog (#glLost, errors.ts) says so, with a Reload button, instead of the red box or a blank world. If it comes back, three.js sends everything up again and the dialog goes. - graphics.ts lowAfterLoss: a loss while the game's on screen puts Auto on Low for good (about half the graphics memory); a player's own pick stays. A loss while the tab is put away (iPhones do it) doesn't count. - report.ts: a report says when the dialog was up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ChefControl
force-pushed
the
claude/webgl-context-crash-dcbaa3
branch
from
October 28, 2026 15:00
3588624 to
c3f6922
Compare
… the yacht Everyone aboard was drawn one by one, six pieces each and as many again for their shadows, because people are marked as always on the move (noBatch) and breathe every frame. On the quay on Low the yacht took 191 of the frame's 307 draw calls. Person.standStill() drops both for the croupier, the blackjack dealer, the bartenders and the guests (at the bar, the slots, by the tables and in the hot tub), so batch.ts merges them while they hold still; an arm that moves (a lever, a sip, a shake) drops out while it does. The waiter, who walks, is left as he was. The breathing (1.2% of the body's height) can't be seen from the game's camera. At the quay: 307 -> 222 draw calls on Low, 324 -> 250 on High. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bulbs round the CASINO signs and along the strings to the mast were 252-triangle spheres, about 28k triangles, 40% of the yacht. They're flat colours a few pixels across, so the kit's small ball (56 triangles) draws the same dot. Shared geometry: nothing new is made, so the game's luck is untouched. At the quay: about 19k fewer triangles on Low, 12k on High. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A player reported a crash "after buying casino on Mobile" (Android Chrome). In her video the world goes black, then white behind the HUD, as she walks along the dock to the yacht. Later loads stop at the red box "Something broke: THREE.WebGLRenderer: Error creating WebGL context."
Cause
Her phone's graphics process crashed. After that, Chrome takes the 3D view (the WebGL context) away from the page, and can refuse to make another for the site until Chrome restarts. The game had no handling for either case, so it showed a blank world or the red box.
I couldn't recreate the crash itself without an Android phone. What I checked:
WEBGL_lose_context) gives the HUD over a blank world.Fix
#glLostdialog (errors.ts, index.html): if the 3D view can't start, or is lost and not back 3 s after the game is on screen, a dialog says so with a Reload button. "Restart your browser to bring back the 3D" covers the start case; "The 3D view stopped. Your game is saved." covers the loss. It covers the red box. If the view comes back, three.js re-uploads everything, the dialog goes and the game carries on. The dialog uses the same look as the "open in another tab" dialog (#stale); there are no new tokens or components.lowAfterLoss, graphics.ts): only for a loss while the game is on screen, and Low needs about half the memory. A High or Low the player picked stays. A loss while the tab is in the background (iPhones do this) doesn't count.Checked
test/glLost.test.ts(new) plus reload, report, graphics, main and persist: 67 passed.tscis clean. CI runs the full suite.No new data or licences, so
/legals-updatehas nothing to check.A lighter yacht
The yacht is the heaviest thing on stage 1's screen: on the quay on Low it took 191 of the frame's 307 draw calls. Every person aboard was drawn one by one, in 6 pieces plus 6 shadow copies each, because people are marked "always on the move" and breathe every frame.
Person.standStill()(characters.ts) drops both for those who stay put: the croupier, the dealer, the bartenders, and the guests at the bar, the slots, by the tables and in the hot tub. batch.ts then merges them while they hold still, and an arm that moves drops out while it does. The waiter walks, so he stays as he was. Before-and-after screenshots on Low and High, from the quay and inside the salon, look the same: the breathing is 1.2% of a person's height.Quay, Low: 307 → 222 draw calls. Quay, High: 324 → 250.
Tests: a new test in
test/casino.test.ts; casino, core, eyecandy (luck), graphics, people, sound, uiKit and glLost all pass (148 tests).Bulbs: the bulbs round the CASINO signs and along the light strings use the kit's small ball (56 triangles) instead of a 252-triangle sphere. They're flat colours a few pixels across, so they look the same. That's about 19k fewer triangles at the quay on Low and 12k on High. The sign looks the same in close-up screenshots before and after.
🤖 Generated with Claude Code