Agentic DOOM · engine

The engine behind Agentic DOOM

Agentic DOOM runs on its own engine. It is written in Rust from the DOOM file formats, compiled to WebAssembly and drawn with WebGL2. Every monster in it is a declared state machine under a contract, and a small trained decision model runs inside the engine. All of it runs in the browser tab.

Play it at agentarena.ca

V agent view · F possible futures · J System One

01Written from the file formats

The engine reads DOOM's WAD data directly. It is not a C engine compiled for the browser: the map reader, the BSP renderer with DOOM's palette and light, and the simulation at DOOM's 35 tics a second are its own code. A modified level can be written back out as a standard PWAD, which other DOOM engines open.

02Small, and whole in the tab

The deployed build is static files: 889 KB of WebAssembly for the engine, its agents and System One, 99 KB of JavaScript, and 10.3 MB of compressed game data (Freedoom). The game, the contracts, the possible futures and System One all run in the browser. No server computes any of it.

03Monsters under contract

Every monster is a declared state machine. Each action one proposes is checked against its class's contract, a descriptor the engine reads as data, before the tic it would run in, and is granted or refused. Every decision goes into a ledger chained with SHA-256, and the admission rules and the chain match the Agentic Datasets reference.

The agent view: monsters labeled with their state; a demon's label reads SARG#129 ATTACK, shoot REFUSED UNREGISTERED_CAPABILITY.
A demon proposes to shoot. Its contract declares no such capability, so the engine refuses it.

04Every choice can be played forward

F holds the world at the next choice a monster makes, plays each of its options forward three seconds, eight times, on a copy of the world, and draws where each one leads and how much damage it does to the player. F again lets the game go on.

05A trained decision model inside the engine

System One (experimental, off until J) is a linear model over 51 features, compiled into the engine. Where a monster's contract leaves more than one choice, it scores the choices and picks one when it is confident enough. Otherwise the script picks, and the contract still grants or refuses every action. It also picks for a monster that has lost sight of the player, from what that monster remembers: when and where it last saw the player, whether its way ahead is clear, whether it is following a wall, and how far it has moved lately.

The rules and their bars were written and hashed before anything was labeled, trained or played. Each training decision came from games played under the same rule, with each choice held for ten seconds and played forward. On the nine maps of episode 4, held out from training, with 1,800 one-minute runs per arm against the script:

The agent view: three imps out of the player's sight, each labeled LOST, strafe GRANTED, System One.
Three imps that lost sight of the player. System One picked each one's move, and the contract granted it.

06Two views of one world

V switches between the normal view and the agent view. The agent view draws the same geometry and the same light as streams of glyphs, each taken from the texture at that spot, and labels every monster, through walls, with its state and its last decision.