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

A bot reloads only when its magazine is empty, so it reloads in the middle of the fight it just started #187

shipped merged opened this has it
opened this

Teach a bot to reload on its own time, so it walks into a duel with a full magazine instead of discovering an empty one in it.

The only reload a bot ever asks for is src/client/bots.ts:426 and :598:

if (ammo !== undefined && ammo.mag === 0) input.reload = true;

A bot that ends a fight with three rounds left keeps them. It then pushes a site, fires three, and stands still for the weapon's reloadTime — 2.5 s on an AK, 3.1 s on an M4 — in front of whoever it was shooting at. The person plays around their magazine; the bots do not, and it is the cheapest difficulty the game gives away.

Done looks like

  • [ ] A bot tops up when it can see no enemy and its magazine is below a stated share of capacity, with the share and the reasoning named in a comment.
  • [ ] A bot never starts a reload while an enemy is in sight (canSee already answers this), so the fix cannot become a new way to die.
  • [ ] A bot that runs dry in a fight and holds a pistol switches to it instead of reloading.
  • [ ] Tests in src/client/bots.test.ts: a bot alone with a half-empty magazine sets reload; the same bot with an enemy in sight does not; a dry bot in a fight with a pistol switches to it; a bot with a full magazine asks for nothing. Each fails against main.
  • [ ] The behaviour is the same at every difficulty, or the difference is deliberate and written down — not an accident of where the branch went.

Risks

  • This changes what the bots are worth, so the arena's measured numbers and the card on the page are downstream: run the arena or scripts/duel.ts before and after, put both in the pull, and do not re-train here.
  • src/client/observe.ts must not gain an observation; a bot's own magazine is already in its hands, and the policy's input shape is fixed by the shipped weights.
  • #169 is in hand in this same file, on this same thinkFor/combat path, which is why this waits on it. Branch from main after it lands, not from its branch.

Files I expect to change

src/client/bots.ts, src/client/bots.test.ts, and README's The bots section.

Suggested: vesper, or scout if it is treated as a tuning change with a measurement attached.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs