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

Pick the rifle up off the body: a weapon stays in the world when its owner dies #19

shipped merged opened this has it
opened this

Leave the gun on the floor when its owner dies, and let it be picked up, so losing a round is not five minutes of pistol and the economy has the loop CS actually has.

onKill drops the bomb and nothing else (src/client/world.ts:420): an AK-47 its owner paid $2,700 for evaporates. After two lost rounds both sides are on pistols with money they cannot spend until the next freeze, which is the flattest part of a match right now.

Done looks like

  • [ ] World gains a pickups list — position, weapon id, the magazine and reserve it had when its owner died — cleared in startRound and capped so a long round cannot grow it without bound.
  • [ ] On death the victim's current weapon (or their primary, if they died holding a knife — pick one and say which) becomes a pickup at their feet. A knife is never a pickup; the bomb keeps the drop it already has.
  • [ ] One pick-up rule, written down: with no primary, walking within ~48 units takes it automatically; with a primary already, it takes an explicit use (E), and the gun you were holding becomes a pickup where you stand. Bots use the same automatic rule and get no new logic — their paths already take them past bodies.
  • [ ] src/client/world.test.ts: a kill leaves exactly one pickup, with the weapon and the magazine its owner had; a pistol-only player walking over it comes away holding it with that ammo; a knife kill leaves nothing; startRound clears the list; a player who already has a primary does not sweep one up by walking over it.
  • [ ] The next round hands you a working gun: startRound re-arms p.ammo from p.primary/p.secondary, so a picked-up weapon has to be in p.ammo and in the right slot or the round after a pickup starts empty. Test that too.
  • [ ] A gun on the floor is visible — the renderer draws pickups (the existing bombMesh, or a small box in models.ts), and the HUD says E — take AK-47 when you are standing on one you would have to ask for.
  • [ ] bun test passes, including src/rl/*; the README's economy paragraph says weapons drop.

Files I expect to change

src/client/world.ts, src/client/world.test.ts, src/client/renderer.ts, src/client/models.ts, src/client/hud.ts, README.md.

Risks

  • The policy's contract again. observe.ts is 32 fixed numbers. A bot's weapon changing mid-round is already inside the observation (it reads currentWeapon and inaccuracy), so that is free; adding anything about pickups to the vector is not, and would make the shipped weights and the win rate on the page disagree.
  • Pickup logic inside applyInput runs in the RL arena too, which steps applyInput directly at millions of ticks. Keep it a distance test against a short list, and keep the list empty in an arena world (it has no deaths that matter) — check bun test still finishes in a handful of seconds.
  • Money and capMoney are match.ts's business: a pickup is free, and no reward changes here.
  • Team check: in this match there is no friendly fire, and there is no rule that a CT cannot use an AK — do not invent one, but do say in the pull what you decided.

Crew

vesper — it is game state and one more thing to draw, tested headlessly.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs