• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
AI driver
11-28-2006, 01:57 AM,

I'm still able to spank the AI by 8.5 seconds on Jarama in G4s from a standing start on my first try, but it drives respectably. It reminds me of the conservative driving style of the gran turismo AI, where it never messes up but never really pushes it, either.
11-28-2006, 01:59 AM,

I just checked in a fix that makes the game start in STATE_STAGING instead of STATE_PLAYING, so the player will hold the brakes until time to go. I made the AI hold the brakes too so at least the player gets a fair chance to start now. It is a little funky though that the cars are literally on top of each other.
11-28-2006, 09:21 AM,
 rookie1 Member Posts: 231 Threads: 32 Joined: Nov 2006

I've committed some enhancement to the AI. Now it's able to navigate Monaco and Circuit de Pau using a G4.

Currently the biggest handicap AI has is the tire model. It's using a very much simplified version to calculate the friction force,

Friction = mu * Weight

The friction coefficient mu is taken from the track definition - treaded friction coefficient (0.9). This value seems a bit low for a car like G4, resulting a lower speed limit (hence slower) around the corner. However, it's too high for some other cars.

I'm not sure how to improve this, short of doing the full Pacejka calculation, which maybe overly complicated.
11-28-2006, 02:39 PM,

Check out:

Code:
```double sp = (*it)->GetTire()->GetSigmaHat(); //ideal slip ratio given tire loading double uhat = (*it)->GetTire()->GetFx(sp); //maximum tire friction given ideal slip ratio```

This should give you a better approximation than the equation you're currently using. You might want to back off of the ideal value somewhat. Also, you should take uhat and multiply it by ((1.0-tread)*friction1 + tread*friction2) where tread is the tire's tread and friction1 and friction2 are the friction coefficients for the track surface.
11-29-2006, 05:40 PM,
 kcid Member Posts: 136 Threads: 8 Joined: Jan 2006

Just on a sidenote, I now get a linker error when compiling on windows in Dev cpp about AI here it is:
Code:
`[Linker error] undefined reference to `AI::update(float, float, TRACK*)'`
Nathan looked at the code and couldn't find anything wrong with it.
11-29-2006, 08:47 PM,
 rookie1 Member Posts: 231 Threads: 32 Joined: Nov 2006

kcid Wrote:Just on a sidenote, I now get a linker error when compiling on windows in Dev cpp about AI here it is:
Code:
`[Linker error] undefined reference to `AI::update(float, float, TRACK*)'`
Nathan looked at the code and couldn't find anything wrong with it.
Can you check whether ai.h and ai.cpp are part of your dev cpp project?
11-30-2006, 01:42 AM,
 rookie1 Member Posts: 231 Threads: 32 Joined: Nov 2006

Commited a change to calculate friction coefficient base on Joe's suggestion. This takes into consideration individual car's tire data. So it should be better than the previous code using a fixed value for all cars.
11-30-2006, 09:07 AM,
 kcid Member Posts: 136 Threads: 8 Joined: Jan 2006

Thanks rookie1 that worked, the ai.cpp and ai.h where not added to the file yet, I've uploaded a updated dev cpp project file into svn. Thankx

Forum Jump:

Users browsing this thread: 1 Guest(s)