DevControlBot 1.2.0: TFIL survival movement + universal battle runner

Ported "the floor is lava" (TFIL) movement into DevControlBot as a
self-contained module, DevControlBot/modules/tfil.nim. It has no runtime
dependency on common_libs/: the port is a standalone implementation,
parity-verified against the common_libs original over 2000 differential
ticks with zero divergences. Do not re-introduce the dependency and do
not edit the original to match.

Debug graphics (per-tile lava heat, tracked bullets and their danger
corridors, enemy core/aura, reachable hull, committed tile) are OFF by
default and compile-time gated behind -d:tfilDebug; see README.md for
the plain `nim c` invocation, since nimble runBot does not forward
compile flags.

Wired into DevControlBot.nim: movement computed between commandRadar()
and go(), fire-event tracking wired up, staleness handling for scanned
enemies, and body colour set to BLACK at init (movement and radar both
claim colour now).

Also adds tools/test_runner, a shared battle-test runner usable by any
garage, with an Observer adversary for quick floor checks.
This commit is contained in:
2026-10-04 18:16:24 +02:00
parent de0dd50d6e
commit 67d185880d
17 changed files with 1666 additions and 25 deletions
+21 -8
View File
@@ -70,14 +70,22 @@ an existing commit or tag.
garages to make this bot work, and do not reuse another bot's game logic
without explicit permission; shared, bot-agnostic code belongs in
`common_libs/`, and only with permission.
- Team colour convention: **white = not programmed, black = radar active**.
- The bot **moves** (bullet-avoidance mover, see "Layout of this folder") but
still **does not fire**: hit tracking exists, the gun does not.
- Team colour convention: **white = not programmed, black = programmed and
running**. The bot is **fully black**: movement (initTFIL) claims body, turret
and gun, the radar (initRadar) claims the radar and its scan arc.
- Provenance: ModularBot / common_libs (Davide Cappellini, Apache-2.0).
### Constraints worth remembering
Not explanations — real invariants that broke things when violated:
- **Command the radar BEFORE `go()`** — a real bug the other way round.
- **Command the radar BEFORE `go()`** — a real bug the other way round. Movement is
computed in the same slot, between `commandRadar()` and `go()`.
- **Movement is self-contained.** `modules/tfil.nim` is a port of
`common_libs/movements/the_floor_is_lava.nim` with **no runtime dependency on
`common_libs/`** — do not add one, and do not edit the original to match.
- All radar logic is `modules/radar.nim`, in one piece. Do not split it back into
harness/lock/melee modules.
@@ -96,7 +104,8 @@ DevControlBot_garage/
│ ├── DevControlBot.sh # BotLauncher entry point (thin wrapper)
│ ├── .env # OPTIONAL local config; secrets, never commit
│ └── modules/
│ └── radar.nim # all radar logic
│ ├── radar.nim # all radar logic
│ └── tfil.nim # all movement logic ("the floor is lava")
└── tests/ # INTENDED, does not exist yet — create it on
# the first real test
```
@@ -139,6 +148,9 @@ Or via the wrapper, which works from any cwd:
overrides the path) is local-runs-only and **never overrides a variable already
present in the environment** — the BotLauncher's values always win. Never print
its values, never `set -x`, never commit it.
- **Debug graphics are OFF by default** and compile-time gated behind
`-d:tfilDebug`; `nimble runBot` does **not** forward compile flags, so draw them
with a plain `nim c -d:tfilDebug ...` (into a `/tmp` output path) and run that.
- Dependency setup is `nimble install robocode_tankroyale_botapi`; dependencies
come from the global nimble store. Do not vendor, do not add
`nimble.paths` / `nimble develop`.
@@ -175,10 +187,11 @@ Source: https://robocode.dev/articles/coordinates-and-angles.html (Tank Royale d
**CURRENT STATE, not a design sketch.** These describe the code as it is today.
**Diagram 1 — one tick. Owned by `DevControlBot/DevControlBot.nim` (`run`, lines
34-40) and `DevControlBot/modules/radar.nim` (`onScan`, `commandRadar`) — update
this diagram when either file changes.** The ordering is the whole point: the
command is issued BEFORE `go()` so it travels with this tick's intent, and
events arrive AFTER, so a scan can only ever steer the NEXT tick.
34-40), `DevControlBot/modules/radar.nim` (`onScan`, `commandRadar`) and
`DevControlBot/modules/tfil.nim` (`computeMove`) — update this diagram when any of
those files changes.** The ordering is the whole point: the commands are issued
BEFORE `go()` so they travel with this tick's intent, and events arrive AFTER, so
a scan or an incoming bullet can only ever steer the NEXT tick.
```mermaid
sequenceDiagram
@@ -189,7 +202,7 @@ sequenceDiagram
Run->>Radar: commandRadar<br/># one command, every tick, no idle branch
Radar-->>Bot: setRadarTurnRate<br/>LOCK turn + 5deg overshoot,<br/>or +45deg sweep
Run->>Bot: go<br/># intent sent here, FIRST
Bot->>Srv: tick intent<br/>radar turn only,<br/>no move, no fire
Bot->>Srv: tick intent<br/>radar turn + move,<br/>no fire
Srv-->>Bot: tick result<br/>+ pending ScannedBotEvent
Bot->>Radar: onScannedBot -> onScan x, y<br/># AFTER go: remembers only
Radar-->>Radar: target position stored,<br/>tick counter reset