Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# XNA: AI Engine?

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?

like image 842
Nick Heiner Avatar asked Mar 25 '10 22:03

Nick Heiner


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.

Is C language easy?

C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.

What is C in C language?

What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.


4 Answers

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.

like image 130
tbischel Avatar answered Sep 24 '22 12:09

tbischel


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!

like image 41
rob Avatar answered Sep 20 '22 12:09

rob


http://xnapathfindinglib.codeplex.com/

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

like image 2
Joel Martinez Avatar answered Sep 23 '22 12:09

Joel Martinez


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.

like image 2
Shaggy Frog Avatar answered Sep 20 '22 12:09

Shaggy Frog