Evolution model #
How a Fluodditylike is encoded, varied, and selected. Companion to
cppn_picbreeder_design.md (the indirect-encoding rationale) and v0_normalization.md
(the substrate). This document is the canonical reference for the genotype→phenotype map
and the breeding loop — read it before adding any new source of variation.
Genotype → phenotype pipeline #
CPPN genome ──[compile: random-feature least-squares refit]──► 244-float rule ──[engine]──► dynamic phenotype
(graph) (lossy, deterministic per genome) (plane waves) (stochastic sim)
+
morphology vector (10 scalars) ─────────────────────────────────────────────────────────┘
- CPPN (
genome/cppn.ts) — a small DAG of typed-activation nodes (identity/sin/gauss/abs/ tanh) mapping the 4D sensor reading(L,R) → (force, strafe). This is locus A, the genome. - Compile (
genome/compile.ts) — samples the CPPN over the 4D input domain, picks random cosine features, and least-squares fits the 4 outputs to the 244-float plane-wave rule. It is lossy (fitError) and deterministic per genome (feature RNG seeded byCOMPILE_OPTS.seed, default 7). A child's rule differs only because its genome differs. - Morphology (the 10 v0 dynamics scalars, split organism/environment per
v0_normalization.md) — see "Two loci" below. - Phenotype — a dynamic, stochastic field. Unlike Picbreeder's static images, judging a candidate means watching it evolve, and same-genome/different-seed varies. This raises the cost and noise of selection (see "Why pure selection strains here").
The single variation operator #
There is exactly one: CPPN.mutate() (cppn.ts). Everything novel routes through it —
the Mutate button, breeding (spawnChildren), and fresh lineages (freshGenome =
minimal() + 20× mutate). Default behaviour per call:
| op | rate | effect |
|---|---|---|
| perturb weight | p=0.8 / enabled conn | weight += N(0, 0.5) (dominant effect) |
| perturb bias | p=0.2 / non-input node | bias += N(0, 0.3) |
| mutate activation | p=0.1 / non-input node | replace with a random activation (the CPPN part) |
| add connection | p=0.15 | random valid acyclic src→dst, weight N(0,1) |
| add node | p=0.08 | split an enabled conn: disable it, insert hidden node, src→new=1.0, new→dst=original (function-preserving — the NEAT trick) |
Breeding = interactive evolutionary computation (IEC) #
Selection is the human, not a fitness function. The loop (state/generation.svelte.ts,
evolution/spawn.ts, ui/BreederGrid.svelte):
- First grid:
randomGenomes(9)— nine independentfreshGenomelineages (diverse spread). - Inspect: hover a tile to animate it; click to view it full-screen.
- Select & breed: "Breed from this" makes the focused organism the parent;
spawnChildren([parent], 9)callsparent.mutate()nine times → nine single-step variants. Two selected parents →a.crossover(b).mutate(). - Repeat. The DAG of saved selections is the lineage (
parents[], never rewritten).
Note the application topology: the Mutate button walks a chain (current = current.mutate());
breeding makes a star (nine children off the unchanged parent). Same operator, both ways.
Two loci: rule (CPPN) vs morphology (direct) — and why #
The rule is indirectly encoded (CPPN). The morphology vector is directly encoded: it lives
as plain scalars in the record (Morphology) and in the live organism store, and is varied by
a small Gaussian operator (evolution/morph.ts, mutateMorph) with per-parameter sigmas that
are operator config, not record fields (sigma 0 = a fixed gene). Sensor angle/distance carry the
largest sigmas — they're the sensitive shape controls.
Why direct (D) and not CPPN-encoded (A) — for now #
We considered making morphology extra CPPN output heads read at a canonical query point ("Option A"), which keeps everything under the one mutate operator and gives pleiotropy (rule and body co-vary coherently — very Picbreeder). We chose direct embedding ("Option D") because of a mechanical fact:
Manual control ⟺ direct embedding. You cannot hand-tune a parameter that is a CPPN output without storing an override — and an override is a direct gene. So keeping the morphology sliders live (the "tuning shapes the patterns" workflow) already commits us to a direct representation; adding a mutation sigma on top is incremental, not a second paradigm.
Trade-off accepted: D gives evolvability + manual control but loses A's coherent rule↔body coupling. A is more faithful to Picbreeder's non-objective philosophy (you discover, you don't fiddle toward a target).
Why pure selection strains here (and the real blocker) #
Pure CPPN + pure selection is most faithful, but Picbreeder relied on a phenotype that is static, deterministic, and readable at a glance. Fluoddity's is dynamic, stochastic, and large/coupled: morphology and rule interact, so much of the random space is dead (collapsed/saturated). The blocker for pure selection is therefore viability, not encoding — a grid of corpses is a bad chooser. The clean, Picbreeder-compatible fix is the viability filter (M5: reject/resample dead candidates), not manual control. Manual control is a heavier crutch that also doubles as a creative instrument.
Path (this is an experiment, not a verdict) #
The record stores the resolved morphology vector regardless of source, so A and D can coexist as a selectable morphology-source mode. Plan:
- Now: ship D — per-candidate morphology, jittered on spawn; sliders stay live overrides; focusing a candidate loads its evolved morphology.
- Later: add A + the viability filter together, then run the empirical comparison — which mode surfaces more interesting structure on this substrate?
- (Fancy, post-MVP): re-fit a CPPN to hand-authored morphology values (inverse of compile) so manually-tuned organisms become breedable CPPN genomes. Noted, not planned.
Relationship to NEAT / HyperNEAT #
- vs NEAT: we have CPPN-NEAT's encoding and operators (graph genome, add-node/add-conn,
function-preserving insertion, weight/bias/activation mutation) — minus innovation
numbers (crossover matches genes by
(src,dst)endpoints, not historical markings → some competing-conventions risk) and minus speciation + a fitness loop. The latter is omitted by design: IEC replaces fitness with the human. Distance to "full NEAT genome": just innovation numbers (small, worthwhile only if crossover starts mattering). Distance to "full NEAT algorithm": N/A — its selection machinery is what IEC discards. - vs HyperNEAT: HyperNEAT queries a CPPN over a geometric substrate to generate a large weight matrix, exploiting spatial regularity. We use the CPPN as a direct function (Picbreeder-style), not a substrate generator. Not useful for the ~10 morphology scalars. The one place it could fit later: cohorts (Starfish's 64) — a CPPN mapping cohort coordinate → per-cohort rule perturbation would give coherent spatial variety. Revisit with the v1 cohort feature.
- Bracketed (future, automated selection): quality-diversity / MAP-Elites / minimal-criterion coevolution. These reintroduce a fitness-or-novelty signal + (often) speciation. Out of scope while selection is purely interactive.