ashmag

I'm creating a simple pac man style game using xna...Does anyone know any sites that offer good sample A.I code for path finding, that the ghosts would use, or a few tutorials...Or even using way points and no real intelligence...At the mo I can only get them moving randomly....

Re: Game Technologies: DirectX 101 A.I in games

Flavious

You may want to look at the A* (A-star) algorithm. I belive there's working code out there, as I recall. 

This is a terrific algorithm, and will work for Packman or Quake, though in 3D it gets a bit trickier.

I don't think that XNA has anything to do with pathfinding, though.





Re: Game Technologies: DirectX 101 A.I in games

ashmag

Xna is just the game studio i'm programming it in so C# is the programming language I'm using. I'm not to sure tho how i'd implement this algorithum tho. I know in standard pacman only one ghost would be programmed using A*. Just not sure where to start..



Re: Game Technologies: DirectX 101 A.I in games

Etienne2005

Pathfinding is done with recursive function

Basicly you call a function that try to go to 4 direction from one point

You go to that new direction and call the same function again

Your function will stop when the position is not reachable

And the recursive function will search all possible path until it find the pacman

This will very fastly evaluate many possible path

Your Ghost may be program to be going to the path that would lead to your Pacman faster or slower

By randomly choosing the longuer path or the shorter path

Or even run away from it when your pacman ate the pills







Re: Game Technologies: DirectX 101 A.I in games

Etienne2005

 

Make sure you read the last post to correct the code the first post provides...

http://forum.java.sun.com/thread.jspa threadID=400288&messageID=1747547