Saturday, 7 April 2012

Dead end corridors

The first step to fix the dead end corridors was writing a routine that finds them. The rules are actually simple, you need a corridor, a room wall and no doors around a circular area to find a spot.

Also, the routine excludes walls with doors, but of course this doesn't work with round rooms, because the mask value for diagonal walls is different than the facing of main directions, because it has to be either one of main directions (walls on right and left are facing east and west, but they could also be facing north or south). Then again, the shape of room is also saved in the room data which can be detected and added to the algorithm. The spots are marked with lava tiles. Corridors running along with the wall get more than one hit, but they can be exluded by creating only one door or checking if the room is connected to that spot with good old flood fill check.

No comments:

Post a comment