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

forked from trevato/cs

A radar in the corner: the map, your team, the bomb and the sites, drawn through the engine's overlay #134

Closed opened this
opened this

A defusal shooter with no radar is a game you play by memory — you cannot see where your team is, which site the round has gone to, or where the bomb is lying.

The HUD draws ten things today (crosshair, hit markers, clock and score, health, armour and money, ammo, who is left, kill feed, the round's message, planting and defusing, the scoreboard) and none of them is the map. Everything a radar needs is already here and already general: the level is a value since #95, the grid and its mergeSolid are behind the door, and overlay draws filled rectangles, lines and scaled text. This is the biggest single thing a player is missing, and it costs the game nothing it does not already have.

Done looks like

  • [ ] A radar in one corner of the HUD, drawn through the engine's overlay and nothing else: the level's solid cells as the shape of the map, the two sites marked, you at the centre or in place, your living teammates as dots, and the bomb — carried, dropped or planted — as its own mark.
  • [ ] It is oriented the way a player expects and the pull says which it chose: rotating with your yaw, or fixed north-up with a heading tick. One choice, stated, with the reason.
  • [ ] Enemies appear only when the game already tells you about them — nothing on the radar is information the player does not otherwise have. The pull states the rule it applied.
  • [ ] The shape of the map is computed once, not per frame: the level's solid cells are merged into a list of rectangles at boot (the engine's mergeSolid already does this) and the frame only transforms and draws them. No allocation in a frame — src/frames.test.ts is the promise and it must stay green.
  • [ ] It scales: at 360px wide it is still legible and does not cover the crosshair or the ammo; on a phone it does not sit under the touch pads.
  • [ ] Tests draw a frame into the HUD recorder (src/client/stage.test-helper.ts) and assert what a reader can check: the bomb's mark appears when the bomb is planted and not before, a dead teammate's dot is gone, a teammate's dot moves when they do, and every coordinate drawn is inside the radar's box.
  • [ ] The golden digests in src/client/replay.test.ts are unchanged — the radar reads the world and never touches it — and the app's ceiling in src/games.ts is held or moved with its measured numbers in the pull.

Files I expect to change

src/client/hud.ts (or a new src/client/radar.ts if it earns its own module — it probably does), src/client/hud.test.ts, src/client/main.ts for what is computed at boot, static/app.<hash>.js.

Risks

  • hud.ts is #18's file. If #18 (the overlay behind the door) is in flight when this starts, take main first and let the other rebase; do not do both at once.
  • The temptation is a second projection written by hand. Use the engine's maths and the level's own cell-to-world arithmetic (worldOf, cellAt) so the radar cannot drift from the map it draws.
  • Keep it one concept: this issue is the radar, not a full-screen map, not a ping system.

Suggested: Vesper — canvas, a projection and a phone.

commented

Delivered by #179 — "mini map. especially on procedural maps i need to know where im going" — which landed src/client/minimap.ts with its own tests, a palette module and the HUD drawing it. That is this issue's checklist: the level's cells, the sites, your team, the bomb, drawn through the engine's overlay and computed once rather than per frame.

Closing it so nothing waits on an issue whose work is on main. #137 (a directional damage indicator) and #149 (a plan of the map on the menu) were both queued behind this one and are ready now — and #149 in particular should read minimap.ts first: the drawing it needs already exists and wants a whole level instead of a corner of one.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs