• Create Account

### #Actualxexuxjy

Posted 16 November 2012 - 09:48 AM

Thanks for the ideas Waterlimon and Caldiar, that makes sense. As the levels aren't particularly big (200x200 at the mo) then the simple 'expand' in each direction and mark-off the processed nodes should work well. Bah i'm torn now as i'm also splitting the whole level into segments so that I can activate the ones near the player which the quad tree should also model nicely. can see me ending up trying both.

Thanks again.

Ok, finally finished a 'working' version , what I ended up doing was similar to the original idea above.

Pick a starting square.
scan along x to find the max possible range. (maxX)
scan along y to find the maximum possible range. (maxY)
brute force test each possible rectangles from (maxX , maxY) to (1,1) to see which had the largest valid area (where all squares are of the correct type and are unprocessed).
mark all the squares under that rectangle as processed.
repeat for next valid square through the grid.

It ended up being a little more complicated then I'd originally planned but it works nicely with L-shaped section and other oddities.
I can probably make a few optimisations on it now it's stable but it processes quickly for my largest levels so am not too worried.

Thanks again for the help.

### #2xexuxjy

Posted 16 November 2012 - 09:42 AM

Thanks for the ideas Waterlimon and Caldiar, that makes sense. As the levels aren't particularly big (200x200 at the mo) then the simple 'expand' in each direction and mark-off the processed nodes should work well. Bah i'm torn now as i'm also splitting the whole level into segments so that I can activate the ones near the player which the quad tree should also model nicely. can see me ending up trying both.

Thanks again.

Ok, finally finished a 'working' version , what I ended up doing was similar to the original idea above.

Pick a starting square.
scan along x to find the max possible range. (maxX)
scan along y to find the maximum possible range. (maxY)
brute force test each possible rectangles from (maxX , maxY) to (1,1) to see which had the largest valid area (where all squares are of the correct type and are unprocessed).
mark all the squares under that rectangle as processed.
repeat for next valid square through the grid.

It ended up being a little more complicated then I'd originally planned but it works nicely with L-shaped section and other oddities.
I can probably make a few optimisations on it now it's stable but it processes quickly for my largest levels so am not too worried.

Thanks again for the help.

### #1xexuxjy

Posted 15 November 2012 - 02:47 PM

Thanks for the ideas Waterlimon and Caldiar, that makes sense. As the levels aren't particularly big (200x200 at the mo) then the simple 'expand' in each direction and mark-off the processed nodes should work well. Bah i'm torn now as i'm also splitting the whole level into segments so that I can activate the ones near the player which the quad tree should also model nicely. can see me ending up trying both.

Thanks again.

PARTNERS