Public: anyone can read this; the crew can change it.

forked from trevato/cs

See the map before you play it: a plan of the layout on the menu, drawn from the level itself #218

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The menu now shows a plan of the map **Play** would start: the rooms, the two bombsites lettered A and B, and the two spawns in the sides' own colours, on a small canvas beside the map's name. It is the radar's drawing used a second time, not a second drawing — `drawPlan` comes out of `src/client/minimap.ts` (the projection, the merged floor rectangles, the sites and their letters, which is the ha…

shipped production is serving it deploy ae07c2d

opened this

The menu now shows a plan of the map Play would start: the rooms, the two bombsites lettered A and B, and the two spawns in the sides' own colours, on a small canvas beside the map's name. It is the radar's drawing used a second time, not a second drawing — drawPlan comes out of src/client/minimap.ts (the projection, the merged floor rectangles, the sites and their letters, which is the half of the radar that is about a level rather than a round) and hands back the projection it used, so the radar puts its dots and src/client/preview.ts puts the spawns exactly where it put the rooms. Picking de_forge shows de_forge, picking generated shows the map this match's id carves — the same id the line above already named, so no second id is drawn — and typing a name shows that exact layout.

It is drawn once per choice, never per frame and never while a match is running. Rather than carve a level on every keystroke, a choice has to stand still for 200 ms on the frame clock before anything is generated (PLAN_WAIT in src/client/main.ts); a debounce and not a blur handler, because the choice is three controls and a person moves between them. Measured here: generateLevel 6.3 ms, drawPreview 0.03 ms, so a name typed a character at a time costs one map and not ten. previewText is the text alternative — 40×40 cells · bombsite A north-east, B south-west · spawns south and north, all of it read off the level — and the canvas carries aria-hidden="true". The first paint renders a sentence of about the same length saying the plan arrives when the game has booted, because a server that described a named map would have to carve one per request; #planalt has a two-line min-height so the swap moves nothing.

Worth a look: at 360px the square is 96px and the text column beside it 222px inside the overlay's padding, so the row does not wrap and nothing scrolls sideways — but the menu overlay was already taller than the stage and already scrolled to reach Play before this change, and the plan adds about 60px above it. I could not open a browser from here, so that part is arithmetic off the CSS, not a screenshot. Nothing about the simulation changed and no digest moved; bun test is 966 passing, and the app bundle grew 1,368 raw / 536 gzipped bytes (97,956 / 44,073) against the 100,000 / 45,000 ceiling, which is logged in src/games.ts with the rest.

🤖 Generated with Claude Code

Closes #149

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs