Conveyor belts carry voodoo dolls across weighted lines that change light levels or floor heights. Staircases turn those values into activations by controlling how many dolls pass. Python reads the results from the running game and fails on any difference from the integer reference.
DOOM reads handwritten MNIST digits with 97% accuracy: all 10,000 test digits ran through four tile maps with Python passing values between them, and every value read from the game matched NumPy exactly, while DrawPad, below, runs the same network in one map.
Walk a digit, DOOM reads it
The marine holds FIRE to ink the floor and then presses READ, which writes the 784 pixels into a network trained on MNIST and scripted strokes, and its 1,355 voodoo dolls compute the network inside the same map until the winning digit's doll lights the display.
# arrows walk, hold Ctrl to draw, Space: READ
doomformer draw
# headless: the marine walks a 7
doomformer draw --digit 7
# the same map as a WAD that GZDoom plays without Python
doomformer draw --build drawpad
His brain is the level
The marine fights in the map that computes his policy, and the dots on the right are 1,345 voodoo dolls of him. A level script senses the nearest demon, the dolls pick an action and the level turns him or fires, while Python only advances the clock and reads the results, and all 50 decisions match NumPy. The film is time-lapsed, and the demons are frozen while the dolls compute.
Commands
pip install git+https://github.com/mottopanikeiku/doomformer # Python 3.11+, Linux or macOS
Install it in a virtual environment, and because the first run builds ACC, the level-script compiler, install git,
cmake, make and a C/C++ compiler first and then run doomformer doctor to check the setup.
| Command | What DOOM does | Time | Skill level |
|---|---|---|---|
doomformer hello | a small MLP, 5 random inputs | 2 s | I'm too young to die |
doomformer draw --digit 7 | the marine walks a 7, the level reads it | 15 s | |
doomformer mnist | reads 4 test digits, or your own image | 1.5 to 3 min per digit | Hey, not too rough |
doomformer demo | a transformer writes a level name | 15 to 60 s | Hurt me plenty |
doomformer demo --nightmare | the 2-layer model, 106 tile maps | 3.5 to 7 min | Nightmare! |
doomformer ask "what does iddqd do" | answers from 189 DOOM facts | about 11 min | Ultra-Violence |
ask answers 94.7% of its training questions correctly and 35.4% of new wordings, and a small MLP runs
about 23,000 times slower than NumPy on a 16-core arm64 machine.
Every command
How it works
- your networkPyTorch / NumPy
- integersquantised
- a DOOM maplanes, gates, lava lines, doors
- ViZDoom runs itvoodoo dolls walk
- read backlight levels and plane heights
- EXACTevery readback equals the NumPy integer reference
DOOM turns every extra player start into a voodoo doll, a copy of the player that rides conveyors and triggers every line it crosses, so an activation of 5 is five dolls. A staircase lets a doll past each step only if the value clears it, which gives ReLU, rounding and clamping in one shape.
A second floor move in the same sector and tic is lost, a teleport cancels lines crossed earlier that tic, and objects far from a BSP node land in the wrong room, so these constraints shape the compiler (engine details).
counter.wad (2006) counts with voodoo dolls, conway.wad runs Game of Life, and Danny Spencer's calculator adds numbers. Doomformer compiles neural networks into these mechanics and checks their outputs against NumPy.
Bigger experiments
Every value read from these runs matched the NumPy integer reference, and the films show selected runs (demo results).
DOOM dreams of DOOM
A 2-layer name model writes DEMON CANYON and a Python generator builds the level, which a marine whose policy runs in 55 games plays for 120 decisions, with 3 neuron lanes closing at decision 50.
DOOM plays DOOM
A 1-layer policy navigates the generated level, opens doors, kills two demons and reaches the exit in 102 decisions, with Python supplying the compass and enemy positions.
DOOM learns
In this earlier learning run, 156 dolls train a 38-weight perceptron inside one map by raising and lowering ceiling heights, while Python bins the features and supplies the aimbot's labels.
Lobotomy
A 7-pellet blast to his DOOM brain stops him firing, so he gets 0 kills over 74 decisions.
A 4-layer transformer
A 4-layer transformer writes UNHOLY STRONGHOLD over 10,166 tile runs, which share a pool of games, and 208,598 voodoo dolls.
A fruit-fly circuit
A 255-neuron circuit derived from the FlyWire connectome runs for 169 steps as the marine visits four stations: eat, refuse, groom, take off.
A whole transformer in one map
A 1-layer, d=8 transformer writes SHIL using 3,548 voodoo dolls, and the map computes embeddings, attention, MLP and logits without Python between layers (time-lapsed).
Generation without Python
The winner's doll writes the next token and the level rewinds itself to generate DAN while Python only advances the clock and reads the results. The overhead view uses ViZDoom's 4,096-object list, so some dolls are absent from the picture.
The showreel
A one-minute compilation: voodoo dolls on lava, attention gates, level generation, the marine playing and learning, lobotomy, a transformer in one map and his brain inside the level.
Run it yourself
These run from a clone after pip install -e ., and the
demo commands, timings and sample output are in the repository.
python -m demos.brainlevel: his brain is the levelpython -m demos.aimlearn: a perceptron learns to aimpython -m demos.flyloop: the fruit-fly circuitpython -m demos.lobotomy: lesions
Build your own
Compile a network into a map and let its outputs open doors, flash lights or shove the marine.
import numpy as np
import doomformer as df
# 2 inputs -> [a AND b, a OR b] -> 2 outputs, all integers
net = df.MLP(
weights=[np.array([[1, 1], [1, 1]]), np.array([[1, 0], [0, 1]])],
biases=[np.array([-1, 0]), np.array([0, 0])],
thresholds=[np.array([1]), np.array([1])],
signed_input=False,
)
with df.compile(net) as brain:
for x in ([0, 0], [1, 0], [1, 1]):
# computed by voodoo dolls; raises df.MismatchError on any difference from net.reference
print(x, "->", brain(np.array(x)).tolist())
brain.record([np.array([0, 1]), np.array([1, 1])], "dolls.gif") # film the dolls doing it
Start with BUILD_YOUR_OWN.md or the 12 runnable examples.
