Hey I want to check when a room is fully enclosed but i dont know how.
I found some answer regarding FloodFill but i dont know how to make this work with my current system.
This cause a tile can have multiple wall North, East, South, West, and Diagonals. So i cant just check if a cell has a wall.
Looking forward to your reply!
I put an example down below how rooms can be formed.
Floodfill is good for raster images… I suppose you could snapshot your level into a texture and then floodfill.
Alternately perhaps use the NavMesh stuff to try and bake a navmesh at runtime, then see if you can get from inside the room to somewhere outside of it.
Or maybe something with raycasts to follow along a wall, but you’ll always have the chance of stepping over a very narrow opening.
It seems a general answer could be check for closed polygon shape.
In your case, it seems you are in 2D and have certain rules for creating the rooms (fixed wall anchor points in a grid) which allows optimizations…
I don’t quite understand why you can’t use Flood Fill… you’d be pretty much doing the same thing. Instead of checking if a cell is a wall, you’d just check if the direction the cell is would have a wall.