An RL-trained Tank Royale bot in pure Nim that controls body movement, turret, and firing via continuous actor-critic, trains between rounds, persists weights, and progressively improves against any 1v1 opponent.
Notes
Domain: Tank Royale (Robocode successor). Nim bot API in sibling repo /home/davide/Projects/tank-royale branch nim.
Skills to consult: /grilling, /domain-modeling, /prototype
Arraymancer is the primary ML library; hand-rolled MLP is the fallback if Arraymancer proves unusable.
Radar is deterministic (not RL-controlled) — a simple lock/sweep tracker.
Bot folder must be self-contained under SirRoboGarage repo root.
Enemy tracker design — Decoupled deterministic radar with lock+overshoot, dead reckoning on missed ticks, EnemyState struct with inferred firing detection.
State vector design — 42 normalized floats: 14 current tick (own+enemy), 8 derived (acceleration, turn rate, bearings, wall distances), 20 enemy window (5 ticks × 4 features). No own history, RNN upgrade path if needed.
Action space mapping — 5D continuous: targetSpeed, turnRate (dynamically scaled by speed), gunTurnRate, fireDecision (tanh, threshold 0, masked when gun hot), firePower (sigmoid [0.1,3.0]). Split fire enables probe/nuke bullet strategy.
#6 Reward function design — Per-tick energy delta (raw, no shaping) + per-round game score / 100. Gamma 0.99, GAE lambda 0.95. Minimal shaping philosophy.
#8 Training loop design — Background-thread PPO training on round end. 4 epochs, mini-batch 64. Episode buffer cleared each round. Atomic .npy weight saves, 3 rotating checkpoints every 50 rounds. Bootstrap GAE on interruption.
#9 Network architecture — Separate actor/critic, both 64→tanh→64→tanh. Actor outputs Gaussian mean, separate learnable log-std vector (5 floats). Critic outputs unbounded scalar. ~8K params. Arraymancer defaults for init.
#11 Bot scaffold and build setup — PPO_Bot/ folder: nimble project with tankroyale_botapi + arraymancer, shell.nix for OpenBLAS, minimal bot that joins a game. Builds via nix-shell.
#10 Exploration noise — Entropy bonus (coefficient 0.01) in PPO loss; no explicit action noise. Sufficient for continuous Gaussian policy with learnable log-std.
Map cleanup: closed implementation tickets #13–#17, moved #10 to Decisions so far. All decisions made, destination reached. Remaining fog (multi-opponent generalization, performance profiling) is explicitly out of scope for this effort.
Map cleanup: closed implementation tickets #13–#17, moved #10 to Decisions so far. All decisions made, destination reached. Remaining fog (multi-opponent generalization, performance profiling) is explicitly out of scope for this effort.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Destination
An RL-trained Tank Royale bot in pure Nim that controls body movement, turret, and firing via continuous actor-critic, trains between rounds, persists weights, and progressively improves against any 1v1 opponent.
Notes
/home/davide/Projects/tank-royalebranchnim./grilling,/domain-modeling,/prototypeDecisions so far
Not yet specified
Out of scope
Child tickets
Blocking graph
Map cleanup: closed implementation tickets #13–#17, moved #10 to Decisions so far. All decisions made, destination reached. Remaining fog (multi-opponent generalization, performance profiling) is explicitly out of scope for this effort.