Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Refining and Streamlining Behavior Trees

The deeper we get into development, the further our performance was taking a hit. Part of our profiling resulted in discovering that our Behavior Trees were performing less than desired and needed them to be addressed to improve framerate and gameplay.

The issue was the excessive use of Behavior Tree Services. These services, while useful in specific circumstances, can be a detriment to your design if you misuse them, adding more tick strain on the main thread with each service.


How do we resolve this? Decorators! We can create custom decorators that run only once per cycle of a branch of a Behavior Tree and use them to determine simple things like whether a cooldown is ready, or if the AI is within attack range.


The improvement to performance is notable, but there are some situations where this is not the best solution. If you have a conditional loop, you may want to be running a service to update the variable used for the loop condition. Conditional loops use blackboard values for the condition, but Decorators generally return a Boolean value which determines if the branch is continued.

This is a less likely scenario to come across unless you have very specific designs in mind, however I have found that the Decorator path is very efficient.

author: Clinton Butler
Posted on 6/29/2023

Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.