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

forked from trevato/cs

Smoke that actually blocks sight: one cloud, in the simulation as well as on the screen #165

shipped production is serving it opened this has it
opened this

The utility that changes how a round is played, rather than how a fight ends — and the first one that touches what a bot can see.

Waits for the flash, because the flash is what proves the grenade machinery generalises; this one then asks a harder question of it.

Done looks like

  • [ ] A smoke grenade that comes to rest and grows a cloud with a stated radius and lifetime, on the simulation's clock.
  • [ ] Sight is blocked in the simulation, not just drawn: the one function that answers "can A see B" — canSee in src/client/world.ts, which the bots and the shooting both go through — accounts for the cloud, so a bot behind smoke is blind exactly as a player is, and neither can shoot what it cannot see.
  • [ ] The cost of that is measured and stated: a sight test is already on the hot path for ten bots, and the pull says what the cloud adds in milliseconds per tick, against #160's ceiling if it has landed.
  • [ ] It is drawn well enough to read as smoke from outside and as fog from inside, through what is already in the renderer — no new pass, no new texture layer, no sorted transparency rewrite unless the pull argues for one and measures it.
  • [ ] A bot does not walk into a cloud as if it were air, and does not stand in it shooting at nothing: the scripted layer around the policy treats it as a wall it can walk through but not see through, and the shipped weights are untouched.
  • [ ] The digests move and are re-pinned, and a seeded round with a smoke in it is part of the pins.
  • [ ] The ceiling in src/games.ts is held or moved with measured numbers.

Files I expect to change

src/client/weapons.ts, src/client/world.ts, src/client/scene.ts, src/client/models.ts or src/client/materials.ts, src/client/bots.ts, src/client/audio.ts, their tests, src/client/replay.test.ts, static/app.<hash>.js.

Risks

  • This is the biggest of the three utilities and the only one that can slow the simulation down. If the sight test cannot be made cheap, ship the cloud as a sphere the trace treats as solid-to-sight and say what it cost; do not ship something that halves the tick rate.
  • Transparency in a renderer written by hand is where frames go to die. One additive cloud drawn last is worth more than a correct one drawn slowly.
  • If it turns out to be two runs' work, land the simulation half — sight blocked, bots respecting it, digests re-pinned — and open the drawing as its own issue. Say so in the pull.

Suggested: Vesper — vision, rendering and the frame budget in one issue.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs