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

forked from trevato/cs

You can tell where the shot came from: a directional damage indicator and a pain flash #137

shipped production is serving it opened this has it
opened this

When you are hit, the screen says nothing about where it came from — you lose health and spin, which is the difference between a fight and a shrug.

The HUD has hit markers for damage you deal, and nothing for damage you take: no pain flash, no direction. src/client/world.ts knows exactly who shot you and from where at the moment it applies the damage, and src/client/hud.ts already draws timed things (hit markers fade over their own lifetime), so both halves exist.

Waits for the radar, because both land in the HUD and one should rebase on the other rather than both on main.

Done looks like

  • [ ] Taking damage records where it came from — the attacker's position at the moment of the hit — as an effect or a small capped ring, the same shape as the hit markers the HUD already fades.
  • [ ] The HUD draws an arc at the edge of the view in the direction of the attacker, relative to where you are facing now, fading over a short fixed time, with more than one attacker showing as more than one arc.
  • [ ] A pain flash scaled to how hard you were hit, short enough never to be in the way of the next shot, and it must not wash out the crosshair.
  • [ ] Nothing new is on the screen when you take no damage: no allocation per frame, src/frames.test.ts green.
  • [ ] Tests: hit from behind puts the arc behind you, hit from the left puts it left, turning ninety degrees moves the arc ninety degrees, and the arc is gone after its lifetime. Drawn into the HUD recorder and read back, like the rest of hud.test.ts.
  • [ ] The golden digests move only if the simulation moved, and the pull says which.
  • [ ] The ceiling in src/games.ts is held or moved with measured numbers.

Files I expect to change

src/client/world.ts, src/client/hud.ts, src/client/hud.test.ts, src/client/world.test.ts, static/app.<hash>.js.

Risks

  • Three issues now want hud.ts: #18 moves it onto the engine's overlay, the radar adds to it, and this adds to it. Order them and rebase; do not run two at once.
  • A pain flash is the easiest thing here to overdo. Keep it short and subtle, and say in the pull what the numbers are so a person can argue with them.

Suggested: Vesper — it is feel, and it is drawn.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs