Pathfinder Long Loading

0 favourites
  • 6 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • Messing with the new awesome pathfinder plugin and applied it to quite a large layout, the layout now takes quite a while to load, close to 30 seconds.

    Is this normal? The layout size is 13000, 6000

  • The pathfinder behaviour uses a simple grid-based A* search algorithm in order to determine routes between cells. Assuming you're using the default cell-size of 20, then your algorithm is generating and searching through 13000/20 * 6000/20 = 195000 cells.

    So, yes, I'd say it's normal to expect that to slow your code down ;) Either reduce your layout size, increase the cellsize, or build an alternative routing algorithm that uses a more sparse graph.

  • Ah I see, there's no lag when actually in the game which is cool, I'll play with increasing the cell size.


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's because it has to collision check every cell on startup to test which are obstacles. As tanoshimi says that means you're checking hundreds of thousands of cells on startup, so increasing the cell size should help.

  • I haven't had a chance to try out the new behavior, but does that mean that it isn't possible to do moving obstacles, as the cells which can't be passed are calculated at startup instead of on demand or every X seconds (tick would probably be too much :)).

  • dancinLion - You can move obstacles, but you'll then need to explicitly call the "Regenerate obstacle map" action before next calculating the route.

    Note that this totally regenerates the grid array, so you certainly wouldn't want to do it each tick ;)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)