1
\$\begingroup\$

How would I go about finding the fastest path to connect two points on a grid? I'm making a 2D game and the map is based around a grid.

I need to be able to account for any blocked tiles that the path need be able to go through.

Example: https://i.sstatic.net/EHUTq.jpg
The blue line being what I need to figure out, and the red tiles being the blocked tiles.

Where should I start? Any advice be would great!

\$\endgroup\$

1 Answer 1

8
\$\begingroup\$

Sounds like you want A-star path-finding, which is pretty much the defacto for path-finding. I used this in my XNA game: http://www.csharpcity.com/reusable-code/a-path-finding-library/ (I repackaged the library into a slightly more usable stand-alone DLL).

\$\endgroup\$
1
  • \$\begingroup\$ This looks exactly like what i need. Thanks for the quick reply. :) \$\endgroup\$
    – Milkboat
    Commented Mar 6, 2012 at 2:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .