Why the pathfinding is not working?

0 favourites
  • 8 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Can someone explain to me why this is not working? this project is not my game but is happening the same that in my game project.

    Download capx:

    http://www.mediafire.com/file/aybrjbnt237vzkp/DontWork.capx

  • Because you're finding a new path every tick. You only need to find the path once then let the object move along the path then find a new path when it reaches its destination (in general). Try 'on start of layout' instead of 'every tick' and you will see it move after finding the path once.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Because you're finding a new path every tick. You only need to find the path once then let the object move along the path then find a new path when it reaches its destination (in general). Try 'on the start of layout' instead of 'every tick' and you will see it move after finding the path once.

    ok, it works but how do I make the pathfinding object to move to the point all the time? like a monster trying to catch you, also in the project I am working the monster pass the walls...

  • I wouldn't do that with pathfinding, probably something like give the monster object Bullet behaviour and then create an event 'every tick, monster set angle toward position player.x, player.y. That will make it look like the monster is following you.

    If you were to do it with pathfinding it might not look like the monster is following you as it goes to the previous player start point but it would be something like find path to player, move along path, on destination arrived, find path to player.

  • If you want to use Pathfinding, you can 'Every X seconds'-'Find path'. You can take 0.5 for X. Keep in mind that many opponents and properties for precise pathfinding can lead to an increased cpu load.

  • I wouldn't do that with pathfinding, probably something like give the monster object Bullet behaviour and then create an event 'every tick, monster set angle toward position player.x, player.y. That will make it look like the monster is following you.

    If you were to do it with pathfinding it might not look like the monster is following you as it goes to the previous player start point but it would be something like find path to player, move along path, on destination arrived, find path to player.

    And with the bullet behaviour how the monster will detect obstacles?

  • Well I would use the pathfinding method if you are adding obstacles.

  • Is this what you were after WorkNow.capx? This is what I could get working using the path finding behavior. You can do this with a bullet behavior as previously mentioned but I've found there are pros and cons to each way.

    Path finding:

    + Can navigate obstacles

    + Has conditional event trigger [Is moving along path, On arrived]

    + Pretty straight forward to get working

    • Can chew up a fair chunk of memory for complex paths and multiple objects
    • Requires stopping and starting to find new paths

    Bullet:

    + can constantly chase the player by adjusting the trajectory angle

    + can move smoothly and is flexible

    • can't detect obstacles and adjust behavior
    • can take a fair bit to get working if you want to include obstacle dodging

    I hope this helps you out!

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