Using Behavior Trees and Events together
Posted
by
weichsem
on Game Development
See other posts from Game Development
or by weichsem
Published on 2014-04-08T22:11:02Z
Indexed on
2014/08/18
22:33 UTC
Read the original article
Hit count: 298
I am beginning to work with behavior trees and am unsure how events should be handled within the tree. Lets say we have a space game where the player is dogfighting with a handful of other ships, some friendly some not. The player destroys a ship and the rest of the hostile ships should then start to retreat.
How was should the shipWasDestroyed
event effect the other ship's behavior trees so that they start running the retreat behavior?
One way I could think of doing this is have all the conditions I care about be high level nodes that effectively state change the ship. This would mean I'd have to check all of these state change conditions on every frame the behavior tree was run, even if they are very rare occurrences. I'd prefer not doing this for performance and complexity reasons.
From looking at the Halo papers on behavior trees it seems that they handled this by dynamically placing nodes into the tree when the event occurred. It seems like calculating where the new node should go could be problematic depending on the current state of the running behavior.
How is this normally handled?
© Game Development or respective owner