Pathfinding can only handle 2 paths at 'the same time', how do I fix that?

From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • So I'm doing some tests with the pathfinding on C3 to see how much the pathfinding can handle in terms of speed, unfortunately the tests gave me some really bad results, with a simple game code like the image below:

    the text object only append 2 'a' after sprite finds a path instead of 4 when I click with the left mouse button. How can I fix that? is that because of the way the pathfinding code works with those webworkers?

    please note that this also occurs in C2.

    A solution would be really appreciated, I need it to handle like 20+ objects created at a repeat loop. In terms of comparison, the pathfinder behavior tested on c2 made by rez handle this with no problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You are creating 4 instances of Sprite2 at the same time. How Sprite is supposed to find path to all four of them?

    One pathfinding instance can have only one active path. If you tell it to find another path, the previous path will be lost.

    Also, Find Path is an asynchronous action. Depending on the map size and other things, it may take different amount of time to find path for different objects. That's why you see only two "a" in the text. On a slower machine or on a larger map it will be just one "a".

  • You are creating 4 instances of Sprite2 at the same time. How Sprite is supposed to find path to all four of them?

    One pathfinding instance can have only one active path. If you tell it to find another path, the previous path will be lost.

    Also, Find Path is an asynchronous action. Depending on the map size and other things, it may take different amount of time to find path for different objects. That's why you see only two "a" in the text. On a slower machine or on a larger map it will be just one "a".

    the problem is that as I said this solution was possible with the pathfinder made by rez, maybe because pathfinding is asynchronous it takes more time to calculate the path and then can't handle a path per tick, but I got it to work by basically inverting the order of path, instead of sprite 1 search for 2, when 2 is created, it searches for 1, then each separate sprite can be calculated by their individual time

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