Rockets learn to fly with evolution algorithm

Back to home

Here I made a bunch of rockets learning to fly around a planet with a very simpified physics.

A rocket's behavior is defined by a small neural network:

The first layer takes rocket's height, absolute angle, and velocity's components as input. Then we have two hidden layers with 4 nodes each and the output layer, deciding whether the rocket will turn the engine on or off, and how much it should turn.

Initial weights are random and then evolve to maximize the time the rocket spends in the air.

In the top right of the screen you can see the network of the current best rocket.

Surprisingly, rockets learnt to orbit the planet quite fast initially, so I added constant air friction, to slow them down, but also they have a slow fuel regen to make things a bit more challenging.

Whenever the rocket is orange, it means its engine is on and it has some fuel left.