New diagonal movement option: only to squeeze between diagonal obstacles.
I've made this modification in my local copy to mimic movement in Tibia: Using this option, the pathfinder only routes diagonally when it has to "squeeze between" two diagonal objects (two trees/bushes), otherwise it sticks to N/E/S/W paths.
It seems like #63 is trying to achieve this - the way to do it is to allow the diagonal routing only when it is blocked by two diagonal obstacles (both obstacles, not "just one", or "none")
Is it change really useful? I mean why move diagonally when there are exactly two obstacles? If a character can move diagonally despite there being two obstacles, what stops it when there are less?
It is useful when you want the pathfinder to only use diagonal when it is necessary. Otherwise (turning corners or when no obstacles) it should stick to horizontal/vertical motion. Diagonal is only checked so that it does not get "stuck".
If youve ever played Tibia, thats how monsters follow you. They won't take diagonals unless necessary. Some games it looks silly when creatures move diagonally too much.
The change is very tiny - and it seems like others are looking for this feature too.
On Apr 9, 2015 1:39 PM, "Raminder Singh" [email protected] wrote:
Is it change really useful? I mean why move diagonally when there are exactly two obstacles? If a character can move diagonally despite there being two obstacles, what stops it when there are less?
— Reply to this email directly or view it on GitHub https://github.com/qiao/PathFinding.js/pull/96#issuecomment-91303965.
The other way to achieve this is to set diagonals to 'always', and to increase the costs of diagonals. Is there any way to change the cost of diagonals or tiles types in general?
I'm not really sure. Lets open this to voting. How many of you think this should be included?
This is the effect:
