Great lesson! I really appreciate the way you discussed this really interesting argument.
Is there any library out there that implements Behaviour Trees as you suggested ?
How do you suggest to handle concurrency if you are working in an environment which is not multithread ?
There's not much out there in terms of behavior tree library. I'm currently working on Game::AI++ but it does more than the simple implementation mentioned here, so it's not as easy to work with...
The ideas I present in the talk are not designed for multi-threaded environments. As I mentioned, it's all in a single hardware thread only using logical concurrency in a Windows 3.1 cooperative scheduling way.
Behavior Trees for Next-Gen Game AI (Video, Part 3)
<p class='premium-pre'>A new feature has been posted.</p>
<!-- <img src="http://aigamedev.com/" class="alignleft" /> -->
<p> Here’s the 3<sup>rd</sup> and final of my lecture at the <tt>GDC</tt> in <i>Lyon</i> a few weeks ago. Be sure to view the <a href="http://aigamedev.com/videos/behavior-trees-part1">overview of behavior trees</a> in part 1, as well as the following discussion of <a href="http://aigamedev.com/videos/behavior-trees-part2">goal architectures and planning</a> in part 2. This video is exactly <u>15:03 minutes</u> long, and is worth roughly 5.5 Mb of bandwidth!</p>
<p>In the video, I discuss how to use parallel tasks which handle logical forks and joins to create concurrent subtrees. Then I show how you can use read-only concurrency to monitor the assumptions of a tree which can help it bail out if something goes wrong. Also, I explain how decorators can be used as resource allocators to help synchronize independent trees that were edited modularly. Finally, I sum up the whole talk and give you some ideas for expansion.</p>
<p class='premium-post'><a href='http://aigamedev.com/index.php?id=23&tx_ttnews[tt_news]=1000250'>Click here</a> to read the original post.</p>
Thank you for the videos, this was a great introduction to the topic.
It seems to me that BTs solve a lot of problems posed by HFSMs and scripting languages, but they're not ideal at everything. In particular, it seems that a BT designer needs to jump through a lot of hoops to make a properly interruptable tree. For example, if my dog is patrolling, and he suddenly gets shot with a BB gun, he should bail out of the patrol behavior and react right away (with an entirely different tree). But so too if he is eating, hunting for a bone, etc. And other things should also make him bail out in different ways: spotting a squirrel, hearing a call from his master, etc. I know you can set up Interrupter decorators and parallel compositions to make all that work, but it seems like a lot of repetitive work that is easy to screw up -- a sign that we may be using the wrong tool for that problem.
But this post is from 2008... have any new insights emerged in the last few years that make dealing with this easier?