[BEHAVIOR] EasyStar.js pathfinding for tilemap

Post your completed addons to share with the community

Post » Sun Feb 19, 2017 7:53 pm

Thanks, @Magistross! Works flawlessly. Keep up the great work! :mrgreen:
B
24
S
7
G
1
Posts: 36
Reputation: 2,049

Post » Sun Mar 26, 2017 3:16 pm

@magistross I can dig out the examples if needed and the zips to post, unless you have them?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Sun Mar 26, 2017 6:50 pm

@magistross The links appear to be dead for the behavior file.
B
64
S
37
G
24
Posts: 351
Reputation: 17,877

Post » Mon Mar 27, 2017 3:27 am

Updated all links. RIP Dropbox... :(
B
71
S
30
G
24
Posts: 984
Reputation: 19,003

Post » Mon Mar 27, 2017 1:43 pm

Magistross wrote:Updated all links. RIP Dropbox... :(

What were they thinking??
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Wed May 10, 2017 4:57 pm

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.
B
45
S
20
G
65
Posts: 1,115
Reputation: 38,121

Post » Wed May 10, 2017 5:30 pm

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.
B
71
S
30
G
24
Posts: 984
Reputation: 19,003

Post » Wed May 10, 2017 6:46 pm

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.
B
45
S
20
G
65
Posts: 1,115
Reputation: 38,121

Post » Wed May 10, 2017 7:14 pm

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.
B
71
S
30
G
24
Posts: 984
Reputation: 19,003

Post » Wed May 10, 2017 7:29 pm

Ah! yeah, I just found that too! sorry for the confusion.
Thanks! works for me now :)
B
45
S
20
G
65
Posts: 1,115
Reputation: 38,121

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 3 guests