The Loong Game
An open source series running alongside the UNSW Battlecode competition, with weird bot ideas, beginner tips, unswbc tools and WASM performance deep dives.
-
Introducing The Loong Game
Who I am, what the series is for, the 2026 tournament in brief, and what the official toolkit does and doesn't give you.
-
The wishlist
Trying to improve a bot with only the stock toolkit, where that falls short, and the eight tools built in this series to fill the gaps.
-
The choice
Python, C and Nim under the judge's CPU-point meter, plus Odin for tools, Zig for the host, and Rake for SIMD kernels or a whole program.
-
The evaluation harness
A harness that plays every pairing on every map from both sides with shared seeds, runs games side by side, and keeps crashes apart from losses.
-
Better, worse or undecided
A sequential test that says how far a difference between two bots can be trusted, and the upset games that turn up faults to watch.
-
Unseen maps
Generating plausible new maps with another competitor's shared generator, and the blind spots revealed in the flood-fill bot.
-
A ladder of our own
Rating every saved version against every other with a Bradley–Terry fit of all games at once, and checking the pool for rock-paper-scissors circles.
-
Everyone else's games
A paced, resumable replay collector with a capped store, recent games from strong teams, pins for study, and explicit retention and deletion.
-
Reading a replay
Decoding the packed Cap'n Proto replay format with a reader written in Nim, rebuilding each game turn by turn, and counting how dragons die.
-
Pearls from the seed
Recovering compatible pearl schedules from a replay and seed, checking hidden map variants, and refusing a reconstruction that doesn't match.
-
Through one dragon's eyes
An Odin debug viewer that reruns a bot to show each dragon's window, decisions and graded memory, and what it shows about why chasing pearls kills.
-
Profiling CPU points
Profiling charged points by function and instruction class, joining compiler vectorisation remarks, and following hot code into native perf.
-
The shape of the problem
Organising the textbook bot around role objectives, utility-selected tasks and state machines, then reviewing the first small strategy bot.
-
Three lines
How a numbered strategy, pinned library pieces and a shared runtime form a bot, then why textbook, foil and learned lines develop side by side.
-
Roles
Champions, workers and kamikazes as parent states over shared behaviours, each dragon working out its own role by sonar, and bugs found in replays.
-
Tactics
Coiling the champion and feeding it with smaller dragons that die beside it, the numbers left to tune, and every version on one ladder.
-
Sonar
How sonar rays, echoes and open messages work, what 800 public replays showed about encryption and forgery, and the idea of poker over sonar.
-
Counting room faster
Taking the room count from Nim through bitboards to SIMD, 66 times cheaper in CPU points, and keeping it vectorised with a Rake kernel.
-
The machine inside the judge
A faster Zig host with metered bot fibres, inspection-only observers, served teams, lockstep checks and explicit native CPU/CUDA simulation.
-
An engine on the GPU
A shared fixed-array engine for CPU and CUDA, the historical GPU training loop and its checks, and released SDK 1.2.7 complete-match references.
-
Games in the cloud
Running big batches of games on AWS Spot workers, the standing resources declared in OpenTofu, and how every run ends on its own.
-
Game data in columns
One binary format for all our game data: memory-mapped columns read without parsing, and a converter that writes them from any packed replay file.
-
Playing the ladder
How we played the ranked ladder: choosing opponents, estimating a bot before release, when to swap bots, knockout tournaments and opponent styles.
-
Modelling other teams
What research on modelling other agents offers a public ladder, and what we did: a census of techniques, imitation, sonar decoding and determinism.
-
Planning to play
The planning line: its world model, sonar, roles, utility selection, twenty behaviours, state machines and tactical search.
-
Learning to play
The learned line: a large teacher trained by self-play, a league of past selves, and distillation into an integer student that fits the judge.
-
A tour of our bot
The pre-Queen bot: its memory, sonar, roles and bounded planning, plus the unfinished experiment that put a learned student in charge of movement.
-
Slay the Queen
The competition changes to Slay the Queen after the Sprint, so earlier planning and learning designs are being revisited under the new rules.
-
The final specification
The final expert design for Loong: belief, a quantised policy and value network, options, online search, teacher training, league play and review.