Game Lab · Neuroevolution

Space Dodger

Sixty baby spaceships, sixty random brains. Rocks are floating everywhere and golden stars are waiting. Press Play!

How the best half did, round by round

Still flying at the end (%)Stars per ship (×10)A challenge started

Checkpoints — the champion ship from each round. Tap to watch it fly in today's space.

How it works

Radar all around

Each ship sends out 8 radar beams. A beam glows when a rock is close in that direction. It also feels the nearest rock's movement and where its star is.

A tiny brain

Those numbers go into a small brain that decides two things: turn left or right, and fire the engine or not.

Best pilots win

Flying longer and grabbing stars both score points. The best ships become parents of the next round.

Copy with changes

Babies get their parents' brains with small random changes. Some changes help. Those babies win next time.

Change space

Turn on a challenge. Old tricks stop working, scores drop, and the fleet has to find new tricks.

What just happened?

For grown-ups: what's really going on

This is neuroevolution: a population of 60 small feed-forward networks [16 → 12 → 2] (tanh) improved by a genetic algorithm, with no gradients and no labelled data.

  • Inputs: 8 radar rays at 45° steps around the heading (1 − distance/150 to the nearest rock, black hole or wall), the nearest rock's offset and relative velocity in the ship's frame (ahead/side), the sine and cosine of the angle to the ship's star, the star distance, and the ship's speed.
  • Outputs: turn rate and thrust (fire if > 0). Asteroids-style inertia with light drag; the arena wraps around unless "Deadly walls" is on.
  • Fitness: seconds survived + 8 × stars, summed over two different asteroid fields per round (one shown, one scored in the background) to reduce luck.
  • Genetic algorithm: the top 8% are kept unchanged (elitism); the rest are children of the top quarter (30% uniform crossover) with Gaussian mutation whose size is spread from small to large.
  • Measured in Node (best half, one run each, challenge switched on at round 31): no challenge, survival 63% in round 1 → about 85–90% and stars 0.1 → 3–5 by round 40–50. Black hole: survival 69% → 30% → 68%. Meteor shower, heavy ship and shy stars only partly recover (e.g. shy stars: 3.3 → 1.2 → 2.0 stars after 50 rounds), because they make the game genuinely harder.
  • Each round uses new random asteroid fields, so a brain must learn a general dodging rule, not memorise one map.