Pathfinding Enabled On Start

0 favourites
  • 5 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • I'm making a large scale game at the moment with a very large layout (16k x 16k). So far everything is running smoothly, but I notice now that I've added pathfinding to one enemy type, when the enemy is loaded into RAM for the first time, if the pathfinding is enabled on the sprite, it hangs for a few seconds. Then all of created sprites afterwards load instantly and everything is fine. If I turn off "enabled" on the sprite and load it for the first time, there is no fps hang.

    I've tried setting obstacles to custom, and that seems to have helped, but there is still a small stutter on creation. Being that most of the enemies in this game will have some sort of pathfinding, is there a reason this is happening? Currently there aren't a lot of objects in the game (just 1 tilemap and maybe 100-200 sprites for testing purposes).

  • load the enemy into memory at start of layout, either create event or have it in the layout then destroy it, that should stop a stutter on creation. If it's not this then it could just be lag when generating obstacle map across 16kx16k layout.

  • - right; but if you consider ~3-4 seconds per enemy and over 20 enemies have pathfinding enabled, you can see the issue right there. I'm only ever updating the obstacles in a region and don't want the whole map checked, but it doesn't seem to be able to enable the behavior and stop it from checking literally everything...

  • Yes the pathfinding uses the full layout, you can regenerate obstacle map to a small section but this is still kind of CPU intensive sometimes. Take a look at the 'extreme pathfinding' section here to make sure you are not making any of these mistakes. construct.net/en/blogs/construct-official-blog-1/common-mis-used-events-and-gotchas-822

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • - the way I’m regenerating the map is fine. I’ve tried it with around 20-30 enemies at the same time and it seems to be okay.

    If I can’t get rid of the opening lag, I’m not sure what else to do.

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