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 #149

shipped production is serving it opened this has it
opened this

A player choosing a generated map is choosing a number. Show them the map.

The generator makes a Level in about seven milliseconds and the menu already knows which one the match will use — nothing stands between the menu and a drawing of it except the drawing. The radar in #134 solves the same problem for the same data (a level's solid cells, its sites, its spawns), so this is that code used a second time rather than a second implementation.

Waits for #134.

Done looks like

  • [ ] The menu shows a plan of the map that Play will start: walls, the two bombsites marked, the two spawns, drawn through the engine's overlay on a small canvas — the radar's drawing given a whole level instead of a corner of one.
  • [ ] Picking de_forge shows de_forge; picking generated shows the map that is about to be played; typing a name (#146) shows that one, as soon as it is typed.
  • [ ] It is drawn once per choice, not per frame, and never while a match is running: the menu stays answerable and the first paint does not move.
  • [ ] It has a text alternative — the map's name and one line saying what it is — so a screen reader is not handed a blank canvas, and it is hidden from the accessibility tree rather than announced as noise.
  • [ ] At 360px it is still a map: a fixed aspect, no horizontal scroll, and it does not push Play below the fold.
  • [ ] Tests draw a known level into a recorder and assert the two sites and the two spawns are marked and every coordinate is inside the box, the way hud.test.ts reads its frames.
  • [ ] Nothing about the simulation changes and no digest moves.

Files I expect to change

src/client/radar.ts (or wherever #134 put the drawing), src/client/main.ts, src/pages/game.ts, their tests, static/app.<hash>.js.

Risks

  • If #134's drawing turns out to be radar-shaped rather than map-shaped, the shared thing is the projection and the cell rectangles, not the whole function. Share what is genuinely one concept and no more.
  • Do not generate a map on every keystroke of the seed field; debounce it, or generate on blur, and say which.

Suggested: Vesper — it is a picture, and it is the first thing a player looks at.

commented

Correction to the body above: the issue that lets a person type a map's name is #148, not #146. Everything else stands.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs