AI in Game Programming: Behaviour Tree Code

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)

And:
http://www.sgtconker.com/affiliated-projects/brains/ – Which is C# and XNA, but probably a little more in depth.

A fairly new behaviour tree middleware tool is GameBrainsAI’s tool . It’s in its very early stages at the minute, but the plus side is that you can download an evaluation copy for free and use the visual editor and see what kind of code it generates.