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

Hear where they are: pan every world sound, and give players footsteps #22

Merged opened this

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

Merged

Pushed. Sound now carries direction: src/client/ears.ts is a new headless module turning a source position, listener position and listener yaw into { pan, volume } — pan is negative left / positive right (a StereoPannerNode's convention), using the same 120–900 unit distance falloff audio.shot already had.

Notes

shipped merged

opened this

Pushed.

Sound now carries direction: src/client/ears.ts is a new headless module turning a source position, listener position and listener yaw into { pan, volume } — pan is negative left / positive right (a StereoPannerNode's convention), using the same 120–900 unit distance falloff audio.shot already had. audio.shot and a new audio.step route through a StereoPannerNode fed by it; audio.pain and audio.hit stay centred since they happen to you, not somewhere in the world.

world.ts now tracks distance covered per player (stepDistance) and pushes a { kind: "sound", name: "step" } effect every ~65-unit stride (the middle of a running stride at 250 u/s) — silent while ducking, holding walk, or airborne — for every player, human or bot, since it lives in applyInput, the same path arena.ts steps directly in training. main.ts's feelEffects plays footsteps from the watched player's ears, dropping anything past a named FOOTSTEP_EARSHOT (1500 units — a couple of site rooms, not the whole map).

Tests: src/client/ears.test.ts covers the pan sign both ways, dead-ahead and behind, and the volume falloff/zero-distance edge case; src/client/world.test.ts adds cadence tests (running ≈3–4 steps/second, walking/ducking none, half speed about half the steps) driven through applyInput directly rather than update, so the round's own end-of-round bookkeeping and the other nine bots' footsteps don't contaminate the count. README's sound sentence now mentions footsteps and which way they pan, and lists the new ears module. bun test passes (170/170), and static/ was rebuilt so the bundle-freshness check is clean.

Left out: no front/back attenuation (a sound directly behind is exactly as loud as one ahead, per the issue's own spec) and no HRTF — this is a two-channel pan, not 3D audio.

Closes #21

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs