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

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

And: – 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.