The project
A 2D side-scrolling racing game in Unity where players breed and evolve vehicles across generations. Traits like speed, suspension, wheel count and chassis shape combine through breeding, and vehicles compete in short rounds with procedurally generated physics.
How it fits together
- A genome describes a vehicle: chassis shape, wheel count and placement, suspension and drive strength. Every racer on the track is that genome expressed as a Unity physics body.
- Each generation runs a short side-scrolling race over procedural terrain, the field is ranked on distance, and the top finishers are bred with mutation applied to produce the next grid.
- Chassis geometry is generated as a single random polygon, which is the part that turned out to constrain everything downstream.
- The player watches and bets on a racer rather than steering it, so a run is a sequence of wagers across generations.
The trade-offs that mattered
One polygon was not enough genome
Generating the chassis as a single random polygon sounds like it should give plenty of variety, and on paper it does. In practice the racers all read as the same lumpy blob with wheels. The shape space that actually matters is several polygons joined at chosen attachment points, which is what gives you arms, spars, counterweights and the silhouettes that make one racer memorably different from another. I picked the representation before I knew what variety I needed from it.
Plenty of ways to gamify it, none picked yet
A genetic algorithm left alone is a screensaver, so the game has to hand the player a lever. There is no shortage of candidates: choosing which pair breeds, biasing the mutation rate, spending something to protect a trait, drafting against other players. Working out which of those carries a whole game is the interesting problem, and it is one for a future pass.
The RNG swamped the signal
Physics races are noisy. A racer with a genuinely better genome tumbles once on bad terrain and the run is over, which means the player's read on the field is punished by luck rather than rewarded by judgement. Longer races, multiple heats or scoring the genome across seeds would all pull the noise down, and any of them is a real design change rather than a tuning pass.
What a better body would look like
The fix for the genome is not a bigger polygon, it is composition: a small set of parts joined at defined attachment points, so a mutation can lengthen a spar, add a wheel to an arm or shift a counterweight without discarding everything that already worked. That also makes inheritance legible, because a child visibly keeps a parent's limb. The representation has to carry that structure before any of the game questions are worth asking.
What I took from it
Turning an algorithm into a game mechanic taught me that the interesting part is not the evolution. It is giving the player a meaningful hand in it. A genetic algorithm left to run is a screensaver.