I’m not sure what’s causing it, but BehaviorTree when initialized is causing a massive performance drop when RunBehaviorTree is finally called in the AIController when spawning in new AI. The AIs constructor is insanely fast, but the BT is taking 0.4ms per AI and when you multiply that by say 50 it’s a bit of a problem.
I don’t feel like I’m doing anything crazy complex here. Any idea why it’s taking so long to initialize? Maybe the initial call to the service is doing it?
I think the StaticDuplicateObject is the part that is more responsible for the slowdown. If you are spawning 50 characters then maybe stagger the spawn process over time?
They’ll be staggered in live gameplay, but just curious if this can be sped up in general. Seamed strange the longest running process for spawning in my AI was just the BT initializing. So seamed like maybe a bug or I’m doing something wrong.
Just a guess, but maybe you have some hard references inside your BT? You can check references of the BT and see how deep it goes.
If you reference something in BT that references other things (and so on) all of it will be loaded with this BT which may cause some spikes.
There’s no hard references. I’m working with generic actor objects and interface functions pretty exclusively throughout the entire game. I don’t think I’ve a single cast anywhere. Even communicating to widgets I’m doing so through interfaces.
Having a hard time reading the overload of information in Unreal Insights. Trying to get a better picture of what’s going on to track down exactly what call is causing this and where. Hopefully that’ll give me more info, but good lord this tool is just too hard to read.