Remove all but the largest region in caves
When generating cave levels, remove all but the largest contiguous region from the resulting level.
This commit is contained in:
		
							parent
							
								
									2604341c2f
								
							
						
					
					
						commit
						15895c69fe
					
				
					 2 changed files with 12 additions and 4 deletions
				
			
		|  | @ -99,6 +99,9 @@ generate' params dims = do | |||
|   when (steps' > 0) | ||||
|    $ for_ [0 .. pred steps'] . const $ stepAutomata cells dims params | ||||
|   lift $ fillOuterEdgesM cells | ||||
|   -- Remove all but the largest contiguous region of unfilled space | ||||
|   (_: smallerRegions) <- lift $ regions @UArray . amap not <$> freeze cells | ||||
|   lift $ fillAllM (fold smallerRegions) cells | ||||
|   pure cells | ||||
| 
 | ||||
| stepAutomata :: forall s g. MCells s -> Dimensions -> Params -> CellM g s () | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue