Teaching AI to Land Rockets Using Genetic Algorithms
This project showcases a neural network learning to land rockets using a genetic algorithm, all rendered in a browser with JavaScript, HTML5, and the Matter.js physics engine.
Rockets are equipped with three binary thrusters and controlled either manually (W, A, D keys) or by AI. The neural networks are trained from scratch and evolve over generations, optimizing landing performance through selection, crossover, and mutation.
Users can tweak training parameters in real time and monitor learning progress via performance graphs that track average and top scores across generations.
UsersTry flying the rocket yourself using the W, A, and D keys. Test your skills with limited thruster control and realistic physics.
Try Manual ControlWatch neural networks learn to land. Customize genetic algorithm parameters like mutation rate and survival percentage.
View TrainingView the most successful rockets. Observe how AI strategies evolve over time through generations of trial and error.
Watch Best RocketsImplemented from scratch with two hidden layers of 16 neurons each, using ReLU activation. Fully integrated with a custom training environment.
Utilizes roulette wheel selection, crossover reproduction from two parents, and an adjustable mutation rate to evolve landing strategies.
Handles realistic physics simulation including thrust, gravity, rotation, and collision detection between rockets and the landing platform.
Built entirely in vanilla JavaScript with HTML5 Canvas for rendering. No external ML libraries were used — everything is coded manually.