Racing AI - part 47Million

Started by
17 comments, last by Stevieboy 19 years ago
I know there are other threads on Racing AI, however none of them seem to take into account some of the problems I'm currently dealing with. I have a track. It could be any sort of whacky shape. It is marked along its route by a series of waypoints. So, obviously the AI should follow these? But not so fast! I run into a problem with a simple checkpoint->checkpoint following setup. Our cars use a fairly realistic physics model, so they can slide around alot. Often the AI is travelling too fast to intercept the next waypoint, or worse, if there are a long series of straight waypoints followed by a tight corner he will not 'see it coming' and just blast off into a tree someplace. My question then: What is a good way of connecting these waypoints together to form a more smooth line. Bezeir curves? I looked into them, but was confused as to how I would find if a given point is on the curve, near the curve, or whatever. The method used to connect the points would need a few features I think. I would need to be able to find the instantaneous radius (or average radius over a distance) at a given point on the curve, so I could take a series of these over a section of track and attempt to decide exactly what is a corner, and what is not. My cars AI already knows exactly what speed it must travel to turn a corner of a given radius, so if I had some way of checking ahead, I could plan braking points accordingly. Would it be best if the car attempted to keep itself ON the line? Aim itself at a dot on the line ahead some distance (with the distance based on its speed?) Would there be any difference between the two approaches? Any other methods used to follow a track? Maybe break it up into polygon sections and uh...do a little dance with them? Other problems: My AI will also need to take corrective measures to deal with understeer/oversteer/locked wheels, actions of other cars, and so on. Obviously these may (and WILL) conflict with the control inputs required to keep it on track. How do you decide which takes priority? Do you blend them together based on some weight factors? I've heard of Neural Nets for this kind of thing, but I dont know anything about them so I'd think it's sort of beyond my abilities to implement. I have a few ideas I'm going to look into, but I'd appreciate it if someone with more experience with this sort of thing could point me in the right, or at least a less wrong, direction.
Advertisement
here's an alternative solution

http://www.ai-junkie.com/misc/hannan/hannan.html

Usually: Move towards the next checkpoint.

Also, look two checkpoints ahead (or more), and see if anything is intersecting a line between you and the checkpoint.

If it is, then you start stearing and braking. (depening on when and where it is).

This would detect the hairpin turn, go into a skid, turn on full lock, and get it arround the corner (before correcting after the corner).

From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
Quote:Original post by fup
here's an alternative solution

http://www.ai-junkie.com/misc/hannan/hannan.html


That's a nueral network approach, and way beyond the scope of what I'm doing (I think?!).
Also that link doesnt actually mention anything specific enough to be useful. It's pretty much
"so I uh..made this AI that learns driving."
"how?"
"that's classified"
"oh."

Quote:Original post by Nice Coder
Usually: Move towards the next checkpoint.

That was the first attempt and it is no where near sufficient. Often they miss the waypoint entirely, or spin out struggling to get near it at the last second.

Quote:
Also, look two checkpoints ahead (or more), and see if anything is intersecting a line between you and the checkpoint.
This would detect the hairpin turn, go into a skid, turn on full lock, and get it arround the corner (before correcting after the corner).


Can you expand on this? Looking a checkpoint ahead, what exactly am I looking for intersecting? Can this detect the severity of the turn? On some tracks it is necessary to brake 2-3 screen lengths in advance for a turn, and the AI struggles with this concept.
Maybe you could something as, optimal angle thing to all the waypoints, So the Car tries to "enter" the waypoint at a good angle to hit the next waypoint... maybe? =)
Quote:That's a nueral network approach, and way beyond the scope of what I'm doing (I think?!).
Also that link doesnt actually mention anything specific enough to be useful. It's pretty much
"so I uh..made this AI that learns driving."
"how?"
"that's classified"
"oh."


My apologies for trying to help. Forgive me for taking the time from my busy day to reply. I'm terribly sorry.
Here's just a simple idea, I've never messed with racing games, but I touched a bit the navigation for humvees in our game.

What I'd do is use steering behaviors to drive the car, this way you can easily take into account other cars. Now what I'd do about the curves, is to have a "detection radius" for the car based on its speed, and give waypoints a radius too based on their angle toward next waypoint... this way smooth curves wouldn't warn the AI as soon as say, a hair pin... This way the AI could plan ahead and brake a bit and say, move to the outside of the curve to steer inside the curve where its near the waypoint or something.

BTW, if you've never read about steering behaviors, check out Chris W. Reynold's web site. I guess you'd have to write a new (or combine multiple) behaviors to get a good steering behavior on the racing track, but I think it could be interesting to mess with this stuff.

The physics on the car could be an input to your steering behaviors, so it could take it into account and know where to aim to reach the way point.

Hope this helps

Good luck

Eric
CombatWombat - Be nice. Not being complementary and nice, is a sure trip to ignoreland. Where you post anything and nobody cares. (note: This is not nice).

You go towards the next waypoint IF THE INTERSECTION TEST FAILS. (ie. there are no obsticals betweeen you and the waypoint two after this one).

From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
Quote:Original post by fup
My apologies for trying to help. Forgive me for taking the time from my busy day to reply. I'm terribly sorry.


I didnt mean it in any personal attack sort of way. Sarcasm doesnt travel well over the internet sometimes.
It was merely a way of saying "Thanks for your suggestion, but I've read that article and didnt find the content within to be entirely applicable to my current project". I've been here long enough to know being a complete dick gets you hit with the ban stick.

Quote:Originial post by Nice Coder
You go towards the next waypoint IF THE INTERSECTION TEST FAILS. (ie. there are no obsticals betweeen you and the waypoint two after this one).

Currently the problem is not with objects blocking the path to the waypoint, but that the car cannot physically turn enough to reach it in time. Or it does something else entirely bizarre and its attempts to reach the 1st waypoint will ruin any chances it has at hitting the 2nd. Unless I'm misunderstanding what you mean by obsticals?

Currently I'm implementing some of the steering behavior type dealies suggest up there someplace, so maybe that will work.

It seems that your problem is not about the waypoints, but at the speed to which your AI are trying to take change waypoints at. Any chance you can provide information with hitting a way point? For example, you said that there was a straight away with a series of way point eventually going on a sharp turn, couldn't you provide information to the AI that when it's getting close to that turn that it needs to slow down or will miss the corner completely?

Basically, it's not just about reacting once your on a curve, but before you actually hit the curve.

Shadx

This topic is closed to new replies.

Advertisement