How do I use properly the pathfinding behavior in this case?

1 favourites
  • 7 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Do you guys have any tips for me?

    I'm trying to make a flying bot that pursue the player and kill it. It's a platform game.

    I made a test and it works, but i'm not sure that's the best way.

    In the test, i'm updating the bot path every 0.2s, since the destination (the player) is constantly moving. But the bot movements are still kind of strange. It's not smooth.

    And, of course, to make the bot movement more realistic, I was trying to put some sine too.. but looks like it conflicts with the pathfinding movement, causing even more problems.

  • Every time you recalculate the path, the object will want to stop (or at least slow down) whilst recalculation takes place. Try performing path updates less frequently, for a start. Also, when the object's view of the player is unobstructed by pathfinding blockers, there's no need to use the pathfinding anymore - you can start to use more dynamic movements instead.

    And yeah, I'd disable the sine behaviour for now until the basic movements are working.

  • Every time you recalculate the path, the object will want to stop (or at least slow down) whilst recalculation takes place. Try performing path updates less frequently, for a start. Also, when the object's view of the player is unobstructed by pathfinding blockers, there's no need to use the pathfinding anymore - you can start to use more dynamic movements instead.

    And yeah, I'd disable the sine behaviour for now until the basic movements are working.

    Yeah, I've tried that, but it cause bugs too..

    I think I've found a good solution, but I'm having problems to make this work. Instead of using the "move along path", I want to use a lerp to make the bot travel through the nodes. There is the expressions "NodeXAt" and "NodeYAt", but I couldn't make what I want.

    Can someone help me with this?

  • Bump!

  • They way I've handled this is...might seem a bit of an overkill, but in my particular situation it worked fine. I have a pather object, which has the pathfinding behaviour - seperate from the real object I want to move. When I want to go someplace, the pather objects goes in that direction(NOTE: it is invisible and moves quite faster than the actual Object), updating its path frequently, and also leaving numbered nodes (set a var to nodes.cout + 1) on its trail on every now & then. Then I make the actual object follow the nodes (by updating its position by some pixels) always picking the lowest Node No, and destryoing each upon colliding with them. This way the pather can stop on every update, but as long as the actual object does not go faster than the pather, it would move quite smoothly.

    Hope this makes sense.

    CHeers

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • P.S. By nodes I mean a custom sprite (and invisible in runtime) object I created for this purpose, not hte actual pathfinding node.

  • They way I've handled this is...might seem a bit of an overkill, but in my particular situation it worked fine. I have a pather object, which has the pathfinding behaviour - seperate from the real object I want to move. When I want to go someplace, the pather objects goes in that direction(NOTE: it is invisible and moves quite faster than the actual Object), updating its path frequently, and also leaving numbered nodes (set a var to nodes.cout + 1) on its trail on every now & then. Then I make the actual object follow the nodes (by updating its position by some pixels) always picking the lowest Node No, and destryoing each upon colliding with them. This way the pather can stop on every update, but as long as the actual object does not go faster than the pather, it would move quite smoothly.

    Hope this makes sense.

    CHeers

    Ha! Thank you for the answer, it helped a lot!

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