How do I stop path finding sprites from overlapping?

  • I am trying to find how to stop path finding sprites from overlapping on their path. I couldn't find anything on this so anything can help.

  • Maybe you should look at the RTS example on the construct homepage? It is complex but it might offer some solutions.

  • FYI pathfinding with avoiding other objects is incredibly difficult. It is very easy to set things up where objects get completely stuck and nothing can move any more. By far the easiest thing to do is to allow them to overlap each other.

  • Thanks I will try my best with this.

  • Some small 'cheats' that can make it look better for mobs doing pathfinding and allowing overlap (e.g. chasing a player):

    - Make sure the animations are not synchronized on spawn (use a random starting animation frame on each instance.)

    - Randomly slightly offset the 'target' of the pathfinding from the center of the target (e.g. player origin), this may create slightly different paths and timings.

    - Randomize speeds of mob instances a little (some faster, some slower)

    - Randomize/offset when pathfinding is calculated (so they don't all start at the same time).

    This will not absolutely prevent perfect sync of mob instances and making them look like one instance, but it can help improve it.

    Otherwise, it does get complex, I worked with someone who used physics for movement and collision and then just pathfinding to get the nodes and then use physics to propel between the nodes and deal with collisions. You still need to deal with the cases when paths are blocked by other mob instances or getting traffic 'gridlock'.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply I will try something like what you recommended.

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