# How WARSHIP WORKSHOP runs a 1000-place online ladder from one browser page

> Source: <https://dev.to/antgamesai/how-warship-workshop-runs-a-1000-place-online-ladder-from-one-browser-page-h1o>
> Published: 2026-12-04 16:10:39+00:00

**Recommendation:** Version your deterministic simulation as a hash-of-hashes of its source files and have the server return 409 on mismatch, so stale clients reload instead of desyncing.
More in the playbook "Running AI in production": <https://wpnews.pro/playbooks/production-ops>

[WARSHIP WORKSHOP](https://antgames.ai/play/warship-workshop/#play) is a free 3D warship builder that runs in the browser: you design a warship part by part, press FIGHT, and watch it battle on its own, then climb a shared ladder of 1000 places. It is an original release by Ant Games. Free to play, no pay to win, no sign-up, on desktop and phone with nothing to install.

This is a technical devlog: how the game is put together, and the three decisions that made a networked auto-battler possible inside a single HTML file.

An auto-battler where you fight the server's ships is usually two programs: a client that renders, and a server that simulates. The obvious split works, but then a fight is a black box — the player sends a ship and waits for a result.

We wanted fights you *watch*. So the browser has to run the exact same simulation the server runs, and both must agree down to the byte, or every fight between them is a lie.

The fight rules are 74 source files: 59 in `src/sim`, 13 in `src/content`, the RNG, and one entry file. They obey a single import rule: they import nothing from the game, render, UI, online, platform, input or asset layers — and they never read a clock or call `Math.random`.

Every one of those files is hashed, and the rules layer's identity is a hash-of-hashes: the first 16 hex digits of a sha256 over the sorted list of every file's path and sha256. The page carries that value; the server's fight bundle carries it too. A fight request sends the page's value with the ship. If the server runs a different rules value, it answers 409 and the page asks to reload — one changed byte in a rules file cannot silently desync a fight.

Because the sim is pure — ships in, a seed in, no clock, no `Math.random` — the same fight replays identically everywhere. The fight seed is an FNV-1a hash of `fight|<id>|<place>|<version>`, made by the server, so neither side can pick its own dice.

The build is deliberately extreme: `dist/index.html` is a single file — one minified script, the CSS, and every asset embedded as base64 blocks in `<script type="application/octet-stream">` tags, 127 MB in total. It runs from a server page, and the same script boots both of the page's workers from a single text Blob.

Why: a browser game that loads no other file has no loading race, no missing-asset path, and one artifact to publish and version. The cost is size, so assets stream in by family — backdrop, hulls, icons, bodies, maps, VFX, props, debris, music, atlas — with a load manifest, and meshes are glTF in gzip blocks the page inflates with `DecompressionStream` as they are needed. Rendering is three.js on a WebGL2 canvas.

The online ladder is one Node program with only `node:` built-ins. 1000 places, each held by a player or by a computer ship; every holder or ship change bumps that place's version, which is what lets the rules hash catch a stale page. Fights run in a worker thread. The ladder is a single JSON file: each write appends a line to a log beside it, and periodically the log is folded into a snapshot by atomic rename, with an hourly backup.

Saves never touch a database either: the page keeps the save in `localStorage` under a per-game prefix, uploads it (at most 64 KiB, one in 10 s), and the server keeps three revisions. A SAVE LINK carries the save to another browser. The newest tab holds the save; other tabs stay read-only, so two tabs can never overwrite each other.

The server also makes every name (a word, a creature and a number), stores players under sha256 hashes of their id and token, and answers every JSON with `Cache-Control: no-store` and `X-Robots-Tag: noindex`.

From our server logs, last 7 days, as of 2026-12-04:

Small numbers, but honest ones, and the ladder makes every one of them count.
