Yet More On Behaviour Trees

So I've been going through as much stuff on behaviour trees that I can find to try and figure out whether they're going to be appropriate for what I'm doing and how they actually work. "Behavior Trees for Next-Gen Game AI" is very comprehensive and well worth a watch if you're interested (despite my dislike for videos - text is just so much more practical), and I think I can see how it would come together to produce interesting behaviour.

In a way I'm actually feeling a little disappointed - the current game design doesn't call for massivly complex AI (you are fighting zombies after all) but now i have the urge to switch to something with fewer enemies with a much richer set of behaviours. But that will have to wait, and the current game will give me a chance to walk before I run anyway.

I'm not entirely sure how i'm going to handle interrupted states and animation (like when an enemy gets hit right in the middle of an attack). Currently I'm thinking of having behaviours listen to events, and making them fail and bail out if they take damage. It seems like it would work, but it sounds like it would require handling this event all over the tree, which could get tedious and error prone. On the other hand it might be a good way of intelligently playing different damaged/death animations depending on what we were doing at the time.

7 Responses to “Yet More On Behaviour Trees”

  1. alexjc Says:

    The reason for the video is that I prepared the whole talk for the Game Developer’s Conference (GDC) and it was an easy way to get all that work down for future reference.

    It’s true though, a comprehensive article would do the trick too. (Damian Isla’s Halo 2 paper on Gamasutra is not bad though.)

    Alex
    AiGameDev.com

  2. JC Says:

    I’ve not seen the Halo 2 one, I’ll have to hunt that down, thanks. Have you any ideas for handling the transitions to damaged/death behaviors and animations that I mentioned above?

  3. alexjc Says:

    The important thing here is to decouple your AI logic from the animation state. So you don’t have the AI mirror individual transitions in your animation systems. Instead, you just have the AI decide what to do based on the animation state variable, which is decoupled.

    So when you request a death animation, the AI reads the current animation state, potentially using other factors to decide what to do, then requests an animation.

    Does that make sense? It’s getting late :-)

    Alex

  4. JC Says:

    I think that makes sense, although it probably means my animation system needs another layer to handle that kind of request since at the moment it’s pretty simple.

    I’m getting to the point where I can’t quite see the wood for the trees – I suspect the best way forwards now is to get my hands dirty and see what works and what doesn’t…

  5. alexjc Says:

    Definitely! Get something working even if it has flaws, then improving it the next time around is much easier :-)

    Alex

  6. Game AI Roundup Week #28 2008: 13 Stories, 1 Video, 1 Quote, 1 Event — AiGameDev.com Says:

    [...] TriangularPixels.com » Yet More On Behaviour Trees [...]

  7. HappyPete Says:

    A big Hello Friend, I am commenting from Sydney, Australia. Thanks for the great article. It helped me a lot with my college internet research essay :)

Leave a Reply