Behavior trees are an architecture for controlling NPCs based on a hierarchical graph of tasks, where each task is either atomic - a simple behavior an agent can directly perform - or composite - a behavior performed by a lower-level behavior tree of arbitrary complexity. Because of their clean decomposition of complex behaviors, behavior trees are increasingly used to allow large software teams to collaborate on complex agent behaviors, not just in games but in the robotics industry.
One key area that makes behavior trees useful is that they can serve as a foundation for data-driven behavior design. However, there are a couple thorny areas in creating data-driven behavior trees worth highlighting. , especially if licensing or interoperability concerns prevent you from building on existing solutions like the Behavior Tree Starter Kit. This article will walk through one such example, the template machinery needed to cleanly load a behavior tree from script.