Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
An API for AI Drivers
07-26-2006, 11:44 PM,
#3
 
Firstly I'd look at the functions each AI would need to provide for the program to call...

1. A function at the start of each race - lets call it NewRace(). This provides the AI with the identity of the track, the list of opponent cars etc and gives it the opportunity to do the analysis of the track & initialize any other data it might need.

2. A function that's called during the race called Drive(). The AI is given a structure in which they fill in values for gear, clutch, acceleration, brake and steering.

3. A function for when the car stops in the pits called PitCommand(). The AI is given a structure to fill in the amount of fuel to add and damage to repair (assuming VDrift has damage at that point).

4. A function at the end of the race called EndRace(), during which the AI frees any memory/objects it may have allocated.

Going the other way, the AI would need access to data structures describing the track in detail - every curve, every elevation change etc. Ideally this would be in the form of a linked list, with each element describing the type of track segment, its length, precise height information for each side of the track, if a corner then the radius & arc. I know VDrift would need to work out this information previously from its evaluation of the track's 3D model, and this could be a significant challenge, but its essential as unlike a human driver, AIs don't have eyes Smile

The AIs would also need a structure for each car (including its own) containing the exact position of the 4 corners of the car on the track (or off it), its speed both frontal and sideways, its gear, its acceleration rate (negative if braking), its yaw relative to the direction of track its on, its yaw rate, the engine's revs, the slip rate of each wheel ... probably a few other things I'm forgetting. This information is needed for opponent cars so the AI can calculate overtaking and collision avoidance.

They'd also need to know about the setup of the car - how hard the suspension is, what the wing angles are and so on. This is necessary for planning the speed at which it tries to handle corners.

Finally information about the race itself. How many laps elapsed from how many in total, the position and time gaps between each car etc.

These structures would be created anew for each call to the functions for each AI. This is necessary else a malicious AI could perhaps write misleading info to the structures and thus trick other AIs into doing stupid things Smile

That's all I can think of offhand, though I know there's doubtless more.
Reply


Messages In This Thread
An API for AI Drivers - by locus - 07-26-2006, 09:55 PM
[No subject] - by thelusiv - 07-26-2006, 11:24 PM
[No subject] - by locus - 07-26-2006, 11:44 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)