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

A bomb you can hear: a beep that quickens, a plant, a defuse, an explosion and the click of an empty gun #57

Merged opened this

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

Merged

Pushed.

Notes

shipped merged

opened this

Pushed.

A new src/client/cues.ts owns the bomb's beep as pure arithmetic: beepInterval/beepPitch over seconds left on the fuse (~1s apart just after the plant, quickening to a few a second and rising in pitch as it nears zero), and stepBeep — an accumulator in the same shape footsteps already uses for distance — that's bounded for any dt. world.ts steps it once a tick from update() (not once per player, since the bomb has one voice, not ten), pushing { kind: "sound", name: "beep", pos: bomb.pos } while planted. Four one-shot sounds join it: plant and defuse where those complete, explode on bomb_timeout, and empty when shoot refuses an empty magazine — latched per press (a new emptyThisPress field, reset like firedThisPress) so holding the trigger doesn't spam it.

audio.ts grows one generic world(name, at, listener, yaw, pitch?) player for these five sounds — each with its own timbre, panned and attenuated through ears like shot and step already are — with beep's pitch computed by main.ts from cues.beepPitch(match.timer) at playback time. The existing beep(pitch) (the buy click) is untouched. feelEffects now routes every sound effect by name; only step keeps a hard earshot cutoff — a bomb beep and an explosion carry across the whole map, as the issue asked.

Tests: cues.test.ts covers the cadence math directly (first beep timing, monotonic intervals, no beep when nothing's planted, bounded rate under tiny dt); world.test.ts gained three: beeps stop on defuse, exactly one explode on detonation, and exactly one empty across ten ticks of a held, empty trigger. bun test is green (227 tests), and bun run scripts/train.ts --bench shows no regression (~10-12k steps/s both before and after — run-to-run noise dominates any real cost). Left out: music/voices/radio, an on-screen beep indicator, and the bomb's damage falloff — all explicitly out of scope per the issue.

Closes #44

commented

Review submitted on pull #57 as changes_requested, anchored to src/client/world.ts:627.

What I found, in the order I gave it:

  1. Blocks landing: the branch is based on bec9bbb and conflicts with main in both files it touches (src/client/main.ts, src/client/world.ts) — #47 landed audio.bounce/audio.blast and its own name chain since. Resolving it should pick one dispatch: blast and world("explode") are near-duplicate synth code.
  2. Wrong clock for the pitch: stepBeep returns the pitch and world.ts discards it; main.ts recomputes it from match.timer, which is phase-seconds, not fuse-seconds, so the last beep of a round and multi-tick frames play at the wrong pitch.
  3. Test gap: plant and defuse sounds have no assertion — deleting either push leaves the suite green — and beepPitch is untested.
  4. README overstates the earshot: EARSHOT holds only step, so plant, defuse and empty also carry map-wide.
  5. Small: REFERENCE = 40 restates rules.bombTime; world(name: string) no-ops silently on a typo.

Verified rather than assumed: bun test is 227 pass at the head commit, the app boots and serves / in ~2 ms with the security floor intact, and a headless 45-second planted round gives beeps at 0.969s → 0.203s with pitch 517 → 1199 Hz and exactly one explode. The preview URL returns not found, as do the production and pull-less hosts, so that is the deploy and not this branch. No code written, nothing pushed, clone unchanged.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs