[BEHAVIOR] EasyStar.js pathfinding for tilemap

2 favourites
From the Asset Store
Pathfinding AI
$2 USD
80% off
Units do not overlap each other and use different ways if there are several free ways.
  • thanks for this nice plugin!

  • Wonderful work Thank you for sharing

  • it seems that when no tile is placed the plugin takes that as walkable, can you give any tip how to avoid this?

  • круто

  • fldr Yeah, I deliberately set empty tiles as walkable since I believed that'd be the most commonly wanted behavior... However, you can easily have an a non-empty tile with all transparent pixels and set it as non-walkable.

  • Thanks! i kinda already did it that way as a workaraound

  • Magistross

    Great plugin! Thanks for doing this for us

  • fldr Yeah, I deliberately set empty tiles as walkable since I believed that'd be the most commonly wanted behavior... However, you can easily have an a non-empty tile with all transparent pixels and set it as non-walkable.

    after i worked some more with it, i fear a bit to ask... but could you maybe please make an option to set empty tiles walkable/not walkable?

  • after i worked some more with it, i fear a bit to ask... but could you maybe please make an option to set empty tiles walkable/not walkable?

    I dreaded this day would come... the day where I would have to delve once again in the edittime.js file. Ugh, I don't know why but I hate that! I prefer coding the runtime.js, much more entertaining! Rant aside, the files were updated! Get them again here.

    I added a property that you can set at edit time, and I also added a behavior action so you can change empty tile "walkable" status at runtime.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • wow, you are absolutely amazing! im very, very thankfull and happy

  • so im tinkering around with this plugin some days now, its really awesome and easy to use and the performance is so great that i came away with some ugly logic but now is the time where i came to a deadend with my ugly logic

    my idea was to ad the positions of characters on the tilemap as additional obstacles, remove them when they change theyre position and add the new position as an obstacle. I couldnt find a way to check for this event efectively so i chose the every tick method seen in the picture. It works, but when i came to the point that characters should also check if there are new obstacles when they move along theyre found path, the only working "logic" i could find was the "every 1 second->recalculate path" which is, together with the every tick for every character remove and set obstacle, really, really bad and i think the performance will also go down when its used in a real game.

    i bet i have to tie it to the moving part but i cant find anything that works.

    Do you have an idea?

  • There is no easy way to do that with the plugin. If the obstacle map change after a path is found, you have to recalculate it to be sure it's still valid. However, the map shouldn't change every tick, what you need to optimize is updating the map and finding new paths only when it's necessary.

  • i changed it to this and it works, maybe someone can use it too

    Thanks again!

  • Glad you figured it out, can't wait to see what you might be brewing with those events !

  • as soon i have something worthy to show i will show it here!

    just realized that in the screenshot above theres some mixup, event 13 has the wrong parameters, instead of "character.nodeindex+1" there should be "loopindex" so it checks the whole remaing way for obstacles. With the parameter "character.nodeindex+1" it only checks the second next tile the character wants to move to.

    I made this because i ran into another gamelogic problem, the "all seeing eye characters"

    They shouldnt know where on the whole path people are standing but they do when i loop through the whole remaining path, the same problem appears when they calculate paths anyway, so i think i have to find another solution where i dont set the tiles characters standing on to non-walkable.

    After some sleep i thought of using two tilemaps (im using at least two tilemaps anyway for ground, interior, etc..). First tilemap for ground and outer walls of buildings to provide the characters basic knowledge of theyre neighborhood and used for the initial path calculation. On the second tilemap i save the positions of characters and inner walls. While the character moves from tile to tile it could check if theres something in theyre field of view and whether its necessary to change the path. The characters then will need some form of memory for things they saw, a string where it remembers additional obstacles, that will be added before calculation and removed afterwards, so other characters can use the basic map with theyre own knowledge of temporary obstacles.

    Im curious if this makes sense and works like i think

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