I'm very curious about AI drivers in a racing game, so I tried to build one :). I've built a 3D closed racing course and a car with Unreal engine and all the physics, and I try to develop an algorithm that drives the car.
I saw several posts in the past, like this one Driver AI in racing game but I still don't understand how to control the throttle, steering, and breaks to actually do it.
What I have tried so far is to create some waypoints in the course and use a PID controller to control the throttle and steering that goes to the next waypoint every time. The results were not so good... Depends on the car speed and curves, the steering PID controller has overshoots and/or slow response. After some testing, I think that the PID controller cannot fit for driving a car...
I want the car to drive like an AI driver in a good racing game. Without collision with the walls (closed course) and drive as well as possible.
What is the best method for optimizing the path and what is the best way to control the car (throttle, breaks, steering) to follow that path?