Tutorial :C# XNA: AI Engine?



Question:

I'm developing a game with zombie running around in a swamp. I want AIs to have functionality like "chase this target" or "run away". A major stumbling block is pathfinding. Is there a good pathfinding/AI engine in XNA, or should I roll my own?

Does anyone have any experience with this: http://www.codeplex.com/simpleAI?


Solution:1

you may want to look for A-Star algorithms... here is an article that talks about it in the context of a winform, but mentions XNA.


Solution:2

Roll your own! Seriously.

I take it you're making this game as much for the enjoyment of coding, as you are hoping for fame and riches? Pathfinding is one of the staples of AI, and is a well studied and documented topic. It is an excellent introduction to a field you'll need knowledge of in future game endeavours.

The A* Algorithm (as mentioned by others) is the standard solution to this problem - but try other approaches: line-of-sight, scripted movement, flocking... often you can derive interesting behaviour from combining a few techniques.

For a book on the subject, try AI For Game Developers - not the best in the field, but certainly an accessible introduction for the lay-coder.

Have fun mucking about with the zombies!


Solution:3

http://xnapathfindinglib.codeplex.com/

http://swampthingtom.blogspot.com/2007/07/pathfinding-sample-using.html


Solution:4

To everyone that's suggesting A*: you generally wouldn't put vanilla A* into a game. There are a lot of improvements and extensions for A* including (but not limited to) IDA* and transposition tables, that improve performance with A*-based search.

You might want to use a library to get you started but you may ultimately benefit more from your own custom implementation, using your own data types native to your app, instead of having to marshall data back and forth. But you'll need to profile to be sure.


Solution:5

The XNA Creators club has samples for Chase and Evade and Flocking.

I've just started down the path, but they seem to have some good resources on the creators.xna site.

I'll be using some pathfinding logic in my game, the A* Algorithm seems to be the winner for me.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »