BT performance with a couple hundred agents

Forums 💬 NodeCanvas ⚙️ Support BT performance with a couple hundred agents

  • This topic has 0 replies, 2 voices, and was last updated 2 years ago by inmaculada.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #15275
    inmaculada
    Participant

      Hi,

      I wrote this message a couple weeks ago in continuation of an older post in the ‘General Discussion’ section (https://nodecanvas.paradoxnotion.com/forums/topic/bt-performance-issues-with-100-200-agents/) because I thought it would be easier for you to have same issues on the same post, but I’m thinking that maybe you don’t look at that forum as often, so I’m copying it here. I hope that’s OK:

      I’m working on a strategy game in which up to 400 units should be alive, moving, attacking, etc. but 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:

      [attachment file=”1.profiler.png”]

      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?

      [attachment file=”2.deep-profiler.png”]

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

      [attachment file=”3.node_.reset_.png”]

      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.

      [attachment file=”4.deep-profiler.png”]

      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

      #15277
      inmaculada
      Participant

        I couln’t add a 5th file to my previous message, here’s the most complex BT that I’m implementing for context:

        [attachment file=”5.more-complex-bt.png”]

        #15276
        Gavalakis
        Keymaster
        Viewing 3 posts - 1 through 3 (of 3 total)
        • You must be logged in to reply to this topic.