[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] car game AI



Hi,
 
i'm still writing my car game and now i need to think about implementing an AI. I searched on the internet for any ressources concerning AI in car games and i found some post about steering behaviors from Craig Reynolds : http://www.red3d.com/cwr/steer/. It seems to be exactly what i need but i don't know yet how to exploit this behaviors for my AI.
 
At the moment, here is my idea to simulate autonomous car behaviors :
I thought to do it this way to manage case where the car struck another car or whatever and is projected away, as the lure is virtual, the car will always be able to reajust his trajectory by steering to the lure position.
 
The problem i have now is to deal with obstacles. My circuit have some obstacles so i need to consider them in my AI. So i though to use some obstacle avoidance behaviors and top on the path following. Note the i use the "steer" behavior illustrated by Craig Reynolds for the lure and the car, the lure seek the next point of the path and the car seek the lure.
 
Here is my code without obstacle avoidance : http://pastebin.com/SqN1dJJ6
So please tell me what you think of my way to do (this is the first time i have to write this kind of AI). If you have idea to improve it and to how to implement obstacle avoidande, i linkded a diagram to illustrate the way i think it could works i still need helps for determinating the components of the force to apply on the car to avoide obstacle.
 
I hope i was clear enough, thanks.