WebGL map: paint the card's pictures on one canvas, so a long zoom keeps the context

Every sprite kept its own <canvas> once it was in the atlas: a long pan and zoom made
~20,000 of them, then a frame of one to two seconds, then CONTEXT_LOST and a silent
fallback to 2D (4 sweeps out of 5). The card's pictures are now painted on one reused
canvas and sent to the atlas at once (texSubImage2D with a sub-rectangle); a full atlas
restarts and takes the picture at once. The 2D map, and a picture too big for the atlas,
keep a canvas each. The card's and the 2D map's pictures are kept apart, and giving the
card up drops its pictures.
This commit is contained in:
Antoine 2026-11-04 16:37:32 +01:00
parent 39941c257e
commit 2ff634a0ed
No known key found for this signature in database
GPG key ID: 728FF1CE15732B05
4 changed files with 132 additions and 13 deletions

View file

@ -11,6 +11,7 @@ All notable changes to this project are documented here. The project follows
- Puzzles are easier to read, above all on phones: the three stars are now three goals in plain words, and the one you are working on says what is wrong and what to do, with a Show me button. The map marks it too: a red ring around a city that still needs traffic, and a pulsing ✂ on a link whose cut would hurt. On phones the sheet starts small so the map gets the screen; swipe it up for the rest. Cities far from the puzzle are left off the map, and stepping stones you are not using are small dots without a name until you tap one, build there or zoom in.
- The map is now drawn by the graphics card wherever the browser can, so panning, zooming and fast play stay smooth on big networks and big screens. The map looks the same; Settings › Map drawing › Always 2D keeps the old drawing, and browsers without WebGL2 or without a usable graphics card keep it on their own, as does a game whose graphics card fails while you play.
- Cities, labels, building cones, ships, offer bubbles and money pop-ups are painted once and then reused, so the usual map also draws far fewer shapes each frame.
- Long zooms stay on the graphics card: the pictures of cities and labels are painted on one shared canvas instead of each keeping its own, so the browser no longer runs out of room for them and switches to the slower drawing.
## [2.9.1] — 2026-11-04