Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Obviously the most interesting article I found on this website. What do you think about it ?

It lacks some code example, don't you know any ? I also read that state machines are not very flexible compared to behaviour trees... On top of that I'm not sure if there is a true link between state machines and the state pattern... is there ?

share|improve this question
"State" just means the data that represents an object at that point. The "State Pattern" is a way to represent this state data in certain programming languages. And a "state machine" is a way to handle changes of behaviour based on an aspect of the object's state. This question should really be split into several because you're asking a few things that aren't very related. – Kylotan Apr 23 '11 at 0:11
original article is no longer online. here's an archived copy:… – Patrick Klug Apr 11 '15 at 2:09
up vote 18 down vote accepted

Behaviour trees are getting pretty big in the industry right now. Halo 3 uses them extensively for their AI (Halo 3 - Building a Better Battle).

Alex Champandard seems to be a big fan as well (Lots of articles on it on

For code examples, take a look at: - The example is in Java, but self-explanatory)

To answer your latter question: State Machines: State Object versus sequential check: what are the pro/cons?

share|improve this answer
Can anyone find the BT SDK from GameBrainsAI? – gap Mar 21 '12 at 13:42
It looks like that project has disappeared, which is a shame. – Ray Dey Jun 7 '12 at 0:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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