Replay viewer and bot-state visualisation helpers for the Cambridge Battlecode programming competition.
Two components:
viewer/— a standalone Rust desktop app (eframe/egui) that renders.replay26replay files tile-by-tile with scrubbing, indicators, per-entity inspection, empirical resource-flow overlays, and custom bot state overlays (##VIS##stdout protocol).src/visualiser/— a tiny Python library bots import to emit their state each turn (grids, palettes, scalar fields, tile sets, vector fields). The viewer parses the emissions and lets you toggle them as overlays per bot.
Build:
cd viewer
cargo run --release -- path/to/replay.replay26The viewer hot-reloads the replay file on change. Right sidebar holds the overlay toggles, including the experimental per-junction conveyor sprites.
from visualiser import (
BoolGrid, I16Grid, Scalar, Tiles, Palette, PaletteStop,
Colour, VectorField, emit, TRANSPARENT,
)
emit(
dist=I16Grid(state.dist, palette=P_DIST),
fog=BoolGrid([e is None for e in state.env], palette=P_FOG),
scale=Scalar(142.5),
goals=Tiles([(3, 5), (7, 2)]),
)The viewer picks these up from the replay's captured stdout and exposes them as overlays for the emitting bot.
Install dev deps and run the script:
uv sync
uv run conveyor-assetsThis writes 128 PNGs into viewer/assets/ (one per team × armour ×
output-direction × input-mask).
Split licensing — see LICENSE for full terms.
- Code (everything except
viewer/assets/cambc/) — MIT. - Upstream assets in
viewer/assets/cambc/— © Cambridge Battlecode (https://battlecode.cam), licensed under CC BY-NC-SA 4.0. Attribution required; non-commercial only; derivatives must share-alike. Seeviewer/assets/cambc/LICENSE. - Generated assets in
viewer/assets/conveyors/— rendered byuv run conveyor-assets; covered by the MIT code licence.