Skip to content

DOOM study write-up: lineage survival vs linuxdoom across all ports + cross-language subsystem comparison (engine metric calibration) #5620

Closed

Description

@squid-protocol

Goal

Produce the analysis the DOOM study was for: how much of id Software's 1997 linuxdoom survives in each port, how ports diverge, and how the same subsystems look across languages. It doubles as an engine check: are GitGalaxy's metrics comparable across languages? (If a Go or COBOL renderer scores wildly differently from the C original for the same algorithm, that is an engine calibration finding.)

Inputs

  • Corpus: tests/tools/doom_speedrun/manifest.csv (39 ports; moving to tests/doom_crucible/ with DOOM-rosetta: golden-gated CI regression test over the DOOM port corpus (measurements-only golden, zero drift, sharded, nightly oracles) #5619) plus the ports added by the manifest-expansion issue (COBOL, Python, SQL, web...).
  • Round-1 method (16 ports, C-family only, engine a8510fc07), local on nyx at /srv/storage_16tb/projects/gitgalaxy/doom-study/scripts/survival.py + canonical.py: function bodies sliced by engine boundaries, normalised, sha1 + difflib similarity vs linuxdoom's 659 functions, per subsystem (renderer, playsim, menus, netcode, ...). Example result: chocolate-doom keeps 86.6% of linuxdoom function names, 35.1% exact bodies; doomretro 68.9% names, 0.2% exact.

Work

  1. Port the round-1 scripts into the repo as our own tool (tests/tools/doom_speedrun/lineage.py or under tests/doom_crucible/), reading the harness scans; rerun on all ports at current main.
  2. Lineage table: per port, survival of linuxdoom names / exact bodies / near (>=0.9) / derived (>=0.6), per subsystem; checked against each port's stated lineage in the manifest (does Chocolate -> Crispy -> inter-doom show monotone drift? do rewrites show ~0 exact bodies but high name survival?).
  3. Cross-language: map subsystems by file/function-name families (r_* renderer, p_* playsim, m_* menu...), then compare per subsystem across C / C++ / C# / Java / Go / Rust / COBOL / Python: function count, LOC, cyclomatic complexity, call fan-out. Report where the engine's metrics are comparable and where they are not, with the language-specific reason; file an engine issue for each calibration defect found.
  4. Write-up: docs/research/doom-port-study.md, measurements only (third-party policy: no code, no reconstructions, brief quotes with attribution), every number reproducible by one command; per-port clean-scan table before/after the fixes (round 2 585c243e9 -> current).

Acceptance

  • One command regenerates every table from the pinned corpus.
  • Lineage for all C-family ports + name-level lineage for the rewrites; cross-language subsystem table including at least C, C++, C#, Java, Go, Rust, and COBOL/Python once added.
  • Calibration findings filed as issues (or "none found", with the evidence).

Part of #5457.

🤖 Generated with Claude Code

Activity

  1. added
    enhancement
    metrics
    scope:frontier
    needs:doom-corpus
    on Oct 19, 2026
  2. squid-protocol commented on Oct 19, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host nyx, lease renewed 2026-10-23T00:21Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:nyx label.

  3. squid-protocol commented on Oct 19, 2026

    @squid-protocol
    OwnerAuthor

    Scope addition (owner, 2026-10-19): distributions around the original, behavioural equivalence, deep-dive post

    First pass (licensed ports only, 40 code ports, engine 0e2bf4ade/29349f079, whole-repo function distributions):

    • The population does not centre on the original. linuxdoom sits at about the 90th percentile of per-port medians for complexity (3 vs population 2), function length (21 vs 15.5 lines) and token mass (130 vs 100); fan-out and argument count are at the median. Descendants in every language have smaller, simpler functions: drift is decomposition, not random scatter.
    • A distance from linuxdoom (Wasserstein over complexity, LOC, fan-out, token mass and args, normalised by linuxdoom's spread) roughly recovers lineage untold: lightly modified C (PureDOOM 0.08, doom-ascii, sdl-doom, doomgeneric, doom3do ≤ 0.14) < Chocolate/Crispy/PrBoom-family (0.17–0.24) < large modern engines and from-scratch rewrites (gzdoom 0.50, doomsday, helion, rust-doom 0.41–0.47).
    • Faithfulness beats language: managed-doom (C#, 0.20) and dartdoom (Dart, 0.21) sit closer to the original than C descendants doomretro (0.43) and fastdoom (0.31).
    • Language signatures: Kotlin/Java/Rust ports have ~5-line median functions; the Fortran 77 port has 36% of routines at complexity ≥ 10 (linuxdoom 20%).

    Add to this issue:

    1. Distribution module in the study tool: per port × metric (complexity, LOC, fan-out, fan-in, args, token mass, nesting, the risk signals), quantiles + distance to the original; plots with the original as a marked black point/line and the population around it (strip/violin per metric, ports ordered by lineage; distance vs lineage depth); outlier list per metric with the reason. Do it per matched subsystem (renderer, playsim, menu, WAD/IO) as well as whole-repo, so feature growth doesn't masquerade as drift.
    2. Calibration question, stated explicitly: for faithful translations (managed-doom, dartdoom, kocoa-doom, mochadoom, doom-scheme, doomf77), how much of the metric shift is the language vs the engine's per-language rules? Each defect found → its own engine issue.
    3. Behavioural equivalence (feasibility first, then a subset): DOOM demos (.lmp input recordings) replay tic-exactly only if game logic matches, so "plays the same demo in sync" is an objective same-output class. Check which licensed ports support demo playback/timedemo/statdump headless, whether Freedoom (BSD) provides demos usable for this (no commercial IWADs), and run the C ports that build easily. Then ask: how much structural distance is compatible with tic-identical behaviour?
    4. Deliverable: a deep-dive wiki post, the quantitative sequel to docs/wiki/03-07-claim-7-doom-comparisons.md ("Tracking the Genetic Drift of DOOM"): measurements only, licensed ports only, every number reproducible by one command.

    Script for the first pass is local on nyx (/srv/storage_16tb/projects/gitgalaxy/doom-study/dist.py); fold it into the study tool rather than committing it as is.

    🤖 Generated with Claude Code

  4. squid-protocol commented on Oct 19, 2026

    @squid-protocol
    OwnerAuthor

    Scope update (owner, 2026-10-19): call-graph "subway maps"; no byte-for-byte work

    Drop the demo-sync / behavioural-equivalence step. Take each port's own stated stance on fidelity from its README/docs (vanilla-exact, demo-compatible, limit-removing, enhanced, rewrite) as a manifest column, and cite it where it matters. We don't run behavioural tests ourselves.

    Add: call-graph network comparison. Each port's function call graph (engine calls_out_to, resolved by name inside the port) collapsed into DOOM subsystems (renderer, playsim, game, main, menu/misc, hud, automap, intermission, finale, sound, video, wad, zone, system, net, other), and drawn as a "subway map" on linuxdoom's fixed layout (same station positions for every port, station size = functions, line width = share of calls), so 40 maps can be compared by eye. A function goes to the subsystem of the linuxdoom function with the same normalised name where names survive, otherwise by file/path.

    First pass (licensed ports, prototype):

    • C descendants keep linuxdoom's wiring almost exactly: subsystem-call similarity (cosine of the subsystem call matrix) 0.95–0.99 for doom-ascii, sdl-doom, doomgeneric, PureDOOM, Chocolate, Crispy; 85–100% of linuxdoom's call edges survive by name.
    • Faithful translations keep the wiring across languages: doom-scheme (Scheme) 0.94, dartdoom (Dart) 0.94, doomf77 (Fortran 77) 0.92. managed-doom (C#) keeps 0% of linuxdoom's call edges by name (everything renamed into classes) but 0.71 at subsystem level: the subway map shows similarity that names hide.
    • Modern engines and rewrites rewire: gzdoom 0.47, doomsday 0.34, room4doom 0.44, rust-doom 0.13; doom3-bfg 0.26 (a different engine with a classic-DOOM subtree). Large engines grow a big "other" station (scripting VMs, new features), which is partly real and partly the subsystem mapper's limit.
    • Structure vs wiring: the function-metric distance and the subway similarity are clearly related (drift in one goes with drift in the other), with informative exceptions: doomretro and helion are far in function shape but close in wiring (0.82, 0.81); doom3do is close in function shape but less so in wiring (0.79).

    Work for this issue:

    1. Call-graph module in the study tool: per-port graph metrics (nodes, edges, mean degree, largest component share, clustering, hub concentration), name-level edge survival vs linuxdoom, subsystem call matrix + similarity, the anchored subway-map small multiples (all licensed ports, ordered by lineage), and structure-vs-wiring scatter.
    2. Make the subsystem mapper robust and documented (per-port overrides where folder names say it plainly, e.g. Render/, World/), report the mapped share per port, and treat a large "other" as a finding to explain, not noise.
    3. Also try a layout-free comparison (e.g. graph-level embeddings or spectral distance) to check the subway similarity isn't an artefact of the mapping.
    4. Fold into the deep-dive post as its central figure.

    Prototype script and images (local on nyx): /srv/storage_16tb/projects/gitgalaxy/doom-study/study-prototype/ (callmaps.py, subway_maps.png, structure_vs_wiring.png).

    🤖 Generated with Claude Code

  5. squid-protocol commented on Oct 21, 2026

    @squid-protocol
    OwnerAuthor

    Scope update (owner, 2026-10-21): the call-graph / subway-map work lives in structural-fingerprint-scanner

    The 2026-10-19 call-graph scope ("subway maps") is built as sfs subway in squid-protocol/gitgalaxy-population-analyses (structural-fingerprint-scanner/, squid-protocol/gitgalaxy-population-analyses#17 and squid-protocol/gitgalaxy-population-analyses#18). Do not port study-prototype/callmaps.py into this repo: slice 3 in the handoff is dropped. The write-up takes its subway figures and tables from sfs output.

    What the scope asked for, and where it now stands:

    2026-10-19 ask Status
    Per-port graph metrics (nodes, edges, mean degree, largest component, clustering, hub concentration) done (subway.csv / subway.json)
    Name-level edge survival vs linuxdoom done: "calls kept". It uses structural twins as well as names, and tolerates duplicate names (ports that ship a generated single header beside their sources)
    Subsystem call matrix and similarity done: "wiring"
    Anchored subway-map small multiples, all licensed ports, ordered by lineage done (--declared-lineage orders them depth-first from linuxdoom)
    Structure-vs-wiring scatter done
    Robust, documented subsystem mapper with per-port overrides; mapped share per port; large "other" as a finding done: placement by twin, then name, then path; per-port overrides in examples/doom/subsystems.json; the "other" share is reported per port
    Layout-free check that subway similarity isn't a mapping artefact done: graph-shape distance (mapping-free). On 42 ports, Spearman ρ = −0.77 between wiring similarity and graph-shape distance from linuxdoom (p = 2×10⁻⁹)
    Fold into the deep-dive post open (write-up)

    Headline results (licensed ports, engine 9f213ab83), from examples/doom/README.md there:

    • Translations rewrite every measurement, so structural descent sees ~0, but they keep linuxdoom's call wiring: gore (Go) keeps 77% of linuxdoom's calls, doom-scheme 49%, dartdoom 41%, mochadoom (Java) 35%.
    • doom3-bfg ships DOOM Classic converted to C++ (doomclassic/doom/). Twin matching fails on it, but 83% of the calls survive.
    • Per-port overrides lift Mocha/Kocoa Doom's wiring similarity from 0.59 and 0.52 to 0.81 and 0.75; their single-letter packages had hidden it.

    Still in this issue (unchanged): slice 2 distribution.py (queued), slice 4 the manifest fidelity column, the cross-language subsystem tables and calibration findings, and the write-up docs/research/doom-port-study.md. Reproduce the subway figures with:

    sfs compare <scans> -o report --declared-lineage examples/doom/declared_lineage.csv \
      --subway-reference linuxdoom --taxonomy examples/doom/subsystems.json

    🤖 Generated with Claude Code

  6. squid-protocol commented on Oct 23, 2026

    @squid-protocol
    OwnerAuthor

    Acceptance met by #5714, #6067, #6077, #6094: one command (study_report.py --write/--check) regenerates the tables; lineage and cross-language tables are in docs/research/doom-port-study.md; calibration findings (Scheme case, Dart break/continue; Go none found) are tracked in #6097.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claim:nyxenhancementmetricsneeds:doom-corpuspriority: mediumscope:frontier

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions