Manhattan Heuristic modification y-preference


How do I modify the Manhattan heuristic to prefer the closer y axis on matches with ~h within a low range (or closer y or two best h’s)? I need the path search to try and climb/descend to matching y if possible, before searching above/below y branches for alternate route. Elevator/stairs in 100+ floor building scenario, 99% of the time getting to same y first will be necessary and save a lot of processing with that shortcut.

A lot of wasted space in searches comes from a triangular area that gets filled in between the shaft and point on above floor while manhattan tries to get to that point climbing.




If your world is static (or has very rare graph updates) I would recommend that you try the heuristic optimization described here:

Otherwise you can adjust the heuristic in the Path.cs script in the CalculateHScore method.