A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [MX] AI in Racing game

  1. #1
    Senior Member Orkahm52's Avatar
    Join Date
    Jan 2006
    Location
    Perth, Australia
    Posts
    335

    [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.

  2. #2
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    how is the game setup at the moment?

    art based or tilebased
    lather yourself up with soap - soap arcade

  3. #3
    Senior Member Orkahm52's Avatar
    Join Date
    Jan 2006
    Location
    Perth, Australia
    Posts
    335
    Art based

  4. #4
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    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.
    lather yourself up with soap - soap arcade

  5. #5
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    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.

  6. #6
    avatar free
    Join Date
    Jul 2002
    Location
    UK
    Posts
    835
    Quote Originally Posted by Squize
    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.
    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.)
    jonmack
    flash racer blog - advanced arcade racer development blog

  7. #7
    Senior Member Orkahm52's Avatar
    Join Date
    Jan 2006
    Location
    Perth, Australia
    Posts
    335
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center