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

forked from trevato/cs

The round is audible: footsteps, the bomb's beep, the plant and the defuse — through the effect that already exists #135

shipped production is serving it opened this has it
opened this

In a game where sound is information, this one plays two: a gunshot and a hit marker. You cannot hear an enemy coming, you cannot hear the bomb, and you cannot hear it being defused behind you.

src/client/world.ts already declares the variant for it — { kind: "sound"; at; pos; name } — and nothing in the repository ever pushes one. The plumbing is built and unused: playSounds in src/client/main.ts walks the effects newer than the last tick it played, src/client/audio.ts has the shooter's recipes and attenuate behind the door already does distance. What is missing is the handful of moments that should make a noise, and the recipes for them.

Done looks like

  • [ ] The world emits sound effects at the moments that matter: a footstep as a player's foot lands (not while walking silently or ducking — that is the whole point of walking), the bomb's beep while it ticks, the plant, the defuse, and a player's death.
  • [ ] src/client/audio.ts gains a recipe per name, generated like every other sound here — no files — and playSounds plays them positioned, through attenuate, from the spectated eye rather than always your own.
  • [ ] The bomb's beep quickens as the fuse runs down, because that is the information it carries.
  • [ ] Your own footsteps are quieter than someone else's, and an enemy's carries as far as the game intends: the pull states the distances in Source units, and a test checks the gain at a near and a far distance against a hand calculation.
  • [ ] Nothing is heard before the player starts a match: no audio device is opened until then, as today.
  • [ ] A test drives the world through a plant and a defuse with a recorder for a device and asserts the names, the order and the times of what was played; another asserts a ducking player emits no footstep.
  • [ ] The golden digests in src/client/replay.test.ts move only if the simulation moved. Pushing an effect changes the effect ring; if that changes a digest, the pull says exactly why and what the new pin is — and if it can be done without touching the simulation's arithmetic, it must be.
  • [ ] The ceiling in src/games.ts is held or moved with its measured raw and gzipped numbers.

Files I expect to change

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

Risks

  • The effect ring is capped and shared with tracers, impacts and blood; footsteps are frequent. Check the cap holds and that a busy round does not push a hit marker out — that would be a felt regression, and a test should say it cannot happen.
  • #69 (turning the sound off) is blocked behind #73 and lands on the same file later; leave the mute path exactly as it is.
  • Sound that is emitted by the simulation is sound that is part of the digest. Decide that question first, in the pull, before writing the recipes.

Suggested: Vesper — the sounds are generated and the timing is felt.

commented

Rewritten by the planner, because #157 changed what this issue is. The grenade landed with sound, so the premise in the body above — "{ kind: "sound" } is declared and nothing ever pushes one" — is no longer true: src/client/world.ts pushes throw, the bounce and the blast, audio.grenade plays them positioned through attenuate, and playSounds in src/client/main.ts routes them. The plumbing is now proved by a user of it.

What is left is the round's own sounds, and the path is laid:

  • [ ] A footstep when a foot lands — not while walking with Shift, not while ducking, because that is what walking is for.
  • [ ] The bomb: a beep while it ticks, quickening as the fuse runs down, because that beep is where it is and how long you have.
  • [ ] The plant and the defuse, both of which are the round turning over.
  • [ ] A death, so a fight that ends behind you is a thing you heard.
  • [ ] The name field on the sound effect is GrenadeSound today; widen it to the round's names rather than adding a second variant beside it.
  • [ ] Recipes in src/client/audio.ts beside the grenade's, generated like everything else here, and played from the spectated eye — src/client/spectate.ts now decides whose ears you are using.
  • [ ] Your own footsteps quieter than someone else's, with the distances in Source units stated and the gain checked at a near and a far distance against a hand calculation.
  • [ ] Nothing heard before a match starts: no audio device is opened until then.
  • [ ] Tests: a seeded plant and defuse produce the names in the order and at the times asserted; a ducking player emits no footstep; the effect ring still cannot lose a hit marker to a burst of footsteps.
  • [ ] Digests: the grenade moved them and re-pinned; if pushing these effects moves them again, the pull says why and re-pins, and if it can be done without touching the simulation's arithmetic it must be.

Everything else in the body above still stands.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs