Now that Katie Commando is finished and live, I've been on a new racing game project. This racing game will have computer controlled cars. The question is how do we get these cars to be controlled by the computer? In this blog post I'll tell you how we do it.
Getting the car to drive on any road is quite difficult, therefore we ask the track creator to create waypoints that follow the road. Below you see an image of the road with waypoints (shown in green).
We should also have a fall-back in case the car gets stuck somewhere. Therefore if the car has not passed the next way point within 2 or 3 seconds we assume something is wrong and we reset the car back on track. Of course this shouldn't happen too often (if it does then the car steering should be adjusted).