This is a neural network that has been trained to drive around a track. To enter and exit build mode press 'B'. Any mistakes can be undone with the undo button and when finished press the play button to run it. Press any key to continue.
I decided to train cars to drive a track because of a couple shortcomings I've seen in other attempts to do so. Most are trained on one or two tracks and not shown to be capable of general driving, they usually don't incorporate tire slip so the model has no incentive to learn proper cornering technique, and I’ve never seen one that does both of these things. This makes the problem simpler, easier to learn, and in my opinion less interesting. I believe the trouble originates from the fact that every example I’ve seen has used the same method of taking distance values from the car to edges of the track (first photo) to detect it. This works well enough but it simulates driving in a tunnel not on an open track so the model can only detect the track immediately around it. This prevents the car from preparing for anything around a corner and therefore can’t drive effectively unless it has the track memorized. My solution is to instead take a few points of varying distance along the centerline of a track of set width (second photo) and take the angle of those points to the car. This allows for fewer inputs while getting more information about the track ahead. With this method the model has been able to learn generalized driving with tire slip.