The simulation is based on a neural network to guide the car around the track and a genetic algorithm used to pick and breed the most succesful cars of each generation.
If you want the source code for this demo, send me a PM.
For the people who are interested in how it works:
The car uses its 5 feelers to gauge a normalised intersection depth with the track's edges and then feeds this 5 values as inputs to the neural network. The inputs are then passed through a hidden layer of 8 neurons and then finally to an output layer of 2 neurons: a left and right steering force. These forces are then used to drive the car forward and turn the car.
Each car represents a different genome in a generation (or a unique set weights for the neural net) which are evaluated and potentially carried through to the next generation by a fitness score. The fitness score is based on the distance along the track achieved as well as bonus points for hitting checkpoints (this encourages the network to navigate around tricky sections of the track).
In the video, the neural network / genetic algorithm finds a solution at about 2.25. FRAPs interfered a little by clamping the framerate, so it took a bit longer than usual for it to find a solution.
Legend:
The green dots are the intersection points of the feelers. The blue lines are the feelers
The orange highlighted track geometry is track sections that are being considered for collision.
The blue circle is the radius used to search for track nearby track geometry.
hi there, would it be possible to have a sample of the training, validation and unseen data sets you used?
IceManNavigator 1 month ago
@IceManNavigator
I didn't use training, validation and unseen data sets for this sorry. It was based on a learning algorithm that would take the best performers from each generation and then cross-breed and mutate them. If you want to view the source code, it is available at: matthewrobbins (dot) net
onethought99 1 month ago
Are you programming it in C? or what language?
Leoz2569 6 months ago
@Leoz2569
This was done in C++ using a game engine that was supplied for us while at uni. You can find the source code here: matthewrobbins . net
onethought99 6 months ago
When it learned for this course, is it able to do another different one without training?
jpmorin196 6 months ago
@jpmorin196
I never got around to testing it on another course but I imagine that it would be able to.
onethought99 6 months ago