BD Performance Issue

Hey. I have a scene where I have 14 enemy AI characters which are all using BD and UCC. Currently the overall performance demand in profiler increase by 80-100ms when I turn on these characters, even when they are not shown in the camera. They are mainly sharing two behavior trees, one for melee and one for archery, and use different variables for individual characters. What may be causing such a great performance demand and what can I do to fix it?


1539744419598.png
 
Below is the tree view. Game runs at about 16ms when I turn off all characters. All characters are using one of the two trees as external trees. I mainly took your trees from the melee and shooter demos and slightly adapted them so far.
1539825221028.png
 
Looks like you are doing some logging - LogStringToConsole is taking up a large amount of time, followed by EditorOverhead which won't appear in built games.
 
Is this expected behavior for 14 AI agents using BD? Or did I do something I should not be doing? 56% of the CPU usage seems to be used by BD. It is really working fine in the built game, but game slows down a lot in the play mode in editor, even though I have a pretty barren scene other than the player and AI agents. Is there a way to improve the performance? Right now each new agents seems to be adding about 5-10ms on the performance, so this is not very sustainable.

I may also look into disabling BD when the player is away from the characters. Is that possible to do with BD? For example, since I have a 2.5D camera, i may have 2-4 AI agents in scene at a time, and the rest could have their trees suspended.
 
Where do you see that 56% of the processing power is used by BD? In that call stack BD updates within the Update loop which is only 5.5%.

The majority of your execution time is spent on EditorOverhead, updating the animator, and logging to the console.
 
I think I was confused about that, sorry. It seems like even when I disable behavior designer on all characters the ms does not seem to go down a lot. I tried to disable all other UCC components one by one on each 14 characters, but I could not identify which component is actually causing the spike.
 
Top