This month has been slightly better than the previous two and I’ve been able to put a bit more time in on Oversteer Racing.
Teaching rivals how to drive
A lot of this month teaching the rival cars how to drive. I’ve spent quite a lot of time planning how to implement the code allowing rival cars to race around the track. In the end I went with a waypoint system but allowing rival cars to follow different routes on the track. This means that they can move into a defensive position for a corner or pull out to over take another car etc. The same system will also allow the cars to navigate through the pit lane.
At present their lap times are within 0.5-1s of my best time around the test track and that’s pretty good for testing. As the rival cars are not currently aware of other cars on track they are difficult to pass as they will, with another car alongside, turn in on them when going through a corner. This does result in some pretty spectacular crashes. Until the rival cars are aware of other cars it’s not clear how close their lap times should be to that of the player to create the best racing experience. With that in mind, the rival cars are “good enough” at the moment. Something that was important to me is that the rival cars are controlled in the same way as the player car so that the racing is as fair as possible – there are no “cheats” for the AI cars.
Now that we have rival cars on track I’ve also been able to start work on code to track race position and this will lead on to showing race position in the user interface etc.
Next month I’ll carry on working on the code to determine race position (it’s not as easy as you might think). I’ll also be working on code to allow AI cars to recover from spins or trips into the gravel traps etc. If there’s time I also plan to look at race strategy for AI cars.