#1 Members - Reputation: 115
Posted 18 May 2012 - 08:50 AM
Behemyth
#2 Members - Reputation: 1676
Posted 18 May 2012 - 09:18 AM
http://en.wikipedia....wiki/Flood_fill
Edited by szecs, 18 May 2012 - 09:19 AM.
#3 Members - Reputation: 1006
Posted 18 May 2012 - 03:38 PM
to see if it contains a space that needs to be filled in
That bit is unclear to me. What do you mean by a space that needs to be filled in? The "need" may depend upon the game rules. Also does this need to be recalculated based upon user actions? For example, can a player open up an enclosed space (e.g. join it to another space), or can a player break an area into two areas? Do you need to be able to identify which grid cell belongs to which enclosed area quickly?
#4 Members - Reputation: 115
Posted 19 May 2012 - 12:39 PM
#5 Moderators - Reputation: 6662
Posted 19 May 2012 - 12:48 PM
#6 Members - Reputation: 1006
Posted 19 May 2012 - 06:02 PM
#10 Members - Reputation: 115
Posted 20 May 2012 - 10:22 AM
Create a blank grid with each block set to a given value, say 0. Then place your object on the grid so that each block in your object has a different value, say 1. Then flood fill the outside of your grid with a different value, say 2. Whatever is left as 0 is a hole on your object.
That is a pretty spiffy idea! Thanks to all who contributed.






