Jump to content
  • Advertisement
Sign in to follow this  

Need an advice for a pathfinding algorithm to fit best

This topic is 2101 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everybody,

I need an advice for an algorithm.


I'll try to describe what the situation is...


I have a structure that looks like this: https://dl.dropboxusercontent.com/u/8655042/struct.bmp

A grid of cells having their coordinates and a value 'X' or 'O'.


I'm looking for an algorithm that could build me a path, array of cells that are having value of 'O' and one cell apart from each other (neighbor cells).

buildPath: (x, y) -> array of cells

So if I'll call it like buildPath( 2, 0 ) it will produce output something like so:

[ (2,0); (3,1); (3,2); (3,3); (2,3); (1,3); (0,2); (0,1); (1,1) ]


It's not exactly what I'm looking for, but it will help me to start with.


Thanks. smile.png

Edited by Greenhouse

Share this post

Link to post
Share on other sites

Well what exactly are you looking for?


If you want all connected paths from a start point you want the flood fill algorithm http://en.wikipedia.org/wiki/Flood_fill


If you want the shortest path between 2 nodes you want A* or Dijkstra's Algorithm http://en.wikipedia.org/wiki/A*_search_algorithm http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm

Edited by Paradigm Shifter

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!