Reply To: BT Performance issues with 100-200 agents

NodeCanvas Forums General Discussion BT Performance issues with 100-200 agents Reply To: BT Performance issues with 100-200 agents


Hi Gavalakis, I’m having a very similar problem to timheijde’s:

I’m working on a strategy game in which up to 400 units should be alive, moving, attacking, etc. I have performance issues at 150-200 entities, so I decided to delve into profiler. Here’s the test I did with 400 entities, considering the significant overhead due to the deep profiler:

In file 1 you can see the simpler Profiler picture. Inside my BT tasks there are two expensive operations (Physics.OverlapSphere and distance calculations). The rest are simple checks and assignations, so it seemed initially weird that OverlapSphere being the most expensive operation, it only accounted for ~20% of the processing time:


In file 2 you can see a deep profiler screenshot. I understand here that Node.Reset() is just handling the subgraph. If so, would it help to delete the subgraph and copy the tasks into all the BTs that implement them instead?


Here you can see Node.Reset() in depth:


However, leaving aside the Node.Reset() issue, I also have troubles with Node.Execute(). From the 35 ms that it takes, I believe that only the half of it (~16ms) are attributable to the code within the Condition and the Actions themselves.


So I’m wondering, is there anything I can do from NodeCanvas’ perspective to improve performance? I have already in mind an alternative to OverlapSpehere, but I’m afraid it won’t be enough if I can’t find a way to trim the BT’s handling too.

Thank you so much in advance

  1. 1.profiler.png

  2. 2.deep-profiler.png

  3. 3.node_.reset_.png

  4. 4.deep-profiler.png