Alan Gaudet
GFX-01

COD of Tanks

A native Rust and Bevy port of Claude of Tanks, a Three.js browser tank game, in development.

In development

See it on the bench

Three panels from the same chase camera behind a desert-camouflage tank on a dirt road: the Three.js original, the port's reference tier and the port's Ultra tier.
Same camera, same frame. Left: Claude of Tanks, the Three.js original. Middle: the port's reference tier. Right: the port's Ultra tier.
Street-level view of a tank passing a farmhouse, compared across the original, the reference tier and Ultra.
Village street, same three columns.

Description

COD of Tanks is a Rust port of Claude of Tanks, an MIT-licensed browser tank game by Kevin B. Liu, written in TypeScript on Three.js. It moves the game to a native Rust client on Bevy. The goal is a playable demo that looks and plays better than the original, with nothing from the original left behind. The port keeps the original's rules: a fixed-step simulation in meters, seconds and radians, seeded randomness, and a renderer that never decides a hit.

Block diagram

  1. Player input
  2. cot-sim
  3. Sim events
  4. Bevy renderer

Decisions

Port the rules, bake the geometry

Simulation, world, AI, input, camera, UI, effects and audio are rewritten in Rust. The original's procedural tank-geometry builders run once under Node and write glTF and JSON, reusing a path the original already had. The cost is a Node step in the build and assets that a fresh clone has to bake. Translating the geometry to Rust is a later milestone, gated on matching the triangle counts the original records for each model.

Parity goldens from the original running under Node

Each ported module has a Node script that runs the pinned TypeScript on fixed inputs and writes a golden file, which a Rust test replays and compares. JavaScript Math goes through a crate that matches V8 bit for bit, because Rust's f64 hypot, min, max and round disagree with V8 on NaN, signed zero and halves. The weak spot is pow, which follows the host glibc, so a lenient mode tolerates the cases marked fragile.

A port ledger with a row for every upstream file

Every file the original tracks has a row in a ledger with a status and a Rust home. A check fails when a file has no row, when a row names a file upstream no longer tracks, or when a ported row points at a Rust file that does not exist. That turns the goal of missing nothing into a gate. Only one coordinating session edits the ledger, so parallel coding agents cannot fight over it.

Errata

  • The full game flow fails on the current main branch after the last round of merges: returning to the Garage after a battle panics, and a render validation error can end a battle after a tank is destroyed.
  • Multiplayer is not ported. The engine-free network protocol work is paused on a branch.

Revision history

Version Changes
Unreleased The simulation, every map and game mode, the Garage, the kill camera, destructible props and the calibrated Three.js look.

Claude of Tanks is copyright Kevin B. Liu and released under the MIT licence. COD of Tanks keeps that licence and notice.