Premium Article

Understanding the Second-Generation of Behavior Trees – #AltDevConf

with , posted on March 21, 2012

This PREMIUM recording is available freely (for a limited time) as a weekly special thanks to our amazing sponsors.

“ ”

If you'd like to access our full library of content, all you need is a PREMIUM membership. It takes a few minutes or less to sign-up, and you can access these additional benefits:

  • Mobile-friendly version of the broadcast video.
  • Slides for download as used in the interview.
  • Members-only RSS feed for immediate updates.

Either way, stay tuned to find out about the next broadcast or weekly special. If you have any comments feel free to post below or on social media.

Discussion 2 Comments

DelScorcho on April 6th, 2012

Great presentation as always, Alex. One thing I've found useful for memory efficiency is to allocate all Tasks (which I call "memories" in my implementation) for the entire tree when an agent subscribes. Instead of pooling the individual memories, I pool the entire contiguous block that accommodates all the aligned memories for a given tree subscription. It just simplifies some of the hassle involved with pools that're managed separately for each individual memory type, which can be numerous in big trees. This way I do one allocation when an agent subscribes, but keep it around when the agent unsubscribes (dies, for example), leaving it ready for re-use. This also gets me similar cache coherency gains as with the static data, for which I use the same scheme. You also describe this in your presentation. FWIW, my nodes and memories are sorted breadth-first in memory, which gave me marginally better cache performance than depth-first, but I also tend to have wide trees that feature roughly 2x as many selectors as sequencers. It's a bit like I hint to the system that a node is more likely to fail than succeed -- sending the search wider rather than deeper.

alexjc on April 13th, 2012

Thanks for the insight! I will try to investigate the DFS vs. BFS storage order too, I do think it's a good area of research for a bachelor's project in Game/AI ;-) With an event-driven implementation, I've never really had big performance problems with the tree, and a pool worked fine for me... Alex

If you'd like to add a comment or question on this page, simply log-in to the site. You can create an account from the sign-up page if necessary... It takes less than a minute!