« All posts

Game Genetics Without Mendel: Continuous Traits, Biased Mutation

In the farming sim Greens, continuous genes, biased mutation, and backend-free base-36 genome codes replace Mendelian breeding mechanics.

Most in-game breeding systems still work like a middle-school Punnett square: a handful of alleles, dominant/recessive rules, and a small set of discrete outcomes. The developer of Greens, a browser-based farming sim, instead modeled each trait (hue, yield, speed, sell value, hardiness) as a bounded continuous number. Instead of picking from a lookup table, the player nudges a five-dimensional space toward a target corner, which makes long-term selective breeding feel meaningful rather than repetitive.

Crossing averages the two parents' genes and adds noise deliberately skewed positive, plus a rare large jump layered on top. That upward bias means patient breeding drifts the population forward on its own, whereas symmetric noise would feel like fighting the RNG. The UI shows a deterministic, noise-free preview of the expected midpoint, while the actual roll — applied only on commit — adds the randomness. The gap between the predictable preview and the noisy real result is where the game's tension lives.

A second notable design choice is a backend-free sharing format: five floats and a crop index are converted to fixed-point integers, base-36 encoded, and packed into a short versioned string that fits in a chat message. Decoding re-validates and re-clamps every value, since the string is untrusted external input, and the version prefix protects against future format changes.

The broader lesson generalizes well beyond farming sims: continuous traits raise replay value, splitting mutation into small-frequent and large-rare components buys both stability and jackpots, deterministic previews let players form intent, and versioned, re-validated share codes remove the need for a server. The same fixed-point-plus-base36 trick applies to any small, shareable struct — loadouts, level seeds, color palettes — where a compact, self-contained code beats a database.