T3: Add circular gun module #181

Open
opened 2026-09-19 14:49:03 +02:00 by SirStone · 1 comment
Owner

Parent

#165 (ModularBot wayfinder map)

What to build

Circular prediction gun. Needs 2+ frames internally to compute enemy turn rate. Projects arc forward by ticksToArrive steps. Returns absolute (x, y). onResult() is no-op.

Register in ModularBot. Three analytical guns now compete.

Acceptance criteria

  • Circular gun implements Gun interface
  • Tracks turn rate from frame-to-frame heading changes
  • Registered in ModularBot — three guns competing
  • Wins against circling enemies (e.g. SpinBot)

Blocked by

#179 (T1)

## Parent #165 (ModularBot wayfinder map) ## What to build Circular prediction gun. Needs 2+ frames internally to compute enemy turn rate. Projects arc forward by ticksToArrive steps. Returns absolute (x, y). onResult() is no-op. Register in ModularBot. Three analytical guns now compete. ## Acceptance criteria - [ ] Circular gun implements Gun interface - [ ] Tracks turn rate from frame-to-frame heading changes - [ ] Registered in ModularBot — three guns competing - [ ] Wins against circling enemies (e.g. SpinBot) ## Blocked by #179 (T1)
SirStone added the ready-for-agent label 2026-09-19 14:49:03 +02:00
Author
Owner

Implemented and compiled successfully (build clean, no errors).

common_libs/guns/circular.nim — new file:

  • prevHeading + hasPrev flag; first frame falls back to head-on (need 2 frames for turn rate)
  • Turn rate = signed delta between consecutive enemyHeading values, normalised to [-180, 180] deg/tick
  • 3-pass iterative ticks-to-arrive refinement: project arc tick-by-tick (heading += turnRate, pos += speed * (cos, sin)), recompute bullet travel distance, repeat
  • Clamps prediction to arena bounds with BotRadius margin
  • onResult() no-op (analytical gun)

ModularBot_garage/src/ModularBot.nim — CircularGun wired as gunId=3 (alongside parallel agents' additions: TsetlinGun=2, OscillatorModule, RadarLockModule):

  • Added circPreds array + spawnBullets(3, ...)
  • Added of 3: bot.circular.onResult(fe) in tickBullets callback
  • Added of 3: bot.circular.predict(...) in gun selection
  • Bumped initTracker(4) (0: HeadOn, 1: Linear, 2: Tsetlin, 3: Circular)
Implemented and compiled successfully (build clean, no errors). **`common_libs/guns/circular.nim`** — new file: - `prevHeading` + `hasPrev` flag; first frame falls back to head-on (need 2 frames for turn rate) - Turn rate = signed delta between consecutive `enemyHeading` values, normalised to [-180, 180] deg/tick - 3-pass iterative ticks-to-arrive refinement: project arc tick-by-tick (`heading += turnRate`, `pos += speed * (cos, sin)`), recompute bullet travel distance, repeat - Clamps prediction to arena bounds with `BotRadius` margin - `onResult()` no-op (analytical gun) **`ModularBot_garage/src/ModularBot.nim`** — CircularGun wired as gunId=3 (alongside parallel agents' additions: TsetlinGun=2, OscillatorModule, RadarLockModule): - Added `circPreds` array + `spawnBullets(3, ...)` - Added `of 3: bot.circular.onResult(fe)` in tickBullets callback - Added `of 3: bot.circular.predict(...)` in gun selection - Bumped `initTracker(4)` (0: HeadOn, 1: Linear, 2: Tsetlin, 3: Circular)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SirStone/SirRoboGarage#181