|
-
Senior Member
[MX] AI in Racing game
I'm currently working on a top down racing game, and I was wondering what would be the best way to do the other cars.
I could pre-set an array for it to get _x, _y and _rotation values from. But since the laps are pretty long the array is rather big.
Alternately, I could create an animation of it going around the track, which would make it hard to get the right speed and physics and all that of your car.
Thanks.
-
M.D.
how is the game setup at the moment?
art based or tilebased
-
Senior Member
-
M.D.
i'll get back to you, gotta go home now.
But you could set up some sort of waypoint system, which would work just as good as a array full of rotation code.
-
Hype over content...
There's some good reading here:
http://flashracer.blogspot.com/
( And I hope if I pimp their blog enough they'll finish the game ).
Squize.
-
 Originally Posted by Squize
Haha! Cheers mate, nice to know someone is watching. Blame the World Cup and me getting a new hard drive for the recent lack of updates...
Orkahm52:
Waypoints are nice and simple to do. What we had was an (x, y) coord per waypoint and a speed. The direction (to set _rotation to) was calculated when needed, so you shouldn't need to store it. The speed is handy for tight corners where you would just not be able to go round at full speed and survive!
There are some problems with it though, that are unacceptable for our game. All the AI cars will aim for the same waypoint, and when they get to it, they will crash/slide against each other if they are close. It also leads to the finishing line being a point, which means that in a certain situation, you can be "ahead" of one car at the finish but (*giggles nervously*) actually register as coming second!
Anyway, what we're trying now (some of the last few blog posts) is "waylines". Each "point" coord has an extra few numbers to turn it into a vector (and therefore a line). Nice bonus is the "strength" of the vector can be the entrance speed, so that removes the need for another speed value. Now AI cars can aim for different points along this line, depending on various things.
This might be too complicated for the type of game you're doing, but I thought I'd mention it (blog is more detailed.)
One of my really wacky ideas was to rig up a neural network and make each AI aim for points along the waylines according to their aggressiveness. But I doubt that will make it into our game (at least this version.)
-
Senior Member
Hmm, I might try that way point system. Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|