A question on pathfinder

0 favourites
  • 4 posts
From the Asset Store
A short demo of template sold on store, with formations on end of way for no overlaps.
  • Hi all,

    It's been a while since I looked at making a game and what with many things happening such as being a father in these difficult times and having to move home three times! I never thought an idea of a game would be one of them!

    I have to admit that due to limited time on my hands I hope everyone here is ok with me asking this question.

    So the game has one main enemy/boss and the player has to control many characters in order for the boss/enemy not to target them.

    With regards the pathfinder is there a way to create random or alternative fixed paths to one point that is triggered by a set of conditions. I was thinking of having several non visible solid sprites that would be randomly enabled to force the enemy to take a given path but I was also wondering if there was a more efficient way?

    Thanks

    Tim

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I though about this recently and the idea I came up with was to place a few invisible sprites on the map in random locations, like this:

    Then add these sprites as obstacles with higher path cost. They will force the characters to look for an alternate path, but will not block it completely if there is no alternative.

  • dop2000

    Thank you for your reply. This is what I was thinking of doing but wondered about the amount of usage of memory this would take to add these extra sprites to the game to achieve this. Especially if there were a lot of different paths to take.

  • Make a small sprite (say, 20x20 px) and stretch it on the layout. It will use very little memory.

    Note, that if your enemies all start moving from the same spot, you can't make them take different paths, because they share the same obstacle map. You can try finding path for one enemy, then randomizing the sprites, regenerate the map, then find path for the second enemy and so on.

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