rec.autos.simulators

How does AI work in racing games?

Ruud van Ga

How does AI work in racing games?

by Ruud van Ga » Sat, 15 May 2004 23:20:17

On Fri, 14 May 2004 00:44:48 +0100, Peter Ives




>>On Wed, 12 May 2004 22:45:54 +0100, Peter Ives


>>Todd

>>>  Also, how
>>>do you create a little variety in their braking ability to avoid them
>>>all braking at exactly the same point and at the same rate of
>>>deceleration?

>>That's easy, just add a random number to the brake point distance...

>But won't that just even out the braking ability for all AI drivers?

Not if you adjust it per AI driver.

Then you add some braking ability per AI, based on a personality
factor. If that means braking a bit better than possible according to
the physics model, you give it a little bit more grip, or add some to
the resulting deceleration.

Ruud van Gaal
Free car sim: http://www.racesimcentral.net/
Pencil art  : http://www.racesimcentral.net/

J. Todd Wass

How does AI work in racing games?

by J. Todd Wass » Sun, 16 May 2004 02:35:48


>Date: 5/13/2004 6:44 PM Central Daylight Time



>>On Wed, 12 May 2004 22:45:54 +0100, Peter Ives


>>Todd

>>...
>>>But are the AI cars braking as efficiently as a human driver?

>>Would be nothing wrong in just modifying the grip a little for AI to
>>get them at the same level of braking ability compared to humans (who
>>can perhaps more intelligently process the brake). Instead of going
>>through lengths to learn AI to trailbrake. ;-)

>>>  Also, how
>>>do you create a little variety in their braking ability to avoid them
>>>all braking at exactly the same point and at the same rate of
>>>deceleration?

>>That's easy, just add a random number to the brake point distance...

>But won't that just even out the braking ability for all AI drivers?
>What I want is for some AI drivers to be harder to outbrake into the
>corner than others.  Just like human opponents.
>--
>Peter Ives (AKA Pete Ivington)

You could make the randomness not quite so random.  AI #1 might brake randomly
between 20 and 50 feet before the "ideal" point.  AI #2 might do it between 10
and 20 feet.  AI #3 might be overly agressive and brake between 10 foot to
early and 20 feet too late.

Or, maybe AI #3 acted like AI #1 until you bumped him a few times from the back
and ticked him off ;-) He gets impatient and starts making mistakes in an
effort to brake later or whatever.

Todd Wasson
Racing Software
http://PerformanceSimulations.com
http://performancesimulations.com/scnshot4.htm

J. Todd Wass

How does AI work in racing games?

by J. Todd Wass » Sun, 16 May 2004 02:36:59


>Date: 5/12/2004 10:56 AM Central Daylight Time

>And apologies if I got your name wrong as a collegue just told me I had!

Great post, and if you were talking to me you got the name right.  I go by Todd
:-)

Todd Wasson
Racing Software
http://PerformanceSimulations.com
http://performancesimulations.com/scnshot4.htm

J. Todd Wass

How does AI work in racing games?

by J. Todd Wass » Sun, 16 May 2004 02:56:49


>Date: 5/12/2004 4:45 PM Central Daylight Time



><snip>

>>Aside from the steering controller is a throttle/brake controller.  I've
>tried
>>2 different things:

<snip>

No, method 1 didn't try to figure out the optimum speed.  This was for RC cars
where basically they run full steering lock in the corner, then use the
throttle to keep the line.  My thinking was basically that if I apply full or
less than full steering lock and the car is having no problem following the
line, then you should increase throttle.  Once it's trailing off the line,
reduce it.  Nice and simple theoretically, but in the really tight corners it
slowed down too much.  

Method #2 used target speeds instead and could run through the same corner much
faster.

 If so, then

I played a bit with the throttle/brake gain rates.  Even if the AI car reaction
time was 1/300 of a second and it had a lightning fast trigger finger, method 1
just didn't work as well.  

Maybe you're right, I don't know.  Method 2 was just so much easier and it
worked better straight off so I kept it.  Granted, method 1 did work well
everywhere except on the tightest corners.  Plus it was just cool to watch the
cars making essentially better and better lines by themselves (until they
actually got on the line I defined, that is).  I'd go take a smoke break and
come back to check their laptimes.  It was pretty fun and interesting to watch
because it looks like they're really learning (they were, I suppose), but the
performance just wasn't as good as letting them chase my laps around,
especially in the slowest corners.  

Come to think of it, a lot of it might have been spline inaccuracy.  If there's
so much as a kink anywhere the car will think it's on a tight turn and let up.
Also, the car wasn't really measuring from the center of the car, but from a
point out in front of it that moved further down the track as the car went
faster.  Perhaps at low speed the point was too far forward so it thought it
was going off when it really wasn't and slowed down too much.  But if I didn't
have the point out far enough, it would criss cross the line and dart around in
a pretty fake way.  It was just such a tough balance to work out that I tried
the other way and it ended up working better all around, and it was much faster
to come up with the lines in the first place; more driving lines to pick from.
 With 20 second lap times it doesn't take long to get 50 or so lines :-)

Todd Wasson
Racing Software
http://PerformanceSimulations.com
http://performancesimulations.com/scnshot4.htm

Joe6

How does AI work in racing games?

by Joe6 » Sun, 16 May 2004 03:31:04



Well, on that note ... if anyone knows an experienced race-AI
programmer who's looking for work (Geoff or otherwise!) ... please
pass along my email address. This would be for a real opportunity at a
quality game dev company that's had some success with driving games.
Online programming an asset.

Peter Ive

How does AI work in racing games?

by Peter Ive » Sun, 16 May 2004 05:56:59



>On Fri, 14 May 2004 00:44:48 +0100, Peter Ives


><_KI_LLSP_A

>>>On Wed, 12 May 2004 22:45:54 +0100, Peter Ives


>>>Todd

>>>>  Also, how
>>>>do you create a little variety in their braking ability to avoid them
>>>>all braking at exactly the same point and at the same rate of
>>>>deceleration?

>>>That's easy, just add a random number to the brake point distance...

>>But won't that just even out the braking ability for all AI drivers?

>Not if you adjust it per AI driver.

Not sure I made myself clear.  What I meant was, that it appears that by
just adding a random number for each driver that all you end up with are
drivers who's braking ability varies each lap, but around the same
braking point.  So over a course of laps all drivers braking would even
out.

In my view, what would also need to be included is some kind of
weighting factor per driver that influences the random number generated
so that better AI drivers tend to brake nearer the perfect braking
point, whilst lesser AI drivers tend to brake further away from it (both
too early or too late).  Similar to what you stated below, perhaps,
though I'm just clarifying things.  ;-)

Only necessary if you cannot get the AI to brake as well under same
physics as a human, of course.  :)
--
Peter Ives (AKA Pete Ivington)
Remove ALL_STRESS before replying via email
If you know what's good for you, don't listen to me :)
GPLRank Joystick -50.63 Wheel -25.01

Ruud van Ga

How does AI work in racing games?

by Ruud van Ga » Sun, 16 May 2004 09:05:00

On Fri, 14 May 2004 21:56:59 +0100, Peter Ives




>>>>That's easy, just add a random number to the brake point distance...

>>>But won't that just even out the braking ability for all AI drivers?

>>Not if you adjust it per AI driver.

>Not sure I made myself clear.  What I meant was, that it appears that by
>just adding a random number for each driver that all you end up with are
>drivers who's braking ability varies each lap, but around the same
>braking point.  So over a course of laps all drivers braking would even
>out.

>In my view, what would also need to be included is some kind of
>weighting factor per driver that influences the random number generated
>so that better AI drivers tend to brake nearer the perfect braking
>point, whilst lesser AI drivers tend to brake further away from it (both
>too early or too late).

As you stated just the implementation, that's certainly possible. ;-)

That's the whole point; getting to that limit is very hard to do by
emulating a human, and much much easier by just cheating a little bit.
For a game, you quickly use the cheat, and as Todd found out,
sometimes the cheating way is even better than trying to do the 'real
thing'. :)

Ruud van Gaal
Free car sim: http://www.racer.nl/
Pencil art  : http://www.marketgraph.nl/gallery/

No On

How does AI work in racing games?

by No On » Sun, 16 May 2004 13:07:51


> Does anyone have pointers to articles or resources on the web where I
> can research this topic? I want to learn about the various approaches
> that have been tried, and understand their benefits and drawbacks.

They all seem to drive like graduates from the Michael Andretti Driving
School for the Blind.
Bernhard Wyman

How does AI work in racing games?

by Bernhard Wyman » Sun, 16 May 2004 20:19:37

Hi Joe62

I'm an AI-Programmer of the TORCS (www.torcs.org) project. If you are
interested in me, please visit my homepage www.berniw.org, you can find
there a shortened CV of me and my TORCS robot (AI) tutorial.

bye, Bernhard.

--

visit my homepage http://www.berniw.org


rec.autos.simulators is a usenet newsgroup formed in December, 1993. As this group was always unmoderated there may be some spam or off topic articles included. Some links do point back to racesimcentral.net as we could not validate the original address. Please report any pages that you believe warrant deletion from this archive (include the link in your email). RaceSimCentral.net is in no way responsible and does not endorse any of the content herein.