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

[pygame] Re : [pygame] car game AI



Yeah,

I read the papers regarding A* realistic movements and the ones concerning the steering behaviors. At the moment, i divided my circuit into area and this is how i do : i randomly choose one point per area for each ai and i find shortest path between those waypoints using A*. This way i have not always the same path for all the AI.
So now the idea is to make the movements more realistic. In the paper i read, there is something concerning movement on roads ( basically vehicules movement i think ) and it said that to provide such kind of movement you should not have to smooth the path etc...
Actually i have my own idea to create kind of more "realistic" movement for my ai cars. I think to attach to each car a lure the follow the path and my ai only follow the lure. The lure would have a higher speed than the car so it should create kind of smooth turns. And in case of collision of the car, i thought to just reset the lure position to be in front of the car Ãnd recalculate the path to the next waypoint.

Tell me what you think. Thanks.


----- Reply message -----
De : "Jake b" <ninmonkeys@xxxxxxxxx>
PourÂ: <pygame-users@xxxxxxxx>
Objet : [pygame] car game AI
Date : sam., sept. 24, 2011 21:48


Note: Learn how to use vectors. You will need this for steering, and movement. (You technically don't, but it's much simpler)

The *very best* tutorial to A* pathfinding : http://theory.stanford.edu/~amitp/GameProgramming/ ( Great diagrams )

These are relevant for your racing, and terrain.

Making sure you saw these specifically
http://www.red3d.com/cwr/steer/PathFollow.html
http://www.red3d.com/cwr/steer/Unaligned.html
http://www.red3d.com/cwr/steer/CrowdPath.html
http://www.red3d.com/cwr/papers/1999/gdc99steer.html
http://www.red3d.com/cwr/steer/Obstacle.html
http://www.red3d.com/cwr/steer/Containment.html

Now you could implement physics with pymunk, but that could be overkill at this point. If you write your own physics, make sure you keep a constant-time-step for stability. If a crash happens, apply a force. And continue steer behavior as normal.