Mechalogodrom Docs — Report
A self-contained report on the Cosmogonic Quantum Mechalogodrom — a
deterministic, seeded WebGL ecosystem of up to 50,000 organisms across 10 phyla, 10 warring
4D-geometry titans, an always-active NHI super-creature, singularities that warp space-time,
an alien atmosphere, a unified 4-tab neural observatory, 25 visible sorting algorithms, and
six dramatic songs, served by Bun. This page is the local equivalent of a project GitHub
Page: it documents the file/folder architecture, the data model as an
explicit ERD / ERM / ERP triad, the per-frame process pipeline, and the
V1–V78 evolution of the system. The diagrams mirror the markdown sources in
docs/ARCHITECTURE.md and docs/ERD.md.
FSFile / folder architecture
The repository is a fullstack Bun project: one server entry, two bundled HTML shells, one
deliberately-unbundled lab artifact, and a strictly layered src/ tree where
leaf modules (math, constants, songs, logging, memory) never import the type hub at runtime.
Everything below is the real on-disk layout, one line of purpose per entry.
cosmogonic-quantum-mechalogodrom/ ├─ server.ts Bun.serve fullstack host: bundles /, /docs, serves /lab + /api/{health,audit} ├─ index.html the dome (/) — app shell, panels, observatory DOM, touch controls ├─ docs.html this report (/docs) — architecture, ERD/ERM/ERP, eras (mermaid inline) ├─ lab/ │ └─ quantum-wildbeyond.html self-contained p5.js lab, 4 pages of 3D data-visuals (CDN-only, not bundled) ├─ src/ │ ├─ main.ts browser entry: boots the World from index.html │ ├─ world.ts composition root: owns SimState, builds SimContext, ticks every system per frame │ ├─ types.ts the type hub — SimState, SimContext, TelemetrySnapshot, MorphType │ ├─ docs-page.ts this page's entry: initializes mermaid (dark theme) and renders the diagrams │ ├─ core/ │ │ ├─ engine.ts three.js renderer, scene, camera, lighting rig │ │ └─ quality.ts detectQuality — device tier ladder (phone..ultra), entity caps, throttles │ ├─ sim/ the simulation systems (V1 core + V2 wildbeyond + V3 pantheon + V4 atmosphere) │ │ ├─ constants.ts leaf — arena scale, behavior names, morph count, tuning tuples │ │ ├─ geometry-cache.ts 41 shared geometries reused across all meshes │ │ ├─ morphotypes.ts deterministic creature templates (100 legacy / 250 phylum-mode) │ │ ├─ phyla.ts 10 phyla — hue bands, geometry families, behavior pools, home sectors │ │ ├─ behaviors.ts 26 behavioral fields driving per-entity motion │ │ ├─ algorithms.ts 25 visible sorting-field algorithms, each a distinct spatial signature │ │ ├─ entities.ts EntityManager — births, deaths, behavior dispatch, RD scars on death │ │ ├─ instanced-entities.ts instanced PBR pools (per-instance color + emissive vec4) │ │ ├─ shoggoths.ts drifting Lorenz-ish predators with tendrils │ │ ├─ puppet-masters.ts 3 NPC intelligences gating quantum circuit sequences │ │ ├─ titans.ts 10 colossal economies waging an iterated prisoner's dilemma │ │ ├─ weather.ts weather state machine (CLEAR..FOG..STORM..VOID..AURORA) │ │ ├─ quantum.ts QuantumCloud — point cloud that implodes on register collapse │ │ ├─ qcircuit.ts QuantumCircuitSystem — gate sequences, bands to the cloud │ │ ├─ reaction-diffusion.ts Gray-Scott 128x128 field, ground emissiveMap │ │ ├─ graph-mind.ts graphology Louvain communities + PageRank over the connectome │ │ ├─ connectome.ts neural link graph between nearby entities │ │ ├─ constellations.ts d3-delaunay Voronoi sectors over fixed monolith sites │ │ ├─ lore.ts sha256-seeded name generator (sectors, tribes, stars, omens) │ │ ├─ analytics.ts simple-statistics windows — trend, z-omens │ │ ├─ atmosphere.ts alien sky dome, haze bands, particulate layer, aurora curtain │ │ ├─ viz3d.ts in-scene holographic data sculptures (phylum towers, titan obelisks) │ │ └─ environment.ts ground, light rig, audio-reactive shimmer │ ├─ math/ pure deterministic leaves (no three.js, fully bun-testable) │ │ ├─ rng.ts mulberry32 seeded Rng — the single source of all sim randomness │ │ ├─ scalar.ts clamp, lerp, TAU, dist2XZ and friends │ │ ├─ spatial-hash.ts uniform grid for neighbor queries │ │ ├─ quantum.ts QuantumRegister — 2^n complex amplitudes, gates, measurement │ │ └─ games.ts prisoner's-dilemma payoff + replicator-dynamics helpers │ ├─ audio/ │ │ ├─ songs.ts leaf — 6 dramatic songs (chords, melodies, character) │ │ ├─ engine.ts AudioEngine — WebAudio synthesis, sub-bass, arpeggios, LFO swells │ │ └─ analysis.ts AudioBands — AnalyserNode tap to bass/mid/treble/level │ ├─ ui/ │ │ ├─ input.ts keys, mouse look, zoom, touch joystick + radial wheel accumulators │ │ ├─ hud.ts heads-up readouts (sector, weather, algorithm, lore) │ │ ├─ panels.ts collapsible glass panels (telemetry, control, audit) │ │ ├─ graphs.ts Sparkline — small canvas time-series │ │ └─ observatory.ts 4-page, 16-canvas live data observatory │ ├─ logging/ │ │ ├─ logger.ts leaf ring logger (client + server) │ │ └─ audit.ts AuditTrail — fire-and-forget POST /api/audit │ ├─ memory/ │ │ └─ store.ts MemoryStore — persisted seed/song/sessions across reloads │ └─ styles/ │ └─ app.css responsive system — phone sheets, foldable, tablet, TV 10-foot ├─ docs/ │ ├─ ARCHITECTURE.md module graph + composition narrative (mirrors this page) │ ├─ ERD.md entity-relationship source for the diagram below │ ├─ MODULE-CONTRACTS.md binding per-module spec (V1..V6) — contract wins over vibes │ ├─ PHILOSOPHY.md aesthetic constitution — real math under every effect │ ├─ DESIGN-SYSTEM.md color, type, panel + wireframe conventions │ ├─ WIREFRAMES.md layout sketches for the dome + observatory │ ├─ COMPLEXITY.md per-system complexity budgets │ ├─ BENCHMARKS.md recorded hot-path measurements + ultra-tier calibration │ ├─ adr/ architecture decision records (Bun, three.js, HTMX, seeded rng, math stack) │ ├─ reference/ domain library catalog + math-libs survey │ └─ diagrams/ exported diagram assets ├─ tests/ 24 bun test suites — determinism, NaN-stability, per-system invariants ├─ bench/ 7 mitata micro-benchmarks for the hot paths ├─ masters/ 3 master persona XML files — Executor, Architect, Physicist (the discipline) ├─ legacy/ the original single-file artifact, preserved verbatim — never edited ├─ scripts/ │ └─ build.ts Bun build pipeline (HTML bundling + Tailwind) ├─ public/ static assets served as-is ├─ .github/workflows/ CI — the full check gate on push ├─ package.json deps + scripts (dev, check, bench) ├─ tsconfig.json strict TypeScript configuration ├─ bunfig.toml Bun config — Tailwind plugin wiring ├─ .prettierrc prettier — 100 cols, single quotes, semicolons ├─ CHANGELOG.md version history V1..V6 └─ README.md project overview + quickstart
SYSModule architecture
world.ts is the composition root: it owns the mutable SimState,
builds the SimContext dependency bag, and ticks every system each frame. Leaf
modules (math, constants, songs, logging, memory) never import the type hub at runtime.
Solid arrows are ownership/construction; dotted arrows are the cross-system writes that make
every subsystem read AND write another.
graph TD
subgraph SERVERL["Server"]
SRV["server.ts (Bun.serve)"]
IDX["index.html (/)"]
DOC["docs.html (/docs)"]
LAB["lab/quantum-wildbeyond.html (/lab, static p5.js)"]
RING["in-memory audit ring (200)"]
end
subgraph ENTRY["Entry and composition"]
MAIN["src/main.ts"]
WORLD["src/world.ts (composition root)"]
end
subgraph COREL["src/core"]
QUAL["quality.ts (detectQuality)"]
ENG["engine.ts (renderer, scene, camera)"]
end
subgraph SIML["src/sim (V1)"]
CONST["constants.ts (leaf)"]
GEO["geometry-cache.ts (41 shared geometries)"]
MORPH["morphotypes.ts (100 morphotypes)"]
ALG["algorithms.ts (25 sort fields)"]
BEH["behaviors.ts (26 fields)"]
ENT["entities.ts (EntityManager)"]
SHOG["shoggoths.ts"]
PUP["puppet-masters.ts"]
WEA["weather.ts"]
QUA["quantum.ts (QuantumCloud)"]
CONN["connectome.ts"]
ENV["environment.ts"]
end
subgraph SIMV2["src/sim (Wildbeyond V2)"]
QC["qcircuit.ts (QuantumCircuitSystem)"]
RD["reaction-diffusion.ts (Gray-Scott 128x128)"]
GM["graph-mind.ts (graphology louvain + pagerank)"]
CONS["constellations.ts (d3-delaunay)"]
LORE["lore.ts (sha256 lore)"]
ANA["analytics.ts (simple-statistics)"]
end
subgraph MATHL["src/math (leaves)"]
SCAL["scalar.ts"]
RNG["rng.ts (mulberry32)"]
GRID["spatial-hash.ts"]
QREG["quantum.ts (QuantumRegister)"]
end
subgraph AUDIOL["src/audio"]
SONGS["songs.ts (leaf)"]
AUD["engine.ts (AudioEngine)"]
BANDS["analysis.ts (AudioBands)"]
end
subgraph UIL["src/ui"]
INPUT["input.ts (keys, look, zoom)"]
HUD["hud.ts"]
PANELS["panels.ts"]
GRAPHS["graphs.ts (Sparkline)"]
end
subgraph PERSIST["src/logging + src/memory"]
LOGGER["logger.ts (leaf ring)"]
TRAIL["audit.ts (AuditTrail)"]
MEM["store.ts (MemoryStore)"]
end
SRV --> IDX
SRV --> DOC
SRV --> LAB
SRV --> RING
IDX --> MAIN
MAIN --> WORLD
WORLD --> QUAL
WORLD --> ENG
WORLD --> GEO
WORLD --> MORPH
WORLD --> ALG
WORLD --> ENT
WORLD --> SHOG
WORLD --> PUP
WORLD --> WEA
WORLD --> QUA
WORLD --> CONN
WORLD --> ENV
WORLD --> QC
WORLD --> RD
WORLD --> GM
WORLD --> CONS
WORLD --> ANA
WORLD --> AUD
WORLD --> BANDS
WORLD --> INPUT
WORLD --> HUD
WORLD --> PANELS
WORLD --> MEM
WORLD --> TRAIL
WORLD --> GRID
WORLD --> RNG
ENT --> BEH
BEH --> SCAL
BEH --> CONST
MORPH --> CONST
ENV --> CONST
PANELS --> GRAPHS
AUD --> SONGS
QC --> QREG
GM --> CONN
GM --> ENT
CONS --> LORE
BANDS --> AUD
QC -. "bands every 6f, collapse implodeAt" .-> QUA
RD -. "DataTexture as ground emissiveMap" .-> ENV
ANA -. "lore-named omens, abs(z) > 2.5" .-> TRAIL
PUP -. "PuppetEvent gate sequences" .-> QC
ENT -. "onDeath: rd.perturb at ground UV" .-> RD
GM -. "setCommunityOf tribe palette" .-> CONN
BANDS -. "bass: setAudioBass rig shimmer" .-> ENV
BANDS -. "treble: cell pulse" .-> CONS
BANDS -. "level: setBreath point size" .-> QUA
TRAIL -. "fire-and-forget POST /api/audit" .-> RING
IDX -. "HTMX GET /api/audit every 5s" .-> SRV
ERDData model — entity-relationship diagram
The ERD below is the formal entity-relationship diagram. Entities are
three.js meshes whose userData carries simulation state; each is stamped from
one of 100 (legacy) / 250 (phylum-mode) deterministic morphotypes, which in turn exhibits
one of 26 behavioral fields. Preferences persist across sessions; every user action lands in
the audit trail. Crow's-foot notation gives the cardinalities; the prose
ERM below restates them as a readable model.
erDiagram
MORPHOTYPE ||--o{ ENTITY : "stamps"
BEHAVIOR ||--o{ MORPHOTYPE : "drives"
PHYLUM ||--o{ MORPHOTYPE : "templates"
SHOGGOTH }o--o{ ENTITY : "consumes / corrupts"
PUPPET_MASTER }o--o{ ENTITY : "commands"
TITAN }o--o{ ENTITY : "harvests / conscripts"
WEATHER ||--o{ ENTITY : "perturbs"
PERSISTED_STATE ||--o| SONG : "selects"
PERSISTED_STATE ||--o{ AUDIT_EVENT : "chronicled by"
PUPPET_MASTER }o--|| QUANTUM_REGISTER : "gate signatures (rx / h+cz / x+swap)"
ENTITY }o--|| RD_FIELD : "deaths perturb at ground UV (onDeath)"
WEATHER ||--o{ RD_FIELD : "tunes feed / kill / diffusion"
TITAN }o--o{ TITAN : "iterated prisoners dilemma (45 pairs)"
TITAN ||--o{ AUDIT_EVENT : "war strikes chronicled"
GRAPH_TRIBE ||--o{ ENTITY : "members (setGroup write-back)"
GRAPH_TRIBE ||--|| LORE_NAME : "named (kind = tribe)"
CONSTELLATION_CELL ||--|| LORE_NAME : "named (kind = sector)"
PERSISTED_STATE ||--o{ LORE_NAME : "seed derives via sha256"
PUPPET_MASTER ||--o{ LORE_NAME : "epithets in toasts"
SONG ||--o{ AUDIO_BANDS : "spectrum via AnalyserNode tap"
AUDIO_BANDS }o--o{ CONSTELLATION_CELL : "treble pulses cell edges"
ENTITY }o--|| ANALYTICS_WINDOW : "population sampled every 8th frame"
ANALYTICS_WINDOW ||--o{ AUDIT_EVENT : "omens when abs(z) > 2.5"
ANALYTICS_WINDOW }o--o{ LORE_NAME : "omens named via nameOmen"
ENTITY {
int mi "morphotype index 0..99"
vec3 vel
float age
float life
float sortVal "sorting-field value"
float nW "neural weight"
float energy "market wealth 0..100"
int setGroup "set-theory group, tribe-rewritten"
}
MORPHOTYPE {
int id "0..99 legacy, 0..249 phylum"
int gi "geometry cache index"
color col
color em
string beh "one of 26 behaviors"
}
PHYLUM {
int index "0..9"
float hueBand "slice of the hue wheel"
string homeSector "preferred constellation cell"
}
BEHAVIOR {
string name "26 fields, legacy order"
}
SHOGGOTH {
vec3 drift "lorenz-ish"
int tendrils
}
PUPPET_MASTER {
string name "AETHON or SELENE or KRONOS"
string action
}
TITAN {
string name "lore-named colossus 0..9"
float energy "economy wealth"
float matter "harvested mass"
float entropy "waste, vented as ground scars"
string strategy "one of 5 dilemma strategies"
}
WEATHER {
string kind "CLEAR..FOG"
float wind
float temperature
}
SONG {
string name
int bpm
string wave
}
AUDIT_EVENT {
float ts
string action
json detail
}
PERSISTED_STATE {
int version
int seed "mulberry32 seed, key to the mythology"
int songIdx
int sessions
}
QUANTUM_REGISTER {
int qubits "5 in the sim (1..8 enforced)"
float64array amps "2^n complex amplitudes"
float entropy "normalized Shannon, telemetry v11"
int lastCollapse "last measured basis, -1 if none"
}
RD_FIELD {
int size "128 (Gray-Scott grid side)"
float32array u "activator, ground emissiveMap"
float32array v "inhibitor (ping-pong)"
float feed "raised by STORM"
float kill "raised by VOID"
float diffusion "boosted by AURORA"
}
GRAPH_TRIBE {
int index "seeded louvain community (240f)"
int memberCount "entities carrying it in setGroup"
float hue "slot in the 8-hue link palette"
float pagerank "600f offset 300, top-20 emissive floor"
}
CONSTELLATION_CELL {
vec2 site "monolith/diorama XZ (24 fixed sites)"
polygon region "voronoi cell, edges at y about 55"
string loreName "sub-sector shown in the lore line"
}
LORE_NAME {
string kind "sector, tribe, star, omen"
int index "digest input, memoized"
string name "syllables from sha256(seed,kind,index)"
}
AUDIO_BANDS {
float bass "0..1 setAudioBass rig shimmer"
float mid "0..1"
float treble "0..1 constellation pulse"
float level "0..1 setBreath cloud point size"
}
ANALYTICS_WINDOW {
ring population "120 samples, every 8th frame"
ring energy "120 samples"
ring links "120 samples"
float trendPerMin "regression slope, telemetry v10"
float zThreshold "2.5, one omen per 30 s max"
}
ERMData model — entity-relationship model
The ERM restates the diagram above as a readable model: each entity, its
defining attributes, and the relationships it participates in with explicit cardinalities.
The seed is the keystone — PERSISTED_STATE.seed deterministically derives
the entire mythology (morphotypes, phyla, lore names) through the injected Rng and the
sha256 lore engine. Read the cardinality column as “one X relates to N Y”.
| Entity | Key attributes | Relationships (cardinality) |
|---|---|---|
| ENTITY | mi, vel, age, life, sortVal, nW, energy, setGroup | stamped by 1 MORPHOTYPE (N:1); member of 0..1 GRAPH_TRIBE; perturbs 1 RD_FIELD on death; sampled by 1 ANALYTICS_WINDOW |
| MORPHOTYPE | id, gi, col, em, beh | stamps N ENTITY (1:N); templated by 1 PHYLUM (N:1); driven by 1 BEHAVIOR (N:1) |
| PHYLUM | index 0..9, hueBand, geometry family, behavior pool, homeSector | templates N MORPHOTYPE (1:N) — 25 morphotypes per phylum in phylum-mode |
| BEHAVIOR | name (26 legacy-ordered fields) | drives N MORPHOTYPE (1:N) |
| TITAN | name, energy, matter, entropy, strategy | harvests/conscripts N ENTITY (M:N); plays 9 other TITAN in the 45-pair dilemma (M:N); war strikes chronicled by AUDIT_EVENT |
| PUPPET_MASTER | name (AETHON/SELENE/KRONOS), action | commands N ENTITY (M:N); owns gate signatures on 1 QUANTUM_REGISTER (N:1); names epithets from LORE_NAME |
| SHOGGOTH | drift (lorenz-ish), tendrils | consumes/corrupts N ENTITY (M:N) |
| WEATHER | kind, wind, temperature | perturbs N ENTITY (1:N); tunes feed/kill/diffusion of 1 RD_FIELD (1:N) |
| QUANTUM_REGISTER | qubits, amps (2^n), entropy, lastCollapse | gated by N PUPPET_MASTER (1:N); collapse implodes the QuantumCloud |
| RD_FIELD | size 128, u, v, feed, kill, diffusion | scarred by N ENTITY deaths; tuned by 1 WEATHER; ground emissiveMap of ENV |
| GRAPH_TRIBE | index, memberCount, hue, pagerank | has N ENTITY members (1:N); named by 1 LORE_NAME (1:1, kind=tribe) |
| CONSTELLATION_CELL | site, region (voronoi), loreName | named by 1 LORE_NAME (1:1, kind=sector); pulsed by AUDIO_BANDS treble (M:N) |
| LORE_NAME | kind, index, name (sha256 syllables) | derived from 1 PERSISTED_STATE seed (N:1); names tribes, sectors, stars, omens |
| SONG / AUDIO_BANDS | name, bpm, wave / bass, mid, treble, level | selected by PERSISTED_STATE (1:1); SONG yields N AUDIO_BANDS via AnalyserNode tap |
| ANALYTICS_WINDOW | population/energy/links rings (120), trendPerMin, zThreshold 2.5 | samples N ENTITY (every 8th frame); emits AUDIT_EVENT omens when abs(z) > 2.5 |
| PERSISTED_STATE | version, seed, songIdx, sessions | selects 1 SONG (1:1); chronicled by N AUDIT_EVENT (1:N); the seed root of all derived entities |
ERPProcess model — entity-relationship / process
The ERP is the process view: how those entities and relationships are
animated in one requestAnimationFrame tick. The tick is clamped to 50 ms
and scaled by timeScale. The spatial grid rebuilds every 2nd frame, telemetry
refreshes every 8th, sparklines redraw every 18th. The Wildbeyond V2 systems run on
documented cadences: quantum circuit every 30th frame (bands to the cloud every 6th),
reaction-diffusion every 2nd frame offset 1 from the grid rebuild, Louvain every 240th,
PageRank every 600th at offset 300 (so the two graph passes never share a frame), analytics
push every 8th and analyze every 60th. The renderer's matrix-sync pass runs LAST, so every
emissive tint, rank floor and conscription recolor settles before the draw.
sequenceDiagram
participant RAF as rAF
participant W as world.ts
participant SYS as sim systems
participant V2 as wildbeyond V2
participant G as SpatialHash
participant UI as ui/*
participant R as Engine
RAF->>W: tick (dt = min(delta, 0.05) * timeScale)
W->>W: camera (free/orbit/fly/top), consume look/zoom
W->>V2: audio bands poll (every frame, O(128))
W->>SYS: weather.apply / puppetMasters.update
W->>G: clear + insert all entities (every 2nd frame)
W->>SYS: shoggoths.update
W->>SYS: sort step ALGOS[algoIdx], swaps feed qcircuit.onSortSwap
W->>SYS: entities.update — 26 behaviors, deaths scar the RD field
W->>SYS: titans.update — economy ticks, diplomacy slot, war strikes
W->>SYS: connectome.update (every 1/2/3 frames by n)
W->>V2: qcircuit.update (every 30th, bands to cloud every 6th)
W->>SYS: quantum.update (cloud, implodeAt on collapse)
W->>V2: rd.step (every 2nd frame, offset 1)
W->>V2: graphMind communities (every 240th) / rank (every 600th, offset 300)
W->>V2: constellations.update (every frame, O(1) pulse)
W->>SYS: atmosphere.update + viz3d.update (cadenced)
W->>SYS: environment.update (setAudioBass rig shimmer)
W->>UI: telemetry snapshot + analytics.push (every 8th frame)
W->>V2: analytics.analyze (every 60th frame)
W->>R: render(scene, camera)
Process narrative
Each frame is a fixed sequence of reads and write-backs. Input is consumed first (camera +
look/zoom), then the world drives the actors: weather and puppet-masters set the mood, the
spatial hash rebuilds so neighbor queries are cheap, predators and the active sorting
algorithm reorganize the field, and entities.update runs the 26 behaviors
— a death here scars the reaction-diffusion field at the dying entity's ground UV.
Titans tick their economies and play one diplomacy pair. The Wildbeyond systems advance on
their staggered cadences (the offsets are chosen so no two heavy passes share a frame),
audio bands feed the cloud and the constellations, analytics samples the population and may
raise a lore-named omen into the audit trail. The renderer's sync pass — which calls
updateMatrix() for the instanced pools — runs last, so the draw reflects
every tint and transform decided earlier in the frame. Because every randomness source is
the injected seeded Rng and all heavy work is cadence-gated, the entire process is
reproducible from a single seed.
LOGThe eras
The system grew in many contract-governed waves. Each era is a binding section in
docs/MODULE-CONTRACTS.md; the later eras (V5 onward) are direct user-feedback
passes. Exclusive file ownership and a strict bun run check gate hold across
all of them.
V1 — Sim core (genesis)
The deterministic foundation: an EntityManager of three.js meshes stamped
from 100 morphotypes exhibiting 26 behavioral fields, a shared 41-geometry cache, shoggoth
predators, three puppet-master NPCs, a weather state machine, a quantum point-cloud, a
neighbor connectome, and a spatial hash. All randomness already flows through the seeded
mulberry32 Rng; the world is reproducible from frame one.
V2 — Wildbeyond (emergence)
Six emergent systems layered on top: a QuantumCircuitSystem of real gate
sequences, a Gray-Scott reaction-diffusion field painted onto the ground as an emissive
map, a graph-mind running graphology Louvain communities + PageRank over the connectome,
d3-delaunay constellations, a sha256-seeded lore engine naming sectors and tribes, and
simple-statistics analytics that raise z-score omens. Every system reads one neighbor and
writes another — deaths scar diffusion, collapses implode the cloud, omens enter the
audit trail.
V3 — Pantheon (0.3.0)
The taxonomy gains a layer above morphotypes: 10 phyla (hue bands, geometry families, behavior pools, home sectors) minting 250 morphotypes, and 10 colossal titans running a global economy and waging an iterated prisoner's dilemma over all 45 pairs — staggered so at most one pair plays per frame, full coverage every 600-frame cycle. Arena scale split into three knobs; instanced PBR pools carry per-instance emissive; the snapshot unified for the panel and observatory.
V4 — Xenogenesis (0.4.0)
Atmosphere and analytics-in-depth: an alien sky dome with drifting haze bands, a
particulate air layer and an aurora curtain (atmosphere.ts); in-scene
holographic data sculptures — phylum population towers and titan economy obelisks
(viz3d.ts); a four-page observatory (variance, ecology, conflict) over 16
canvases; and true touch controls (look pad + radial action wheel) responsive from phone
to 43-inch TV. A later amendment introduced the adaptive
targetEntities steady state distinct from the hard ceiling, recovering the
55fps target.
V5 — Resonance (0.5.0)
The first user-feedback pass: observatory pages relabeled and made bold and legible (in-canvas titles, axes, legends); all six songs raised to the QUANTUM / BLACK MERIDIAN tier with sub-bass, arpeggios and filter swells; the sorting algorithms restored to 25 genuinely distinct spatial signatures; the p5.js lab filled with live readouts; and the panels turned into edge-docked slide-out sheets for portrait and touch ergonomics.
V6 — Atelier (0.6.0)
The second user-feedback pass, focused on space and craft: per-chart layout with reserved title bands so labels never overlap data; a wider, taller observatory plus a scrollable algorithm picker panel; the lab grown into four pages of 3D data-visual boards; and this report page — the local GitHub-Page-style document you are reading, with the full file/folder tree, the explicit ERD / ERM / ERP triad, and these era narratives.
V7–V78 — The Living Era (0.7.0 → 0.10.0, current)
Twelve further contract-governed waves, all additive behind the full gate with same-seed
determinism preserved. Xenocataclysm (0.7.0) brought the world alive: 100
seeded sound effects, five render modes, cosmological singularities and dramatic weather.
Hardening (0.8.0) added the binary heap, CodeQL/Dependabot governance and
the ERM/ERP docs. AGImAGNOSIS (0.9.0) gave the world minds — a
pre-transformer classical-AI kernel (FSM, GOAP, utility AI, tiny MLPs, Markov), a
heritable genome + lineage, eight faction archetypes, NHI mini-AIs, and a read-only
Copilot fenced out of the seeded sim. The
Living Era (0.10.0, V10–V78) grew a two-currency game-theoretic
economy, a native C++/Jolt engine, per-entity neural controllers scaling to 50,000
organisms, and the always-active Super Creature: a ~10,081-parameter
composite mind plus a real 6-qubit quantum-computing register
(src/sim/super-qubits.ts). Singularities now warp space-time behind a
gravitational-lens post-FX; CHAOS MODE imposes a Lorenz quantum storm; the apex levels to
100 and raises an ascension temple; the titans became 4D freak-geometry; and the HUD was
re-wireframed around a unified 4-tab / 27-visual + BRAIN neural observatory.
TECHTech stack
Every dependency earns its place with real math under it — the aesthetic constitution
in
docs/PHILOSOPHY.md forbids decorative-only effects. Decisions are recorded as
ADRs in docs/adr/.
| Layer | Choice | Role |
|---|---|---|
| Runtime | Bun | fullstack server, HTML bundler, test runner, bench host (ADR 0001) |
| Language | TypeScript (strict) | no any, no ts-ignore; leaves stay three.js-free for bun test |
| Rendering | three.js 0.184 | WebGL scene, instanced PBR pools, sky dome, data sculptures (ADR 0002) |
| UI | HTMX + Tailwind CSS | audit feed polling, glass panels, responsive sheets (ADR 0003) |
| Graph | graphology (+ louvain, metrics) | connectome communities + PageRank for the graph-mind |
| Geometry | d3-delaunay | Voronoi constellation sectors over fixed monolith sites |
| Statistics | simple-statistics | analytics windows — regression trend, z-score omens, stddev (ADR 0005) |
| Hashing | @noble/hashes (sha256) | seeded lore name generation |
| Noise | simplex-noise | drift fields and atmospheric advection |
| Docs | mermaid 11 | the ERD / module / sequence diagrams on this page |
| Fonts | Inter Variable + JetBrains Mono | self-hosted via fontsource |
| Tooling | prettier + oxlint + bun test + mitata | the full check gate: format, lint, test, bench, build |
DETDeterminism model
The simulation never calls the built-in unseeded random source: all randomness flows through
an injected mulberry32 Rng seeded from persisted state, so any run is
reproducible from its seed. Math.random and Date.now are banned in
sim logic. See docs/adr/0004-deterministic-rng.md.
Seeded Rng
One mulberry32 stream, drawn in a fixed documented order. The seed lives in
PERSISTED_STATE and derives morphotypes, phyla and lore names
byte-for-byte. Sub-streams (titan diplomacy, audio) fork the Rng so they never
interleave.
Cadence gating
Heavy passes draw Rng only on frame cadences (boot, economy ticks, diplomacy slots),
never on the per-frame animation path — that path is pure trigonometry of
(t, phase). Offsets are chosen so no two stochastic passes share a frame.
Allocation-free hot paths
Per-frame loops reuse module scratch vectors and reused snapshot objects; ledger entries and perturb requests are reused. No garbage means no GC jitter and no nondeterministic timing in the measured loop.
Frozen-reference tests
tests/ pins backward-compat snapshots (e.g. the legacy 100-morphotype
population) and NaN-stability over thousands of frames. Ultra-only throttles are gated
so the ≤5,000 stream stays byte-identical and every determinism test is untouched.
PERFPerf / tier ladder
detectQuality() picks a device tier at boot; the tier sets the entity ceiling,
the adaptive steady-state target, and a set of throttles. The hard ceiling sizes every
buffer (instanced pools, index tables, atmosphere Rng-draw count) and stays reachable via
user bursts and apocalypse; organic growth relaxes back toward the target. Full per-stage
measurements live in docs/BENCHMARKS.md.
| Tier | Hard ceiling | Steady target | Notes |
|---|---|---|---|
| phone | low cap | = ceiling | panels become slide sheets; viz3d bar counts halved; throttled observatory |
| laptop | mid cap | = ceiling | full responsive layout, no ultra throttles |
| desktop | high cap | = ceiling | full detail, 55fps budget |
| ultra | 10,000 | adaptive (6,500 idle) | ultra-only throttles (theory stride 2→3, half-rate flock, grid cell 10, connectome /4 and /6); 10k reachable as bounded worst case |
Acceptance across eras: ultra 10k ≥55fps at the idle target with GPU headroom, phone tier ≥30fps, zero console errors over a 3-minute soak including a forced war + apocalypse, and same-seed determinism preserved throughout.