How to invert "add path cost"? [pathfinding behavior]

0 favourites
  • 9 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hello comrades! Help me understand, please.

    I have a map on which NPC workers move, they carry loads from point A to point B using the pathfinding behavior.

    I build roads for workers, which give an increase in the speed of movement, and I want them to try to drive along them when choosing a path to get to their destination faster.

    I know that there is an action "add path cost", but no matter what values I enter, the workers on the contrary avoid traffic on the road. I tried both positive and negative numbers in the range of 20 to -20, but it didn't help.

    As a result, I can create areas that workers will try to bypass, but how do I create areas that they want to walk through?

    The map I have consists of a Tilemap object, roads are created from Sprite objects. What should I do?

    Thanks for your attention!

    Tagged:

  • I'm not familiar with it myself, but have you explored the Add path cost example?

  • I'm not familiar with it myself, but have you explored the Add path cost example?

    Yes=) I'm looking for a way to do the opposite result. In the above example, the arrow looks for ways to bypass rough terrain, but in my case, the entire map is rough terrain. I build roads on it and I want the arrow to try to follow the road.

    The whole map is a tilemap, the road is a Sprite.

  • Setting the cost to 5 worked for me. Normal cost is 10.

  • Setting the cost to 5 worked for me. Normal cost is 10.

    This only reduces the cost and causes the area to be avoided to a lesser extent. It seems to me that in this behavior it is impossible to reduce the path cost for objects. Sad=(

  • Looks like you're going to have to increase the cost of everything else besides the road instead. Could be done with an invisible tilemap, with empty tiles where the roads are (or upon placing roads). Agreed rather unfortunate that you can't just set a negative path value. Seems like it would be a simple fix, you could make a suggestion at construct3.ideas.aha.io/ideas.

  • Working in Construct 2, I set the cost "-20" for objects and it worked great, objects with the pathfinding behavior moved along my paths. However, after importing to Construct 3, this feature stopped working.

    Looks like you're going to have to increase the cost of everything else besides the road instead.

    I'm afraid of how this will affect the performance of the game, especially for mobile devices=))

    Seems like it would be a simple fix, you could make a suggestion at construct3.ideas.aha.io/ideas.

    Great advice! Thanks! I'll do that=) I didn't know there was such a site.

    And if my problem is a bug, how can I report it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Check out the latest beta, this has been fixed!

  • Yup=))

    Comrades from c2community.ru tell me about feature:

    If you run in to a bug or issue in Construct 3, please post it to the GitHub issue tracker here:

    https://github.com/Scirra/Construct-3-bugs

    So, im going to Github and create issue, and this problem solved about one day=)

    All work fine now!=)

    Thank you Dear oosyrag, for your help too=)

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