creates a Grid by floodfilling from a given set of starting locations. FloodFill creates a kind of 2d grid in 3d space which can take us up or down slopes, across bridges and over and under overpasses. FloodFill also takes care of jumping over obstacles and gaps.
FloodFill class itself only organizes the floodfill process. actual reachability
checks is delegated to StepChecker
. FloodFill decides which direction
to check and also makes sure if returned values are in proper range.
jump reachability is only checked for cells which cannot be reached with simple step.
jumpDistance is the upper limit of how far a unit can jump in cardinal directions.
for diagonal jumps round(sqrt(2) * jumpDistance))
is used
as horizontal and vertical upper limit
pseudo code for FloodFill is something like:
add initial points to list while list not empty while list not empty remove first point in list floodfill to direct neighbours for each point which isnt checked for jump before and is not traversable for some certain direction check for jump reachability and add found points to list
floodfilling may be a quite time and memory consuming process especially for large maps
Field Summary |
||
static boolean |
||
static boolean |
||
static int |
radius debug variable to restrict flood fill to a region. |
Constructor Summary |
||
FloodFill(List<Vector3> initialPoints, StepChecker stepChecker, float cellWidth, float cellHeight, float cellMatchRatio, float stepRatio, float jumpRatio, float fallRatio, int jumpDistance, boolean diagonalJump) creates a new FloodFill starting from a few points |
||
FloodFill(Vector3 initialPoint, StepChecker stepChecker, float cellWidth, float cellHeight, float cellMatchRatio, float stepRatio, float jumpRatio, float fallRatio, int jumpDistance, boolean diagonalJump) creates a new FloodFill starting at one point |