nanodeath / CrowLib

Crow: Find your shortest path!
http://www.effectgames.com/effect/article.psp.html/community/Pathfinding_library_Dijkstra_s_Algorithm
MIT License
40 stars 6 forks source link

Make Crow work better with non-grid use cases #7

Closed nanodeath closed 14 years ago

nanodeath commented 14 years ago

Crow was designed principally for games, which would presumably take place on a grid (i.e. 2-dimensional Cartesian graph with integer coordinates). Some have expressed an interest in a more arbitrary system, one that didn't rely on any particular graph format; such a thing would allow something like cities to be represented, with a provided distance. Neighbors would also be provided, instead of determining neighbors by proximity on a grid.

This is already possible with Crow -- one can simply override the getNeighbors method to provide neighbors, and the rest should just work. However, this could be simplified (and documented more) for client developers. There are several actions to take:

1) Modify BaseNode or create a new Node class that does not require x-/y-coordinates. The node should also have an arbitrary id (which is used as a key in the graph), instead of one dependent on those coordinates 2) Modify the Graph's findGoal method, if possible, to be static -- you don't strictly need an instance of a graph to find the path between two nodes. 3) Add documentation describing these new changes.

nanodeath commented 14 years ago

v0.5.0 includes points 1 and 2 above.

nanodeath commented 14 years ago

Documentation has been added in a couple places.