Split The code is public; the app answers only to the crew.

The HUD shows one message at a time, so a bot's callout wipes `Bomb planted` off the screen #183

open told opened this
opened this

Stop a teammate's chatter from overwriting the four messages a round actually turns on, by drawing more than the newest line or by ranking them.

src/client/hud.ts:496 is the whole message line:

const message = world.messages[world.messages.length - 1];
if (message !== undefined && (holding || world.time - message.at < MESSAGE_FADE)) { ... }

One line, the newest, for MESSAGE_FADE = 4 seconds. world.ts's say() keeps a six-message queue and the HUD has always ignored five of them, which was harmless while the only things that spoke were the round start, the plant, half time and the round result — they never collided. Pull #172 changed that: a bot now speaks on contact, with SIDE_GAP set to 4 seconds because that is how long the HUD holds a line. So an enemy seen a half-second after the plant replaces Bomb planted with enemy — mid, and the one message the round turns on that a counter-terrorist must not miss is the one most likely to be stepped on — a firefight is exactly when both happen at once.

Done looks like

  • [ ] A callout can no longer hide a round event. Either the line becomes a short stack (the newest few of the six say() already keeps, oldest fading first) or a round event outranks chatter and holds its place for its own fade. Pick one, say why in the pull, and keep it one rule rather than a special case per message.
  • [ ] Whichever you pick, the round start, the plant, half time and the round result are all still readable when a bot is talking, and a quiet round still shows exactly what it shows today.
  • [ ] It stays inside the HUD's draw-call and text budget: hud.test.ts counts what a frame costs, and a stack of lines must not be a stack of surprises. Say what the budget reads before and after.
  • [ ] Readable on a phone: at 360px the view is small and the middle of the screen is where you are aiming — a stack that grows into the crosshair is worse than the bug. Say what it looks like at that width.
  • [ ] world.ts is untouched unless ranking needs one field on a message; if it does, it is plain data (a kind or a priority) that the simulation never reads back and observe.ts never sees.
  • [ ] Tests that fail without it: a plant followed a tick later by a callout still draws the plant; a callout alone draws the callout; nothing is drawn in a round where nobody has said anything; the six-message cap still bounds what can be on screen.
  • [ ] README: the sentence about the message line says what wins when two things are said at once.

Files I expect to change: src/client/hud.ts, src/client/hud.test.ts, possibly src/client/world.ts and src/client/world.test.ts, README.md.

Waits on #120 and #110, whose pulls are both rewriting parts of hud.ts right now — this is a small change into a file two pulls are holding.

Risks: the temptation is a message log, which is a second HUD element nobody asked for and a phone cannot afford. The fix is one line's worth of policy, not a chat window.

Brief that fits: scout.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs