I have been trying to get behavior trees to work for a while now and am continuously frustrated by the number of hacky workarounds I have to do just to get around how much behavior trees suck by design in unreal engine. I had to create a custom task just to initialize a boolean blackboard key as “true” just so i had something to compare my other booleans against.
There’s also no real way to make it work gracefully with triggered events which has to be resolved with a mess of spaghetti code, extra unnecessary booleans and services to keep track of those booleans just to tell if a corresponding event in the controller has started or ended and no real way to make it stop doing a MoveTo action or interrupt an animation once its already started, and overall i find the entire paradigm of using sequences and selectors vastly inferior to state machines and would rather just have a behavior state machine with blackboard key functionality that allows for direct communication with the corresponding animation state machine as well.
This isn’t just a rant about how much behavior trees suck ■■■, its also a bug report. Playing any animation using the “Play Animation” node in the behavior tree fundamentally breaks my assigned animation blueprint. At first i thought it was just unassigning my pre-existing animation blueprint after playing an animation, but no, that would revert it to Tpose, and it only reverts to Tpose when i have “non-blocking” checked. Instead, it reverts to the idle animation, and keeps that idle animation regardless of how fast the character is moving.
This is despite the fact that i’ve already set up a speed variable within the animation blueprint that takes into account the forward velocity of the character and uses it to progress the state machine from idle to walking to running. And that speed variable works just fine with the Ai MoveTo function, UNTIL an animation is played through the behavior tree, at which point it all craps out and my state machine fails to work properly. Its as if the tick for “Event Blueprint Update Animation” just up and craps out on me the moment the behavior tree takes control. I’ve confirmed this by setting a state change condition that forces my NPC to trigger a death animation the moment true equals true… so, the instant it reaches idle state, it triggers the death animation properly. The state machine itself isn’t broken, but the update animation event that feeds it live information is.
The only solution as usual with these hacky workarounds is to create a custom task that does essentially exactly what the broken and worthless Play Animation node SHOULD already do… But what if i don’t want to have to create a bespoke task for literally every animation I want to be able to play in the behavior tree?
Why on gods green earth behavior trees are so broken and convoluted STILL after 5 versions of this software is beyond me. You’d think AI behavior would be the one thing everyone needs and epic would at least have an incentive to address stuff like this. But my solution now is just buy Logic Driver Pro, wait for Unreal 5 to leave early access so developers can offer 3rd party plugin support and never ■■■■ with behavior trees again.