[BEHAVIOR] EasyStar.js pathfinding for tilemap

2 favourites
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Thanks, Magistross! Works flawlessly. Keep up the great work!

  • Magistross I can dig out the examples if needed and the zips to post, unless you have them?

  • Magistross The links appear to be dead for the behavior file.

  • Updated all links. RIP Dropbox...

  • Updated all links. RIP Dropbox...

    What were they thinking??

  • Is there a way to use this without the "on path found" Trigger?

    I tried setting the the iterations to -1, forcing the path calculation, but the path doesn't become available until later. I need to be able to get the path synchronously.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hard to tell, it's been a while since I looked at the code of EasyStarJS. Did you try to use a wait for signal along with the "on path found" trigger ? It might simulate a synchronous flow of events.

  • Well, the issue I have is that the Trigger occurs outside the flow of the eventsheet, so I can't get the path immediately in the necessary position of the eventsheet when it is called to calculate the path.

    So if I have a condition that is met to create the path, I have to restart that flow of logic elsewhere, while other events get ran in the interim.

    Using wait doesn't solve the problem, as that delays receiving the path to the next tick, causing the need to use confusing or complicated event management which causes event entanglement.

    So I think having the option to synchronously calculate the path would be a great addition to the behavior. What I am doing isn't cpu intensive, as I am not performing it every tick, I just need the immediacy.

  • Just did a bit of digging into the source code. Turns out there's this property "syncEnabled" that changes the behavior of how the callback is wrapped. If it's set to TRUE, the callback is executed synchronously, if not, it's in a setTimeout. By default it's set to FALSE and I did not expose this property at runtime... BUT, I did expose it as a behavior property under the name of "asynchronous". If you set it to "no", do some "Find path" calls, and then do a "Force paths calculations", the paths should be available immediately thereafter. Even the trigger will be executed before the rest of the actions.

  • Ah! yeah, I just found that too! sorry for the confusion.

    Thanks! works for me now

  • Hey Magistross - thanks again for this plugin - we make extensive use of it and love it.

    Once in a while, when things get really hectic, one of our NPC's fails to find a path.

    Is there a way to make that NPC like... stop and re-evaluate using the on pathfinding failed event? Right now, she just freaks out and runs through a wall.

    Let me know what you think!

  • It's important that if an instance fails to find a path, that all its movement related events/behaviors be stopped or cancelled. The "no path found" trigger should allow you to do that.

  • Can you give me some insight into what might typically cause an instance to fail to find a path? I could just dig into the JS, but I'm curious as I'm currently trying to make my character more 'resilient' to it happening if that makes sense!

  • Well, I can't know for sure... but if the tilemap changes or if obstacles are added on the fly a lot, I guess the system might have some hiccups.

    Maybe updating the core JS file would help... the plugin is kind of outdated.

  • Hm, yea we do add path cost, but not obstacles on the fly. At least I don't think. I'll look into it and get back to you!

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