Mountain Lander
Rockets cross a mountain in a crosswind to land on a pad that moves every generation. The GA evolves a flight computer that lands on terrain it has never seen.
Go to the live page Open the Mountain Lander demoThe Mountain Lander demo is the harder sibling of the Rocket Lander. A rocket starts high up on one side of the screen, a landing pad waits on the other side, and there is a mountain in between. The rocket has to climb over the ridge, fight a crosswind, slow down, and touch down gently on the pad before its fuel runs out.
The catch is that none of this stays the same. Every generation flies a brand-new world: new mountains, a pad in a new place and at a new height, a new launch point and a new wind. A rocket can't win by memorizing one route. The genetic algorithm has to evolve a flight computer that knows how to land anywhere.
The Rocket¶
The rocket is a simple physics body with one engine at the bottom. The throttle sets how hard the engine pushes, and the engine can swivel a little to either side, which tips the nose and pushes the rocket sideways. To move across the map the rocket has to lean into the direction it wants to go, then lean back to stop.
A few details make it closer to the real thing:
- Fuel is limited. The tank holds twelve seconds of full-throttle burn. Hovering costs about two thirds of that per second, so a rocket that wanders or hovers too long runs dry and falls.
- The engine takes time to respond. Thrust follows the throttle with a short lag, so the flight computer has to anticipate instead of reacting at the last instant.
- The wind keeps changing. Each world has a steady crosswind plus gusts. The arrow in the corner of the canvas and the Wind reading in the stats bar show its direction and strength.
- Touchdown limits are strict. A landing counts only if the rocket hits the pad at under 2 m/s downward and 1 m/s sideways, tilted less than about eleven degrees. The speed is measured at the moment of impact.
The Flight Computer Is the Genome¶
Each chromosome is fifteen numbers between 0 and 1. Together they are the settings of the rocket's flight computer, for example:
- how strongly to steer toward the pad, and the top cross-country speed,
- how much clearance to keep above the ridge, and how fast to climb when it's too low,
- how close to the pad the final descent starts, and how fast to descend,
- how far to lean, and how strongly and smoothly to correct the tilt,
- the baseline throttle that holds a hover, and how hard to push the throttle to fix the climb or sink rate.
During the flight, the flight computer reads the rocket's sensors every moment (where the pad is, how fast it's moving, how much it's tilted, how high it is above the ridge between it and the pad) and turns that into a throttle setting and an engine angle. That makes it a closed-loop controller: it reacts to what is happening, so the same settings can fly a world they have never seen. Random settings mostly fail, for example a hover throttle that's too low, a tilt correction that oscillates, or a descent that's far too fast.
How a Run Looks¶
Click Start. Fifteen rockets (you can choose 10 to 30 in Settings) launch from the same spot into the same world. The leader, the rocket closest to the pad or the best one that has already settled, is drawn with a gold edge and leaves a dashed trail. Rockets that land cleanly glow green; rockets that crash glow red.
Generation zero is mostly chaos. Rockets drift off the edge of the map, sink into the mountain, or hit the pad far too fast. When every rocket has landed or crashed, the platform evolves the population: four elites carry over, the other children come from tournament winners with uniform crossover, and a few of their settings are nudged by a small random amount (up to the mutation range in Settings). The next generation then flies a new world. Usually within about ten generations a few rockets clear the ridge, slow down, and settle on the pad, and from there more and more of the population lands each generation.
The history strip under the canvas keeps one card per generation, showing that generation's terrain and its best flight path. Scroll it to see the terrain keep changing while the landings keep coming.
Elites fly every new world too, and they are scored on it. A flight computer that only got lucky on an easy world loses its place the next time it crashes, so the population is pushed toward settings that land anywhere.
Fitness¶
Each rocket scores once it lands, crashes, leaves the map, or runs out of time (twenty seconds):
- A clean landing scores between 1 and 2. It starts at 1 and adds more for a softer touchdown, landing closer to the centre of the pad, staying upright, and fuel left in the tank.
- Anything else scores below 1. The score grows with how close the rocket got to the pad and how slowly it was moving when it hit. A rocket that hovers until time runs out scores less than one that tries to land.
So any landing beats any crash, and before the first landing the population still has a clear direction to improve in.
The Loop at a Glance¶
Your browser owns the physics, the worlds and the scoring. The server only evolves the flight computers.
The worlds come from the seed shown under the canvas. Reload the page with ?seed=N in the address and the run replays the same sequence of worlds.
What the Achievement Rewards¶
The first time any rocket lands cleanly, the Over the ridge achievement unlocks for signed-in users. Since every generation is a new world, that landing is always on terrain the flight computer had never flown before.
For more on how the demos catalog works, see What the Demos Do.