DOOM's DNA: How code keeps its family resemblance · squid-protocol.github.io · El Autómata
Lunes, 16 de noviembre de 2026
Portada de las 22:25
Todos los periódicos y la radio, en unoEscrito por IA a partir de Hacker News · Cómo se hace
Hacker News
squid-protocol.github.io · texto original
DOOM's DNA: How code keeps its family resemblance
We measured 43 programs in DOOM's family, from copies of the 1997 source code to translations and from-scratch rewrites. Measured by shape alone, without reading the code, they still show who copied whom, and which translations kept the original blueprint. An interactive article by Joe Esquibel, made with the GitGalaxy code-scanning engine.
All 55 programs in the updated study around linuxdoom. Each name is sized by how many functions it has. Tap any name to open its profile and 16-track DNA gene map.
Core Claims
A function's structural shape + call-graph neighborhood acts like DNA, even with zero names read. Unsupervised Seed-and-Extend (composition mode + Fused Gromov–Wasserstein + delta offset + 3-hop extension) recovers 65–95% of 1-to-1 functions across C ports (mood 95.3%, puredoom 89.0%, doomgeneric 84.9%, sdl-doom 82.3%, doom-ascii 80.8%, doom-wasm 78.8%, chocolate-doom 65.0%).
Structural DNA survives cross-language translation. Ported to Go (gore, flat directory layout, 0.2% filename match), Seed-and-Extend calibrates the C → Go translation vector and recovers 426 / 561 (75.9%) exact 1-to-1 functions (92.5% on Tier-1 seeds).
True from-scratch rewrites and unrelated controls sit at ~0% noise. Across 9 permissive controls (lua, quake, quake2, carddemo-cobol-ctrl, c-raycasting, c-raycasting2, goom3d, bubbletea, macroquad) and 66 cross-pair permutations of novel/from-scratch/agentic repos, every non-DOOM pair scores 0–1 accidental hits.
Paradigm shifts erase call-graph DNA. In preregistered held-out test DOOM-E5, cydoomgeneric hit 100.0% Tier-1 (156/156, FGW_cost=0.313) against doomgeneric, while iron-doom (ported from Chocolate Doom into Bevy ECS) dropped to 0.0% (0/147).
Horizontal borrowing across separate branches is visible without names. Subtracting linuxdoom isolates Chocolate Doom's textscreen inside odamex, eternity, woof, and doom-wasm; src/hexen inside dsda-doom; MBF21 pointers between dsda-doom and woof; and hidden ancestry (doom-ios embedding prboom-plus, sdl-doom matching doomgeneric).
The 16 subsystems don't need manual filename buckets. Community detection on linuxdoom's call graph discovers 16 organic call-graph tracks directly from call edges, so single-header (puredoom) and flat-dir (gore) ports light up the exact systems they belong to.
Visual 1 · Function Fingerprint
How one function's structural fingerprint moves across ports
Visual 2 · Corpus Comparison
Comparing DOOM ports & controls side by side
65–95% / 75.9%Unsupervised Seed-and-Extend recovers 65–95% of 1-to-1 functions across C ports and 75.9% across C → Go (gore, 92.5% Tier-1)
0 to 0.6%across all 9 permissive controls & 66 cross-pair permutations; Bevy ECS rewrite iron-doom also drops to 0.0%
16 tracks · 49 targetsPure call-graph communities discovered directly from linuxdoom's edges, with horizontal transfers highlighted
Names lie
First, the old-fashioned way. Before trusting a machine that never reads code, we read it: we compared every
descendant's source text with the original's, function by function. That gives the ground truth for everything that
follows. Then, in the next part, we throw the text away.
Start with the obvious way to trace a program's ancestry: look at what its functions are called. It does not work
as well as you'd think. Chocolate Doom, whose whole mission is an accurate reproduction of the original "including
bugs", keeps 86% of the original's function names, but only 33% of those functions still contain the same code.
Doom Retro keeps 69% of the names and just 0.2% of the code. GZDoom, a heavily modernised engine, keeps 32% of the
names and 0.2% of the code.
Copies keep the labels, rewrite the contents
Forks keep the original's function names long after the code inside has been rewritten
Share of the original's functions (at least 20 words of code) present in each C descendant, by name and by
unchanged code. Measured by comparing the source text directly.
Show as a table
Chocolate Doom keeps 86% of DOOM's function names, and 33% of the code inside them.
Averages hide the fun part, which is following one function through the whole family. The original has 662
functions big enough to score. Pick one below and see what became of it in every descendant.
Play with it
Follow a function
Pick a famous one, or type any of the original's 662 functions. Each tile is one descendant; its colour is
what became of that function there. Tap a tile to open that descendant at the bottom of the page.
identical same codenear-identical 90%+ the samederived 60%+name only name kept, code rewrittengone no trace
A fingerprint you can't read
So skip the names. The engine we used records, for every function, dozens of measurements: its length, its
branches, its inputs, what it touches, and which other functions it calls. A companion tool then hunts for
"look-alikes": functions in a descendant whose measurements match one of the original's too closely to be a
coincidence. It never sees the code or the names.
What one function's measurements are
The engine counts the kinds of code in a function, not its text
One real function (zlib's gzeof, not DOOM code) as the engine reads it. Each highlight is
counted into the record on the right: 4 branches, 4 pointer uses, 1 state change, and so on, plus its size. The
last row is the function's fingerprint: yes or no for each kind of code. Look-alikes are functions whose records
match. The name is recorded but never used to match.
Then we checked its work against the actual source text. 93% of the look-alikes it found really are
copies, and it caught about two-thirds of all the copies the text comparison found.
The real test is what happens with programs that have nothing to do with DOOM. Quake and Quake II, id Software's own
later games, and the Lua programming language are all written in C, like DOOM. They share between 0 and 0.6% of DOOM's
shape. Chocolate Doom shares 48%. And the fingerprint is not tuned to DOOM: Quake and Quake II, which really are
related, share 12.7% with each other.
Put those fingerprints together with each project's own account of where it came from and you can draw the whole
family, the way biologists draw an evolutionary tree. One honest difference: a biologist infers who descends from
whom. Here the family links are what each project says about itself; only the branch lengths are measured.
The family tree · who copied or translated whom, and how much code each one still shares with its parent
forktranslation into another languagerewrite- - - an ancestor the study did not scan (distance unknown)dot size: number of functions
Drawn like an evolutionary tree: short branch = close copy, long branch = little code in common.
Branch length is one minus the code shape a descendant shares with its parent. Who descends from whom is as each project states it, not inferred; the lengths are measured. Translations rewrite every line, so they all reach the far edge, even the ones that
kept DOOM's design; that is the next part of the story. Hover a name for its numbers; click to open it below.
Swipe sideways to see the whole tree.
The blind test
Translations are the hard case. Rewrite DOOM in Go and every line changes, every function gets a new name, and
the look-alike hunt finds nothing. So what, if anything, survives?
We tried a blind test. DOOM's code is organised into 16 parts: the renderer, the monsters and physics, the
sound, the status bar and so on. We hid every name and file path in a translation and asked the engine to sort each
function into one of those parts using only its shape and who it calls. Then we checked where the names say it
belongs.
Sorting functions with every name hidden
Some translations still sort themselves into DOOM's parts far better than guessing
Share of each descendant's functions the engine put in the same part of the game as their names do. The
number on the right is how many points it beats guessing by. Chocolate Doom, a straight C copy, is the sanity check.
Show as a table
For the Go translation, the engine sorts 60% of the functions correctly; shuffled labels manage 20%. Among the
quarter of functions it was most sure about, it was right 99% of the time. Scramble the Go program's wiring, keeping
how many calls each function makes, and it drops to 39%: the wiring itself carries much of the signal.
Hide every name, and a Go port's functions still land in the right part of DOOM 60% of the time.
Guessing manages 20%.
Translations that kept the blueprint
If the wiring carries the signal, look at the wiring directly. For every descendant we drew a map of which parts of
the game call which, and compared it with the original's map. To know how much of the match is real, we also
scored each program against itself with its functions shuffled at random between the parts. The gap between the two
is the design that survived.
Wiring, in one film
Which parts of the game call which, compared with the original's
"Wiring" here means the call graph between DOOM's parts (renderer, play simulation, sound, menus and
so on): how many calls go from functions in one part to functions in another. The film draws linuxdoom's map
(777 functions, 1,605 calls), then five ports on the same map. "Chance" is the same program with its functions
assigned to parts at random, which keeps how many calls there are but breaks which part calls which. The
distance between a red dot and its outlined circle is the part of the match that comes from the program's design.
Functions are put into parts by name and file path, so this test is not blind.
The wiring diagram, against chance
The Scheme and Go translations kept DOOM's wiring as well as a straight C copy; Java, Kotlin and C# kept none
Wiring match, from 0 (nothing in common) to 1 (identical). The number on the right is the gap from grey to
blue: how much of the match comes from the program's design rather than chance.
Show as a table
The Scheme and Go translations keep the original's wiring as far above chance as the closest C copy, doom-wasm, and further than Chocolate Doom itself. The Dart
translation keeps some. The Fortran, Java, Kotlin and C# translations keep none, and programs written from scratch,
or not related to DOOM at all, sit at chance, as they should. Don't take our word for it: draw the maps yourself.
Play with it
Compare the wiring
Each circle is a part of the game, placed where the original's wiring puts it; each line is calls between
two parts, thicker for more. A descendant wired like the original draws the same lines. Pick one.
Recalculated Gene Map · All 49 Targets
16-Track Call-Graph DNA Gene Map
All 16 tracks are communities discovered directly from linuxdoom's call graph (zero filename rules). Horizontal additions (textscreen, src/hexen, DG_*) and port-unique functions are placed into the call-graph system they connect to: Grey = unique to that port; colored bands = Seed-and-Extend or structural twin matches to an ancestor/donor. Note: doom3-bfg, doomsday, and gzdoom (>10k funcs) are omitted from the dense FGW pass.
Palette:
Compare vs. linuxdoom
Scale track by log(LOC)
Unsupervised Seed-and-Extend recovery (name precision after 3-hop extension & Tier-1 seeds) across C ports, Go (gore), DOOM-E5 held-out targets, and 9 permissive controls — plus cross-branch horizontal borrows.
Show Seed-and-Extend + DOOM-E5 + Controls table
Horizontal Transfers & Hidden Lineage
Explore all 54
Every descendant, held-out DOOM-E5 target, and permissive control has its own profile: Seed-and-Extend recovery, 16-track DNA gene map, famous functions, wiring, and history. Pick one from the list, or compare any two.
Records · biggest, smallest, most faithful, most starred, oldest history, languages
What it can't tell you
Family across languages from look-alikes. Look-alike functions only work within one language.
Across languages only the wiring carries a signal, and only for the closer translations.
Why Java, Kotlin and C# show nothing. Those translations reorganised the most and chopped the code
into tiny pieces: 34% of the Java port's functions and 43% of the Kotlin port's are three lines or shorter, against
under 2% in the C copies. A lost design and a test that can't see it look the same here.
Whether two programs play the same. This measures the shape of code, not what it does.
Check my work
Every number on this page comes from public code and can be rebuilt from it. Here is everything you need to examine
the data and the methods, or to run them yourself.
The full study
Every table behind this article, the checks, and the commands that regenerate them.
The 44 programs (the original and the 43 programs measured against it)
Each descendant's source repository, the exact commit measured, its language, licence and stated lineage.
The engine, as measured
GitGalaxy at commit 6c7c6c1bc, the one version every number here comes from.
The fingerprint scanner
The tool that compares programs by shape alone: look-alike functions, wiring maps, the blind test and the drift timelines.
The DOOM runs
The scanner's DOOM inputs and results, including the subsystem map, the declared lineage and the blind-test output.
Method: the blind test
How functions were sorted with every name hidden, and the checks against chance and a scrambled call graph.
The data on this page
One JSON file with every measurement the charts and tools above draw from (no source code).
Download the data (doom-dna-data.json)
Found something that doesn't add up? Open an issue on the GitGalaxy repository.