T1: Tracer bullet — Gun harness + head-on gun + bot skeleton #179
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
#165 (ModularBot wayfinder map)
What to build
End-to-end working ModularBot that proves the plugin architecture. One vertical slice through every layer:
common_libs/gun_harness/gun_interface.nim):Gunconcept withpredict(state, bulletSpeed) → (x, y)andonResult(event).WorldStatetype (enemy + self + arena + tick).GunPredictionandFeedbackEventtypes.common_libs/gun_harness/virtual_bullets.nim): Every tick, spawn virtual bullets per gun × power bin (3-5 bins). Track via bullet travel. Record hit/miss. Rolling window fitness per gun×power. Call gun.onResult() on resolution.common_libs/gun_harness/selector.nim): Query fitness, pick best gun. Compute aim angle. Fire when gun aimed + heat==0. Highest power with acceptable hit rate.common_libs/guns/head_on.nim): Simplest gun — predict enemy stays at current position. predict() → (enemy.x, enemy.y). onResult() is no-op.ModularBot_garage/): ModularBot.nim, .nimble, .json, .sh. Wires GunHarness with just head-on gun. Uses existingcommon_libs/radar_lockdirectly (not via harness yet). No movement module yet (stationary). Static gun registration.The bot must compile, run, lock radar on enemy, and fire using the gun harness with virtual bullet tracking active.
Acceptance criteria
Blocked by
None — can start immediately.
Assigned to davide
Implementation complete — compiles clean
Files created
common_libs/gun_harness/gun_interface.nimWorldState(all raw data: enemy pos/vel/heading, self pos/vel/heading, arena, tick)GunPrediction(absolute x/y target)FeedbackEvent(outcome of resolved virtual bullet: miss distance, hit bool, power)bulletSpeed(power)helper (20 - 3*power)BotRadius = 18.0constant for hit detectionisGuntemplate — compile-time duck-typing checkcommon_libs/gun_harness/virtual_bullets.nim[1.0, 1.5, 2.0, 3.0]VirtualBulletslots; resolves by travel distancespawnBullets/tickBullets/bestPower/bestGunMinHitRate = 0.40threshold for power selectiononResolvedcallback (which callsgun.onResult()) on resolutioncommon_libs/gun_harness/selector.nimaimAngle(selfX, selfY, targetX, targetY) → float(degrees, 0=East CCW+)shouldFire(currentGunDir, targetAngle, gunHeat) → bool(within 5° and cool)selectShot(tracker) → (GunId, binIdx, power)common_libs/guns/head_on.nimHeadOnGunobjectpredict→GunPrediction(x: enemy.x, y: enemy.y)(stationary prediction)onResult→ no-opModularBot_garage/src/ModularBot.nimBot, uses radar_lock directly[vbullet] gun=0 bin=N miss=X.Xpx hit=bool | total hits=H/T (P%)ModularBot_garage/:ModularBot.nimble,config.nims,ModularBot.sh,src/ModularBot.jsonBuild verification
What is NOT done (per spec)
isGuntemplate is a compile-time check helper, not enforced via concept syntax (Nim concepts with mutable receivers need special handling — duck typing via template is equivalent and simpler)