Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: AI for car game

  1. #11

    AI for car game

    Quote Originally Posted by savage
    There is an article on NN over @
    http://www.ai-junkie.com/ann/evolved/nnt1.html
    Umm i've tried the example program and it works good. It's not too hard to implement too. ( The delphi code didn't work for me, anyway)..
    I wonder if it could work for my game.. wouldn't it be cool to have cars driven by neural networks ?
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  2. #12

    AI for car game

    I had not played with the Delphi code, only looked through the article. Does your version of the Delphi code work?

    PS. it woulc be super cool if the cars used NN. Apparently that is what they used in Colin McRae 2.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  3. #13

    AI for car game

    Quote Originally Posted by savage
    I had not played with the Delphi code, only looked through the article. Does your version of the Delphi code work?
    I've not tryed to compile it, since it is windows only. But i've tried the executable at work (where i don't have delphi), and it runs but doesn't work (the agents of the simulation don't seems to get updated). I think there is some error in the sources.

    Quote Originally Posted by savage
    PS. it woulc be super cool if the cars used NN. Apparently that is what they used in Colin McRae 2.
    Well the demo of that article is quite effective. In say 10 minutes the agents go straight to the targets. That's similar to what i want, even if more simple.
    If i find some time, i'll try

    BTW that demo uses genetic algorithms to train the NN. Do any of you know of a good article about the classical train method, that is feed forward (if i'm correct) ?
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  4. #14

    AI for car game

    Another NN article you might find interesting...
    http://www.onlamp.com/pub/a/onlamp/2...orGameDev.html
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  5. #15

    AI for car game

    if you compile the delphi nn example then it works. though there are some errors in the code
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  6. #16

    AI for car game

    Quote Originally Posted by savage
    Another NN article you might find interesting...
    http://www.onlamp.com/pub/a/onlamp/2...orGameDev.html
    Umm i've read it but i found it quite superficial. It tells almost nothing practically useful.
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  7. #17

    AI for car game

    I agree, I thought the links it provides might be more usefull.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  8. #18

    AI for car game

    Heres how i might do it...

    Set up your AI driving points around the track - these are joined by lines, and you need functions do be able to get the position on the line at a given distance from each point. You will also need to be able to get the distance from each point and the distance from the desired position (on the ideal driving line).

    What do drivers do? Steer, brake and accelerate... these functions need to be accessible by the AI.

    Calculate which way they need to steer to move closer to the desired position (which will change every time they move)...
    Desired position is the distance from the next AI point to the car, but measured along the ideal racing line (and maybe altered to 'look ahead' slightly, reducing the distance measured)
    Direction can be calculated via a 'get angle to point' function or dot-product or something similar.

    The steering factor should be given in an amount (x > 0 < 1) or something so you can tell how hard the car has to steer (further away = more steering needed).

    You then need to find out the steering factor for: obstacles, other cars, and desired road position (to allow overtaking )

    Finally, add the steering inputs together, weighting each input according to its importance (if a car is within 2 car lengths, car collision input might be more important than track steering input, likewise if the car is near a AI point, track steering maybe more important than the others)

    This will result in a VERY simple neural net type AI. Further improvements may include 'fuzzy' logic, where at distance the desired points and input become 'blurred' - instead of steer left 0.21 units, it may be 'steer left a little bit', leaving it up to the AI to randomly decide how much a little bit is, this will introduce humanlike behaviour in the driving. also, when calculating AI point position, add a random factor influenced by distance... the more distance there is from the point concerned, the more inaccurate the returned point maybe.

    Sorry if all this is confusing, and sorry if the topic is dead
    I love AI stuff however, and often the concepts are hard to put in clear words.

    Oh yes, and to add uniqueness to each driver, try altering the following variables (much like real drivers) - reflexes, accuracy, aggression, and the weighting of each input.

    Mix that with cars with different abilities (Acceleration, braking, steering, grip, top speed) and you should have a wide variety of racers!

    Oh yes (another one...) swap the collision steering factor for cars behind the driver and the AI drivers will try to not let you pass!

    lief

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •