9
\$\begingroup\$

So let's say you've got a spline-based racing AI. Assume it can already handle the basics of braking and steering around the track.

How would you structure and implement collision avoidance, overtaking, drafting, blocking and other behaviours so your cars remain competitive but make interesting races?

Links to papers/implementations would be awesome.

\$\endgroup\$
1
  • \$\begingroup\$ what kind of engine you are using, \$\endgroup\$ Commented Aug 18, 2016 at 16:12

3 Answers 3

7
\$\begingroup\$

Have you seen Steering Behaviors For Autonomous Characters? I would consider a "CrowdPathFollowing" algorithm for staying on the track and avoiding collisions. You might be able to mix in a "Flow Field Following" behavior for drafting, passing and blocking - make the flow field follow the the player's past and projected path, but split around his current location.

      /-------------\
 ----<  [playerCar]  >-----
      \-------------/

That should cause the AI to tend to follow directly behind him and move directly in front to block, yet encourage clean passes.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ I'm aware of boids, but it's good reference. I'm a bit scared of many many behaviours (stay on racing line, avoid cars, block, draft, etc) interacting in ways that are too complex to tune, and ending up with the occasional edge case collision. This is fine for pedestrians, but catastrophic for race cars that need to keep moving. \$\endgroup\$
    – tenpn
    Commented Aug 5, 2010 at 7:50
  • \$\begingroup\$ I've worked with the OpenSteer API which implements a lot of this stuff. I've found it pretty easy to tune. In your case I'd make the "SteerToAvoidCollision" weight very high. I don't know what vehicles you are racing, but I'd think that if you get it right for the vast majority of cases, then the remaining occasional bump or bash due to an edge case is probably pretty realistic.... \$\endgroup\$
    – AShelly
    Commented Aug 5, 2010 at 23:07
  • \$\begingroup\$ Was that steering vehicles or something else? I'm scared of situations causing problems such as two vehicles ahead to your left and one ahead to your right. The average vector would result in a movement right, even though that might bring you into contact with the right-hand vehicle. \$\endgroup\$
    – tenpn
    Commented Aug 9, 2010 at 13:04
  • \$\begingroup\$ I was working mostly with pedestrians, so I can't swear it will work. One thing to remember is it doesn't have to be a blend of behaviors - it can be a heirarchy. So you can have collision avoidance take a higher priority to anything else. In the case you describe the car would only go right until the predicted path intersected the right-hand car's path, at which time avoiding that collion becomes the overriding force. You can also add special conditions: for instance, if no safe path is found in N frames, add hard braking. \$\endgroup\$
    – AShelly
    Commented Aug 9, 2010 at 22:57
2
\$\begingroup\$

There was a session partly about that at this year's AI Game Dev conference in Paris. You can find the slides and a summary here:

http://aigamedev.com/open/coverage/paris10-report/#session9

\$\endgroup\$
3
  • 1
    \$\begingroup\$ The link to the ppt is 404. >_< \$\endgroup\$
    – tenpn
    Commented Jul 15, 2010 at 12:04
  • \$\begingroup\$ @tenpn: It's a pptx: files.aigamedev.com/coverage/GAIC10_PaoloManinetti.pptx \$\endgroup\$ Commented Jul 15, 2010 at 13:29
  • \$\begingroup\$ ta -- his approach is interesting but the code I'm currently working with is actually more advanced! \$\endgroup\$
    – tenpn
    Commented Jul 16, 2010 at 11:37
1
\$\begingroup\$

Anti-Pattern: Opponents adapting their speed

Unfortunately I'm not able to give You patterns, but I would like to name an anti pattern. Please do not try to adapt the speed of the AI drivers to the one of the human player. The idea behind this is to create fair racing conditions for amateurs as well as pros and to abandon the need of multiple difficulty levels (and their implementation).

However, what sounds good on paper turns out to be awful in practice and the MotoGP series failed miserably at implementing this behavior. It ended up in the opponents driving at 5mp/h when you stood still for a couple of seconds and the impossibility to tell whether you've improved in the game (very bad feedback wise)

\$\endgroup\$
4
  • \$\begingroup\$ Thanks. I'm talking specifically about interesting race behaviours here rather than balancing or difficulty levels, but I'll bear it in mind. \$\endgroup\$
    – tenpn
    Commented Jul 15, 2010 at 14:12
  • 5
    \$\begingroup\$ Nearly all racing games include some form of rubber-banding to keep the player in the action, or keep the AI close to good player. The trick is to be subtle with it and know when to turn it off. Once the player notices they feel cheated. \$\endgroup\$
    – wkerslake
    Commented Jul 15, 2010 at 19:42
  • \$\begingroup\$ The MotoGP situation sounds like a problem of taking it too far, rather than a problem with rubber-banding in general. It is not unreasonable for drivers at the front to drive with more caution and cars at the back to try more desperately to close the gap, and I think there's value in modelling it that way and presenting that transparently to the player. \$\endgroup\$
    – Jibb Smart
    Commented Aug 19, 2016 at 1:58
  • \$\begingroup\$ This is an interesting post on the topic: gamasutra.com/view/feature/3920/… Basically they put you in 3 groups of AI racers and let you advance from group to group during the course of the race. \$\endgroup\$
    – Felsir
    Commented Aug 19, 2016 at 16:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .