Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In the past, I've used simple systems like finite state machines (FSMs) and hierarchical FSMs to control AI behavior. This pattern falls apart very quickly or any complex system.

I've heard about behavior trees. They seem like the next obvious step, but I haven't seen a working implementation or really tried it yet.

What other patterns can make complex AI behaviors manageable?

share|improve this question

closed as not a real question by Anko, Josh Petrie, Byte56, bummzack, Trevor Powell Apr 12 '13 at 13:43

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
I also heard there are several ways to manage state machines –  jokoon Apr 22 '11 at 19:02
1  
This is a pretty vague question. There are many techniques for managing "complex" AI but the best one for any given situation may be different from another situation. I've implemented fairly complex AI using nothing but behavioral action lists, but that solution woudln't work for an RTS; the techniques I've seen used in RTS games were incredibly complex yet still elegant, however they'd be all but worthless in any other kind of game. If you've got some specific kind of game or AI in mind, you might get more relevant and insightful answers if you state what that is up front. –  Sean Middleditch Nov 18 '11 at 5:39
add comment

3 Answers 3

up vote 3 down vote accepted

Behaviour trees are a really great way to manage AI, and Ai Game dev is the best place to learn about them! There are tonnes of example implementations out there on places like Codeplex, or even AIGD's own Sandbox engines implementation (which admitedly is fairly complex and can be hard to follow).

Last year at the game AI confrence there was alot of excitement about planners, but this year alot of that had fallen away. Best tip seemed to be just to start simple. The whole 20% of the work to get you 80% there thing seems to totaly hold true in most cases

share|improve this answer
add comment

One think I think is important is to seperate why an agent wants to acomplish something from how it does it. Goal-orientated Action Planners do this well, but there are also other solutions. This gives you great flexibility for constructing agents as you can pick and choose from a bucket of goals and a bucket of actions.

Behaviour trees are designed to ecompass the whole solution - decision making as well as actions - and as such can be hard to maintain.

share|improve this answer
add comment

One technique you should be familiar with in any case is the action list approach. At the simplest level, it's just a list of action objects, which each action object has its update() method called each frame. You can quickly expand on this however to allow blocking actions, multiple lanes of actions, child groups, etc. Just about anything you can build with a high-level FSM can be implemented in a more modular, flexible, and debuggable fashion with an action list using behavior actions.

Aside from being a useful technique for managing all the animation, path finding, and other miscelleneous "stuff" your characters can do, it makes it trivial to implement a priority-based decision making system by creating behavior actions.

A few notes about how to use them can be found in this slide deck: http://sonargame.com/2011/11/01/new-game-slides/

Pretty sure there's been articles about it in the AI Programming Wisdom series, too.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.