at canon
2 folders
4 files
First pass impl of breeder grid
Opus 4.8's description:
On load you get a 3×3 grid. Each cell warms to its converged frame and freezes. Hover a cell → only that one animates (the rest stay still);
move away → it freezes at its new state. Click a cell → it opens full-screen with a top bar: ← Back to grid and Breed from this →. The editor panels (Controls / Genome / Lineage) appear only in focus. Breeding spawns that organism's children as the next grid; Back just returns to the (cached, frozen) grid.
Fidelity is structural, not approximate: thumbnails are the same resident sim at the same pins (1024²/512², same seed) as the full-screen view — just rendered into a small texture and downscaled-to-fit. The preview can't drift from the actual because there's only one sim.
Files
- engine/shaders/blit.{vert,frag} — a vUv-varying blit so a thumbnail composites correctly into any sub-viewport (the existing display shader's gl_FragCoord/uViewport math breaks in sub-rects). glutil.createColorTarget (RGBA8/LINEAR) backs the thumbnails.
- engine/Engine.ts — mode: single|grid; setGeneration / setHover / setMode / warmup / setOnBuildDone. Grid frame builds one candidate per frame (warm→capture, a brief reveal), animates the hovered tile live, and renderGrid blits letterboxed squares. One resident sim, time-sliced — zero new shader math beyond the blit.
- evolution/spawn.ts (pure) — freshGenome / randomGenomes / spawnChildren; genome.svelte.ts now reuses freshGenome.
- state/generation.svelte.ts — CPPNs + compiled rules held non-reactively (Maps/typed-arrays never proxied), reactive nonce/size/cols/building; generationSpecs() is the orchestrator pull.
- ui/BreederGrid.svelte — transparent hit-target overlay (grid) + focus top bar. view.mode = grid|focus.
- App.svelte — grid-first; a generation $effect pushes specs to the engine; the genome $effect is gated to focus so leaving the grid never disturbs cached thumbnails.
Known v1 wrinkles (by design, flagged earlier)
- Hover re-warms on tile switch (~sub-second) since there's one resident sim. The instant-hover upgrade (per-tile GPU state, ~290 MB) is noted in memory if it ever annoys you.
- Breeding compiles 9 genomes synchronously (~0.2–0.5 s freeze) before the "evolving…" reveal. Async-compile is a later polish.
- Grid hover-highlight is a full-cell tint; the thumbnail is a centered square inside it — close but not pixel-aligned.