Advertisement

AI for Racing Game

Started by February 05, 2006 03:05 PM
4 comments, last by Rixter 18 years, 9 months ago
I am trying to find a good approach for having computer-controlled vehicles navigate a track in a racing game. I have a few steering behaviors down, such as wall avoidance, obstacle avoidance, and wander, but these three alone obviously don't cut it. I tried path following with a simple static path, but this causes problems because as soon as the vehicle gets past a waypoint without hitting it, it backtracks. This also eliminates the flexibility to take different paths in the track. Some possibilities are: -Make the waypoint be the width of the track (could limit granularity). -Creating a graph for the course and finding paths with A*. -Do the above with a multi-tiered path finding system. Right now option 3 looks the best, but would it be practical? Do you have other ideas? Thanks for any feedback.
You could have a trigger, which activates the next waypoint as current target once the car is within a certain range for instance, that way you won't have the car in reverse and it also won't matter if the car drifts off to the side and doesn't actually "hit" the waypoint.
For multiple ways you could always have a randomness which waypoint is activated next or something like that. Not on the track, but the tupel that's next of course.
Advertisement
I would suggest grabbing a copy og Game Programming Gems 1 and looking at 4.7 on page 412 for Computing the distance into a Sector, once you have that working for your tracks, Ai paths are a simple next step as well as camera tracking and keeping track of whos winning a race etc.
I can't find the link right now, but someone implemented a RARS (robotic auto racing simulator) car using A* once, I think it didn't do too bad either. I'd also probably try increasing the size of the waypoints, like l3mon was saying, and see how that works. Shouldn't matter if it hits it exactly.
That was my first idea (as stated in my post), so I think I'll try that and see if it produces good enough behavior.
Quote: Original post by Mr Awesome
That was my first idea (as stated in my post)


Yeah, I saw that, but for some reason I was thinking you meant something else, but I don't remember what now. So yeah, your and l3mon's idea :).

This topic is closed to new replies.

Advertisement