Yonaba / Jumper

Fast, lightweight and easy-to-use pathfinding library for grid-based games
http://yonaba.github.io/Jumper
MIT License
607 stars 122 forks source link

Nodes that can be traversed but not "landed on" #24

Closed dookzoom closed 10 years ago

dookzoom commented 10 years ago

Thanks Yonaba for your work, Jumper has been a huge help to me!

It would be great to have a way to identify a node on a grid as one that can be traversed but not "landed" on. The issue I am having is units in a game should be able to pass through a node occupied by an "ally" but shouldn't be able to "land" on it.

Yonaba commented 10 years ago

Hi @dookzoom,

Thanks for your interest. That request sounds quite specific, so I am quite unsure if this can be implemented as an in-built feature or not. A question though, what would be the expected behaviour if you pass such a node as the end node ? Should the pathfinder return nil, or randomly chose any walkable nearby location to walk to ?

dookzoom commented 10 years ago

I think first it would require implementing Maximum length paths for a unit, which it looks like you are considering adding. Second, if an end node were selected that was beyond the maximum length path, it would return the closest node that it could reach. The node returned would need to be both "walkable" and "landable".

Thanks for replying. I think I have different way of solving my problem anyways.

Yonaba commented 10 years ago

Hmm, it seems I did not fully understand at first what you were asking for. Then, I shall rephrase my previous question. Assuming that, for a unit, an end node is designated, and this end node is reachable within the unit maximum stepping ability. Assume also this very node was designated as traversable, but not "landable". In that case, what would you expect the pathfinder to return ?

dookzoom commented 10 years ago

If there were another path of equal length that reached the same end node, but "landed" on a tile that were landable, I would expect the pathfinder to return this other path. If there were no other equal length path, I would expect the pathfinder to return the last "landable" node of that path inside of the maximum stepping ability.