Would it be more advantageous to make it so that the AI
can "tell" what the best line is through a corner without
someone (human) having to draw a line on the track for it
to follow? Or would the advantages of that approach be
more than offset by the huge programming challenges
that would entail? Will sims still be using LP lines 20 years
from now?
John DiFool
>>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.
>Good question. I was just pondering that the other day.
>I'm no programmer, but I wondered just how much "hand-
>holding" an AI needs. For example, AFAIK most racing
>AIs are coded using various racing lines made by human
>programmers, which tell the AI where to go on the track
>in various situations.
>Would it be more advantageous to make it so that the AI
>can "tell" what the best line is through a corner without
>someone (human) having to draw a line on the track for it
>to follow? Or would the advantages of that approach be
>more than offset by the huge programming challenges
>that would entail? Will sims still be using LP lines 20 years
>from now?
Steve H
GPL Rank -17.90
Can't help about the shape i'm in
Can't win,it ain't pretty and my tires are thin..
> >>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.
> >Good question. I was just pondering that the other day.
> >I'm no programmer, but I wondered just how much "hand-
> >holding" an AI needs. For example, AFAIK most racing
> >AIs are coded using various racing lines made by human
> >programmers, which tell the AI where to go on the track
> >in various situations.
> >Would it be more advantageous to make it so that the AI
> >can "tell" what the best line is through a corner without
> >someone (human) having to draw a line on the track for it
> >to follow? Or would the advantages of that approach be
> >more than offset by the huge programming challenges
> >that would entail? Will sims still be using LP lines 20 years
> >from now?
> Let's hope not. In my view, AI won't come of age until you can give it
> a track and it can learn how to drive around it just like us humans,
> whilst at the same time, having various weightings which allow some AI
> to learn and drive better than others.
> --
> 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
Isn't that how LFS is? They supposedly get smarter the more they run the
track. I never got to that point though. Last time I played, they were
still running into tire stacks and such.
Alan
>On Tue, 11 May 2004 17:48:20 GMT, Joe62
>>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.
So in that sense, you're not literally racing against a car that's glued to a
line as you might imagine. The car wanders off it a bit, but if you let it run
lap after lap it'll do very close to the same thing each time. So to throw a
little flavor in it'll randomly pick a different line each lap, or you could
have it switch lines at a random time around the track, although that can look
a little wierd..
Aside from the steering controller is a throttle/brake controller. I've tried
2 different things:
1) The first way I tried was to use the same type of approach as was done for
steering. Using the distance and tangential speed from the racing line the car
wanted to follow, the throttle gain might be reduced. I.e., if the car went a
bit too far off the line the throttle is "slowly" released and if that's not
enough to fix the situation, the brake is progressively applied. Eventually
the car slows down enough to get back on the line, and the throttle increases
again on its own.
That works pretty well as long as you're not coming off a straight into a tight
turn. The car won't see ahead far enough to know that it's going to go off the
line. So what I did was come up with a learning algorithm that was pretty
slick. The cars would run through a learning phase (just during development).
The car would basically race full blast into the first turn and if it went too
far off the line, it would create a braking point some distance behind where it
went off. Eventually the car would return to the line and it would remember an
"end brake" point. So basically it created its own braking zone. It would
then run the rest of the track (while possibly going off at all the other
corners) and when it ran through turn 1 again it would adjust the "start
braking" point forward or backwards a little bit each lap until the car didn't
go too far off the line. Then it would adjust the "end braking" point to the
spot where the car went the furthest off the track, and voila, it would
eventually learn to brake enough to make the turn on its own.
Then it would proceed to the next spot where the car goes off, and after
several laps it would learn where to brake and for how long. Eventually after
60-100 laps the cars would learn the whole track and turn not too shabby
laptimes. It's neat to watch them learn the track that way, but they are still
following racing lines that I'd lay down with a spline editor tool.
2) The method above turned out not work as well as I'd hoped for my particular
application. The cars weren't as fast through the turns as they could be. So
instead, I just recorded a bunch of my laps and set the AI throttle controller
to simply try to match the speed I was running at various points around the
track. This looks a lot better and the cars are faster, even though it's
infinitely simpler to implement and the cars aren't really learning anything.
Who knows though, maybe somebody else could make method 1 work better than 2...
:-)
After that, each car measures the distance to every other car and when one gets
close to another, will try to steer away from it a little bit and when I get
time, will adjust its throttle some as well if necessary. That actually looks
pretty good as if you stick 10 cars on the track in close proximity to each
other, they all drive totally unique lines even if you tell them to drive "line
A." (Which is more than can be said for the Grand Turismo series!)
Granted, my cars right now are crashing all over the place, so I may put my
foot in my mouth later over that approach ;-)
Also note that this is with AI cars that do nothing but understeer. If your AI
cars can spin, you'll need extra stuff to get them to countersteer and so on
like a human driver would try to do. One idea on that would be to keep an eye
on the slip angles of the tires.
Yep :-)
That is something I'd very much like to try, but it's truly a horrendously
complicated thing to write code that lets a computer "learn" how to drive a car
around a given track as fast as possible. How does a human decide what to do,
and when, to accomplish this task? It's remarkably complicated to quantify it.
However.... Fuzzy logic in combination with some learning algo seems to be the
most promising way to go about it, but I haven't tried it so can't give any
tips on it.
Or would the advantages of that approach be
Basically yeah, although different developers probably feel differently about
it. I think it'd be cool to do, but on the other hand I think it's very
unlikely that even a good fuzzy logic system will run a car faster around a
track than a good human driver will. Hence, I figured it was best to save
myself the trouble and just record the lines and target speeds from the
superior human driver and be done with it ;-)
There are options though for creating AI that really learn the tracks on their
own. For instance, I have gates set up across the track where the points that
the AI splines run through. It should be feasible to let a genetic algorithm
adjust the points around and try to figure out a "best line" without even
bothering with recording a replay. The target speeds could be initially set
based on the curvature of the spline in all locations, and an estimate of
laptime might be made based on this without actually making the AI drive
countless laps for weeks on end to figure out what works...
But even then, a good human driver will pop off a faster lap anyway so it may
not be worth the trouble :-)
Will sims still be using LP lines 20 years
Some probably will. However, if you can say that your sim uses an approach
like you described where it truly learns the track on its own and has all of
this extra sophistication, it will probably sell more so you have to weigh that
in with your decision as to how to implement the AI. Technology will probably
move away from replay lines 20 years from now as folks figure out new methods,
computers get fast enough to run them in real time, and people communicate this
stuff with each other.
Todd Wasson
Racing Software
http://PerformanceSimulations.com
http://performancesimulations.com/scnshot4.htm
Racing AI at the bottom end tends to be totally pre-determined, and at the
top end totally "free" (i.e. the AI works everything out for itself on the
fly). The main problem is, totally free is complex, and the hardest part is
"reading the road" - mainly because of the volume of data you have to
process to get good results. Think about what it takes to work out a racing
line - a mental representation of the road, experience of having driven it,
knowledge of your car, track conditions, etc, and then add on all the stuff
in your brain that processes spatial information!
So what tends to happen is you approximate. Racing lines will probably be
around for a while yet, because its a massive compression of complex
information into simple information. I've written a Genetic Algorithm to get
cars creating their own racing line and it works, but it takes quite a
while. You wouldn't let a consumer run it on the their PC or PS2.
You can relax a lot of the other constraints though - for example, if your
AI "knows" how much grip it's got, the width and radius of the track and a
racing line at various points, it can calculate it's braking and
acceleration and can wander off the line, or modify it on the fly to try out
variations or avoid other cars, giving an impression of a sentient driver.
You can also play with these values based on the drivers personality and
"emotion" to further vary it. I've used a method like this for a while and
it works well.
To answer the initial post, you won't find too much. I once saw a paper on
Midtown Madness AI, but that's it. Try to think of all the data an AI needs,
then think about how to represent this in a way that can be used realtime,
then think about how you can modify the information on the fly. Think about
the constraints of your system, and what happens if you can relax them. You
should be able to come up with quite a few ideas, but many will have been
done before! Other key things are, you have to consider the ability levels
of your players, whether your AI will cheat ,and ideally all behaviour will
be deterministic.
Have fun,
Jeff.
Wow! maybe that's my problem. I was always told to drive with the
seat of my pants. Whats this Brain thingie?
(snip)
Has any sim attempted to creat BOTS rather than packs? From what I
gather, all the AI cars try to basically follow the same set of
parameters regarding lines, speed, etc. I know many sims allow a range
of responses within that set, but still, the whole field is all using the
same info. Would not a BOT system, similar to the FPS games allow more
freedom from each car/driver?
For instance, Michael Andretti has always taken flat ovals in a
Diamond patterned turn. Instead of starting wide and clipping the middle
of an oval's corner, he regularly dives sharply early and apexes halfway
up the track surface. Almost squaring the corner. Most of the rest of
the field he's competed against take a smoother late entry line. Could
this sort of behaivor be simulated?
dh
From a Game-Development perspective another thing to consider is "what is actually perceivable by the consumer?" and "What is the
minimum work to do the job effectively and efficiently?".
Given the tight deadlines that games are developed to nowadays there is little point investing a year developing a really clever
algorithm that automatically calculates the best racing line, braking points and everything when a simple hand-drawn racing line
will give the same results in a fraction of the time.
Its kind of sad really but unless there are some really noticeable advantages of the more complex techniques I can't see games
moving on.
Regards,
Todd.
> Racing AI at the bottom end tends to be totally pre-determined, and at the
> top end totally "free" (i.e. the AI works everything out for itself on the
> fly). The main problem is, totally free is complex, and the hardest part is
> "reading the road" - mainly because of the volume of data you have to
> process to get good results. Think about what it takes to work out a racing
> line - a mental representation of the road, experience of having driven it,
> knowledge of your car, track conditions, etc, and then add on all the stuff
> in your brain that processes spatial information!
> So what tends to happen is you approximate. Racing lines will probably be
> around for a while yet, because its a massive compression of complex
> information into simple information. I've written a Genetic Algorithm to get
> cars creating their own racing line and it works, but it takes quite a
> while. You wouldn't let a consumer run it on the their PC or PS2.
> You can relax a lot of the other constraints though - for example, if your
> AI "knows" how much grip it's got, the width and radius of the track and a
> racing line at various points, it can calculate it's braking and
> acceleration and can wander off the line, or modify it on the fly to try out
> variations or avoid other cars, giving an impression of a sentient driver.
> You can also play with these values based on the drivers personality and
> "emotion" to further vary it. I've used a method like this for a while and
> it works well.
> To answer the initial post, you won't find too much. I once saw a paper on
> Midtown Madness AI, but that's it. Try to think of all the data an AI needs,
> then think about how to represent this in a way that can be used realtime,
> then think about how you can modify the information on the fly. Think about
> the constraints of your system, and what happens if you can relax them. You
> should be able to come up with quite a few ideas, but many will have been
> done before! Other key things are, you have to consider the ability levels
> of your players, whether your AI will cheat ,and ideally all behaviour will
> be deterministic.
> Have fun,
> Jeff.
Well, I'd think of a car / driver system as a kind of paired bot system -
and yes, there are games that have treated drivers as bots - the one
semi-sim I worked on did for instance, I'm sure many others do, not least F1
games.
Without a doubt. As long as you isolate your driver code from your racing
code and your car code, it should be fine. You could either model sections
of racing line, or in a nicer way, set some parameters that define how that
driver tweaks the racing line in a given set of circumstances. This would be
a fun one to play with, because your relaxing few constaints and adding a
lot of personality to your game.
I don't know about "smarter", but LFS AI drivers become more familiar
with the track. They don't, however, keep their cars off your paint job,
but they do pull some quick lap times.
What I've done before is make a car setup with zero damping, maximum
ride height, nice springy springs (not absolutely stiff), outrageous
positive camber and toe-out, and run high-pressure knobbies.
Despite this horrible setup, the AI are able to somewhat maneuver
these jacked-up GTIs around the track, bobbling around. This was done
to watch how the AI re-learns the track with such poor handling.
[plus it's fun to get in the MRT5 and zig-zag through the slow field...]
But I digress.
-bpb
>>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.
>Good question. I was just pondering that the other day.
Quite a bit it seems. Depends on how far you want to stretch your
driver model. The better the driver model, the less performance
CPU-wise, and the less hand-holding.
Advantageous in what way? It WILL cost more CPU, so that's not an
advantage. The driving line from a human driver is a nice starting
point, even when the AI would make up its own mind. At least it has a
starting point and then can choose to brake later, brake sooner, turn
in more etc...
Ruud van Gaal
Free car sim: http://www.racer.nl/
Pencil art : http://www.marketgraph.nl/gallery/
Ruud van Gaal
Free car sim: http://www.racer.nl/
Pencil art : http://www.marketgraph.nl/gallery/
Pretty please?
<pregnant pause>
No?
***. What's wrong, you guys want to make a profit? ;-)
Andrew McP... living in a dreamworld :-)