Forum rules - please read before posting.

Massive Lag Spikes on Mobile

This scenario happens with any scene with a navmesh. Our game is in 2D. Whenever I click to generate a path around a navmesh on Mobile I get a massive lag spike. I went into the profiler and took a look and this is what I found. A HUGE CPU bottleneck on OverlapCircleAll is happening. Any idea why or what we can do to remedy this? Screenshot below.

Comments

  • The screenshot's locked behind a permission wall.

    How many vertices does your Polygon Collider have?  The speed of the pathfinding calculation is inversely proportional to the number of vertices.  If you can, try removing any that aren't strictly necessary.
  • Apologies about the screenshot, I'll see if I can fix that.

    Our nav mesh has approximately 40 vertices (12 for the borders and 3 obstacles with 6 each), which seems pretty minimal already.

    I've done a bit of digging into the code, and I think I've found what might be the issue. From what I can tell, inside your NavigationEngine_PolygonCollider class, it looks like you're generating the nodes of your map that you use in the Dijkstra algorithm every time you need to generate a path. I think you're then checking the connectivity between every node. Since our map is static, is there any way to calculate this once and re-use it and simply add in our new source and destination nodes?
  • Possibly - I'm always keen to improve the pathfinding.  However, it'll take some time, so please bear with things while I see to it.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.