开发者

C# XNA: AI Engine?

开发者 https://www.devze.com 2022-12-24 12:46 出处:网络
I\'m developing a game with zombie running around in a swamp. I want AIs to have functionality like开发者_C百科 \"chase this target\" or \"run away\". A major stumbling block is pathfinding. Is there

I'm developing a game with zombie running around in a swamp. I want AIs to have functionality like开发者_C百科 "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?


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.


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!


http://xnapathfindinglib.codeplex.com/

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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消