I’m experiencing performance issues on Xbox, compiled with GDK, using Behaviour Trees. I have ~20 agents running the same BT and i’m seeing some significant frame drops. Looking at the profiler, a lot of time is spent in selector, sequence, node and decorator updates. by the time I get to my custom action, the amount of time is pretty low. Even if I can lower the time of my custom code to 0, I’m still in the red
attached are two images; one showing the top of the BT call stack and another showing it at the custom action.
Any insight on what might be causing this would be greatly appreciated!
Hello from here as well and sorry for the late reply!
Composite nodes like Sequencers and Selectors or decorators like the “Accessor” (shown as ConditionalEvaluator in the profiler), should not by any means create garbage and it usually is up to the tasks (actions/conditions) that depending on what they do, they might. Looking at your profiler pic it looks like the condition task you have assigned on the Accessor Decorator as well as the AgentAction and Spritefollow actions are creating most of the allocations, but can you please also post a screenshot of your graph so that I have a better context?
Also, does your graph repeats very frequently (maybe per-frame), meaning that it completes its cycle start/restart very frequently?
I have found the cause of the garbage and it is indeed in my code. I was able to clean all that up! However, I still see considerable impact to performance on xbox one. The flow of the tree used to (and indeed did in the pictures above) repeat over and over. I have since changed the Action to not call EndAction whenever the agent is at rest.
Attached is the relevant part of BT for the Spriteilng – it’s a rather large BT so if you need more context, I’ll be happy to provide it. As you might have guessed, this task on the BT is the follow logic for our little creatures called Spritelings. Some of the structure oddities are from when I didn’t know how to use the tool. Time constraints have not allowed me to go back in and fix it up haha.
Also attached is the profiler on PC for a single Spriteling. You can see some functions are called 9 times per frame per Spriteilng. But maybe that’s okay? If I had to guess, I’d say that’s because of they “Dynamic” flag on the conditionals?
I’ll post an update soon with the profiler actually running on an xbox one dev kit, but I just wanted to pass this along for now to see if anything stood out.
Update: here’re the profiler captures at the top of the BT stack and at the bottom AFTER cleaning up garbage allocations and making sure we don’t needlessly start the tree over and over again. I’m still seeing a lot of time being spent in all the Sequence/Selectors and Decorators