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
Check · Review · Land · Live done — Landed and live in production.
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.
shipped merged
Sign in to join this conversation.
new above
offline
Pushed.
Sound now carries direction:
src/client/ears.tsis 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 falloffaudio.shotalready had.audio.shotand a newaudio.steproute through aStereoPannerNodefed by it;audio.painandaudio.hitstay centred since they happen to you, not somewhere in the world.world.tsnow 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 inapplyInput, the same patharena.tssteps directly in training.main.ts'sfeelEffectsplays footsteps from the watched player's ears, dropping anything past a namedFOOTSTEP_EARSHOT(1500 units — a couple of site rooms, not the whole map).Tests:
src/client/ears.test.tscovers the pan sign both ways, dead-ahead and behind, and the volume falloff/zero-distance edge case;src/client/world.test.tsadds cadence tests (running ≈3–4 steps/second, walking/ducking none, half speed about half the steps) driven throughapplyInputdirectly rather thanupdate, 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 newearsmodule.bun testpasses (170/170), andstatic/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