AI following racetrack?

Hello

I am trying to make a simple racing game, but the one main thing I’m not sure about is the AI. How would I make it so that I could have between 3 and 7 other characters to race against, and have them all follow the track correctly, and maybe go around each other instead of crashing into each other? Kind of like chocobo racing on Final Fantasy 7 or choa racing in sonic games.

Thanks

I dont’ know but you should look how club silo works :
http://www.luma.co.za/labs/category/game-prototype/

Ok wel thats a little more complicated than I want. Is there a way to make an object follow a path but stil be able to move off the course just a little bit? Just so that it’s not a line of racers.

Edit: One thing I saw before was converting a pathto ipo then move an object along the ipo. Is there a way I could do that but have the racers able to move side to side and not just straight along the path?

Its more complicated then using an ipo but you could expose all the functions the player has when controlling the car to an AI controller, things like steering, throttle and brake. Then code up some behaviours like overtaking, stopping other cars from overtaking, simply following the track (pathfinding, nodes?) which would be like a ‘sub behaviour’ as it has to run all the time.

I’m no expert on AI but I guess thats a start.

You could try to have an empty following the path and parent your racer to the empty. The racer could then move side to side in relation to the empty (local movement) in order to move side to side whilst moving along the track. This would need some interesting scripting to avoid collisions between racers or the sides of the track, but would probably be simpler than a full racing AI.

Edit: You could perhaps use the ipo in place of pathfinding around the track and then create logic for the various situations described by andrew-101. You would need to create a method of accelerating/decelerating along the ipo and collision avoidance anyway.

You could use a track to node system I suppose.

Set up logic bricks to track to a set of invisible/ghost cubes, and when they collide it goes to the next and accelerates towards it. I’ve played with this and it is able to veer off course, Perhaps with a collision with property “playerbox” that forces it to move towards a direction away from the player and other AI’s? I know something similar was used in GRUBS, (Collision with “wall” caused the Carnivore to rotate in a random direction to spit it off somewhere else)

Ok well I don’t really need accelerating/decelerating, I want it to be some sort of animal racing, so main speed and have stamina so they can run faster for a time. The only thing I really need help with is making ai follow the course. It might not matter if they crash into eachother. I’ll try a few of these things and get back to you guys.

Edit: So how would I make it go to the next target when it hits one? I’m still kinda new to this type of stuff.

hi IAmThisGuy,

Have you taken a look at this thread by fisicomolon?

AI car example–UPDATED 3/29/2009 NOW WITH STEERING

Clark

Yes I have, and that should work, but I’m not sure how to make it work with multiple racers. I don’t need the physics, so just create multiple boxes? One for each racer to follow?

Ok so here was my little test, ony thing I am wondering is how to make it so that when the racer get stuck behind a wall, or are goind to hit something they move out of the way. Can someone help me with this part?

Attachments

Racing test.blend (180 KB)

You could always use the Mario-Kart system. If a player/ai gets stuck off the course a guy comes over and puts you back.

Ya but my guy gets stuck on the course Maybe I just need to decrease the angle of obstacles. Check out he blend.