Autonomous car simulation in unity 3d - Machine Learning using Neural Network & Genetic Algorithm
1.2 K
This autonomous car simulation is done using unity3d game engine written in C#.

The demo features a self-taught, machine learned, simulated car using Neural Networks & Genetic Algorithm.
The cars does not pre-programmed to know how to drive or what are the steps to learn how to drive. In fact, it does not know anything about it's world except the distance from collision objects, which are the track borders and other cars in the simulation.
The car has 36 ray cast distances, represented as the red lines for the selected car, to use as inputs for the Neural Network. The blue line are the maximum distance for a raycast. The Neural Network has 1 hidden layer with 36 nodes. There are two output nodes, one for the direction of the wheels and one for the speed of the car. Those output then reconnected as 2 more input nodes for the Neural Network.

Each car initiated with a random set of weights for it's Neural Network.
If the activation of the network produce output that make the car collide with the track or with some other car, the car crashes and begin again from it's spawning point, using a new Neural Net from the Genetic-Algorithm agents pool.
If the car does not crash, it likely to collect food points, represented as purple dots and scattered across the road area. The more food it collect the more likely it to pass on it's genes. Each time the population stack is empty a cross-breed process start to create new population from the strongest fitness agents.

This video is long, feel free to run it at X2 speed using youtube's settings.
Eran Ravid
Lead - Developer - Programmer
Mohit Karangiya
7 months ago
@Eran Ravid Great work Eran. Could you share on github for reference please? Thanks!
mabiala emile
a year ago
any GitHub please ? that would be great