EmptyEpsilon icon indicating copy to clipboard operation
EmptyEpsilon copied to clipboard

performance degrade after heavy drag and drop

Open amir-arad opened this issue 6 years ago • 4 comments
trafficstars

Hi consider the following scenario:

In debug mode, i use "go to GM", there I create an asteroid field, select part of it (the center ~20%) and move it furiously on the screen over the other asteroids for some 10 seconds ("shaking" it). then when I stop dragging, CPU usage remains high, the game is slow, and scripts take a long time to execute (3-4 seconds) objects count seems normal.

I guess there is some side effects left in the collision detection model? is this a solid way to simulate the effects of a long running game (24 hours and more)?

Say I want to have a "GC" button for the GM to reset these side effects, where should I start?

amir-arad avatar Nov 30 '18 10:11 amir-arad

Few things I can think off:

  • The path planner avoid objects. Easy to test by not adding the asteroids to the path planner object avoidance.
  • Box2D broadphase, this has a dynamic tree, which can become unbalanced and inefficient. Not sure how to test it. But removing and adding all collision shapes to all the objects will most likely balance out the tree again.
  • Some position value incorrectly becomes NaN, and the engine is pretty bad at handling NaNs. The network code gets confused by it, and other things as well.

daid avatar Nov 30 '18 10:11 daid

There were only asteroids in the map so i can rule out path planner?

amir-arad avatar Nov 30 '18 16:11 amir-arad

Even without anything move, the path planner is still updating internal administration.

daid avatar Nov 30 '18 16:11 daid

After working on something totally different, I figured something else that it could be, the Box2D broadphase could become unbalanced and inefficient. As this part is beyond my own scope, I'm not sure if that is always handled correctly by Box2D or that we trigger an edge case that causes this to become inefficient.

(The Box2D broadphase builds some kind of tree structure to prevent checking all objects against all other objects in collision detection)

daid avatar Dec 14 '18 08:12 daid