PathFinding.js
PathFinding.js copied to clipboard
Is it correct to call grid.clone() before each new search?
I am not sure if I am using this library correctly, but I would like to try comparing the performance of a new library I have written for 2D path searching to PathFinding.js. However, this library seems to have a serious flaw which is that you must completely reallocate the entire grid before each call to one of the search routines (thus defeating the whole purpose of optimizations like A*, which seek to reduce the number of cells visited). Is this actually the intended usage or am I just calling this library incorrectly like a bozo?!?
You have to have a new grid before running a finder on it. You can do it either using the clone method or create a new Grid each time. The slowness of the clone method is a know issue. See #33. Sorry.
Maybe you could use a free list or something to track the cells which get visited and clear them out when the search completes. Otherwise, it seems a bit foolish to even bother implementing an algorithm like A* or Jump-Point-Search.