The maze routine itself works, but it has to match in the rest of level creation. The way I accidentally solved it in the labyrinth level (the only level using maze for now) was make the maze routine "continue" from itself, the tiles it has created in previous "hives". A hive is one instance of maze diggers which are the corridors of the maze left by replicating diggers.
Sometimes it happens that everything runs into a dead end, usually a digger winding on itself. The fix for that is create hives until X number of tiles created. I found out that the number of available wall tiles divided by 3 gives a good result. The reason for that only roughly 50% of maze area is floors, the rest of it is walls. Not a surprise there. But if you divide it only by 2 it seems that the routine can't fulfill the requirement of mazes to create and runs into an endless loop.
There are some questionable things in this method where I'm first creating couple of rooms and then shooting mazes from walls of those rooms. Most important question: are rooms always connected by mazes? For number of test runs it seems to be true, but I have a feeling it could fail in some rare situations. If it happens it's still possible to check each room for connections and create them later with manual style, but I'd rather wish the maze routine work in reliable way.
No comments:
Post a Comment