Closed radman0x closed 5 years ago
The general idea of priority walls is that certain cells should have a higher chance to be dug out -- when talking about corridors, these are the three cells located at the remote end of the corridor. This is to ensure that there are no dead ends; the algorithm first digs from these priority cells and when there are none remaining, it picks other places at random.
I do not think that these priority walls can aid you. Instead, just have the map generator give you a complete list of cells that are dug out (using the callback to generate
) and when rendering room walls, consult the provided map to see where the doors should be located (instead of a wall).
I see the purpose now, does that mean createPriorityWalls() is more of an internal method, a utility used during generation?
Where you're talking about the 'map generator' and 'the callback to generate' are you referring to the Map.create() method? If so, is the third param to the callback 'contents: number' the one that should indicate what occupies each cell i.e. corridor or room or door?
I see the purpose now, does that mean createPriorityWalls() is more of an internal method, a utility used during generation?
Precisely.
Where you're talking about the 'map generator' and 'the callback to generate' are you referring to the Map.create() method?
Yeah, sorry, I mis-named the function. It is create
, right.
If so, is the third param to the callback 'contents: number' the one that should indicate what occupies each cell i.e. corridor or room or door?
The third param is a number, 0 or 1. 0 means empty space, 1 means solid rock. There is no further distinction (room/corridor), but it should be sufficient for your case.
Thanks for the clarifications, much appreciated :)
I'm curious about what Corridor.createPriorityWalls() is for? I'm using the library to generate a Uniform map and then iterating rooms and corridors to render. If I put walls around each room then the passages are 'blocked' and I was hoping this method might provide a simple method of solving this. Does anyone know the purpose of this method?