Skip to content

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 into
claude/mobile-test-setupfrom
claude/webgl-context-crash-dcbaa3
Oct 28, 2026
Merged

ChefControl merged 3 commits into
claude/mobile-test-setupfrom
claude/webgl-context-crash-dcbaa3

Conversation

@ChefControl

@ChefControl ChefControl commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

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:

Fix

  • #glLost dialog (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.
  • Auto goes to Low after a loss (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.
  • Reports list the dialog when it was up.
  • Docs: docs/graphics.md and docs/game.md.

Checked

  • Demo build, phone-sized screen, all four cases: lost for good, lost and given back (the world comes back), refused at start, and dead at start. Each shows the dialog with focus on Reload, and the red box stays hidden.
  • Tests: test/glLost.test.ts (new) plus reload, report, graphics, main and persist: 67 passed. tsc is clean. CI runs the full suite.

No new data or licences, so /legals-update has 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

…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
ChefControl force-pushed the claude/webgl-context-crash-dcbaa3 branch from 3588624 to c3f6922 Compare October 28, 2026 15:00
@ChefControl
ChefControl changed the base branch from main to claude/mobile-test-setup October 28, 2026 15:00
… 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>
@ChefControl ChefControl changed the title A phone that takes the 3D view away gets a dialog with Reload, not a blank world A phone that takes the 3D view away gets a dialog with Reload, and the casino yacht draws lighter Oct 28, 2026
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>
@ChefControl
ChefControl added this pull request to stack #222 October 28, 2026 16:04
@ChefControl
ChefControl merged commit 0874df4 into main Oct 28, 2026
7 checks passed
@ChefControl
ChefControl deleted the claude/webgl-context-crash-dcbaa3 branch October 28, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant