How do I make a racing AI?

I am making a simple racing game where the player and the AI race. I don’t know where to start. I would like someone to show me a tutorial or where to go first.

Ah that’s a great subject.
Very often, AI development will start with finite state machines.
although this makes sense for FPS like AI with states such as “patrol”, “chase”, “stop, aim and shoot”, it doesn’t make much sense to me when it comes to things like racing or challenge based games as the AI is just like the player, in a state of “doing its best”.

So, to get you started, I would give you those few hints :

  • you’re going to build a “virtual brain”, so you should have some variables such as “focus period”, “reaction time”, “stress sensitivity” and as many traits that affect a player.
  • a brain triggers actions based on stimulus, so it should have all the necessary inputs, such as speed, gear, grip, weather, current road curviness, upcoming curviness etc.
  • the brain should then drive the car, not control it, I mean it shouldn’t have more controls than a human player has over the vehicle.

AI is going to be part of the last part of a training course I’m putting together, to bad it’s not ready yet. Anyway, I hope it’ll get you started. Good Luck!