Hi all,
Version 1.6.0, with some tuning options.
Now, when initializing Jumper, passing it a 2D map (2-dimensional array), Jumper keeps track of the map and perform node-passability checks according to this map values. So that you can easily update your map cells (lock/unlock cells) changing directly the map values) and Jumper will perform accordingly.
Code: Select all
local map = {
{0,0,0},
{0,0,0},
{0,0,0},
}
local Jumper = require 'Jumper.init'
local walkable = 0
local pather = Jumper(map,walkable)
-- etc etc
map[2][1] = 1 -- Cell[1,2] becomes unpassable
Second, I have managed to add specialized grids, and a tuning parameter, called grid processing. Therefore, you can
either choose to init Jumper in
pre-processing mode (by default) or
post-processing mode.
In pre-processing mode (which is the
default mode), Jumper caches all map cells in an internal grid and create some internal data needed for pathfinding operations. This will faster a little further all pathfinding requests, but will have a drawback in terms of memory consumed. As an example, a 500 x 650 sized map will consume around 55 Mb of memory right after initializing Jumper, in pre-preprocesed mode.
You can optionally choose to
post-process the grid, setting the relevant argument to
true when initializing Jumper.
Code: Select all
local Jumper = require 'Jumper.init'
local walkable = 0
local allowDiagonal = false
local heuristicName = 'MANHATTAN'
local autoFill = false
local postProcess = true
local pather = Jumper(map,walkable,allowDiagonal,heuristicName,autoFill,postProcess)
In this case, the internal grid will consume 0 kB (no memory) at initialization. But later on, this is likely to grow, as Jumper will create and keep caching new nodes and relevant data on demand. This
might be a better approach if you are working with huge maps and running out of memory resources. But it also has a little inconvenience :
pathfinding requests will take a bit longer being anwsered (about 10-30 extra-milliseconds on huge maps).
Extra - informations, documentation can be found at
Github.
Any feedback would be appreciated.
Thanks for your interest in this.