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 ?

  • 1
    \$\begingroup\$ "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. \$\endgroup\$
    – Kylotan
    Commented Apr 23, 2011 at 0:11
  • \$\begingroup\$ original article is no longer online. here's an archived copy: web.archive.org/web/20110429053741/http://altdevblogaday.org/… \$\endgroup\$ Commented Apr 11, 2015 at 2:09
  • \$\begingroup\$ I found these two implementations written in Java: gdx-ai jbt \$\endgroup\$
    – milos
    Commented Jul 15, 2019 at 18:44

1 Answer 1


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 AIGameDev.com).

For code examples, take a look at:
http://magicscrollsofcode.blogspot.com/2010/12/behavior-trees-by-example-ai-in-android.html - 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?

  • \$\begingroup\$ Can anyone find the BT SDK from GameBrainsAI? \$\endgroup\$
    – gap
    Commented Mar 21, 2012 at 13:42
  • \$\begingroup\$ It looks like that project has disappeared, which is a shame. \$\endgroup\$
    – Ray Dey
    Commented Jun 7, 2012 at 0:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .