2
\$\begingroup\$

So, I've successfully implemented A* pathfinding (java) (http://www.cokeandcode.com/main/tutorials/path-finding/) in my game, but that pathfinding doesn't work as I wanted it to work. I don't know where should I look to change this behavior.

Pathfinding

S - Start E - End

I want it to work like on the left side. Now it works like on the right side.

I am using a Manhattan heuristic.

\$\endgroup\$
  • 1
    \$\begingroup\$ Are you saying you want it to prefer moving vertically before moving horizontally? \$\endgroup\$ – DMGregory Jan 23 '16 at 19:33
  • \$\begingroup\$ Yea, something like that. \$\endgroup\$ – Commander Shepard Jan 23 '16 at 19:38
  • \$\begingroup\$ You should make the distance of any vertical neighbour less than the horizontal neighbours \$\endgroup\$ – Archmede May 4 '17 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.