Introduction
Return to Main
Floor Layout
Floor Offsets
Player Starting Position
Filling the Map
The Elevators
No Touch Zones
Floor Creation
The Root Path
Filling Solo Holes
Fire
The Generators
Locking Trill
Shops and Computers
Pushable Walls
The Puzzles
Grate Traps
Cupboard Traps
Doors
Raiser Walls
Wall Holes
Encounters
Mines and Cupboards
Grates and Fire Hydrants
Wall Decorations
Holes
Fake Walls and Spinners
Outside a Base

Floor Creation

This is the most interesting part of the map generator. The map is currently nothing but a big block of rock and a digger will carve in some paths.

Remembering Dig-Dug

The digger starts at the same location as the droids and is allowed to make a maximum of 12,289 moves. A random movement is generated to make the digger move in all 6 directions and each decision is based on random probabilities. To prevent the digger from breaking an existing path, it will make sure that the cell it's trying to dig is surrounded by 3 walls, with the opened floor being from our current path.

After each and every time the digger has removed a wall, it checks to see if the new location is surrounded by 3 walls. Since no floor has yet been created, finding a floor cell can only mean one thing: We've reached an elevator entrance. When this happens, the elevator is marked as being connected to a path and the digger moves to an unmarked elevator of the same shaft to continue digging.

Changing floor level

The digger may take the decision to change floor level. When attempting to do so, it will make sure that the destination cell is a complete block of walls because, again, we don't want to break an existing path. If it is indeed a wall surrounded by 4 walls, it will add the appropriate ladders on both floors and continue digging on the new floor level. If it is not a block of walls, it will continue digging on the current floor level.

Creating random rooms

The digger may take the decision to build small rooms of a random shape that may or may not have water. The difference with this part of the process is that the digger does want to stick to opened floor tiles in order to create a room, but still without breaking existing paths. To do so, the generator will first go through every cell of the map and mark the walls that are along existing paths. When the room is then created, the digger is allowed to dig in walls that are not surrounded by 3 walls, but forbidden to touch walls that have been previously marked to make sure no existing paths will be broken. When it has done enough cells (up to 50 cells), it will remove all the markings and continue with the standard process from the last cell of the room.
1-Preparing at yellow square 2-Mark path edges 3-Creating the room 4-Remove markings

In the example below, two random rooms have been highlighted in red.

Creating open rooms

The digger may take the decision of creating a rectangular room that consists of regular floor tiles or dark area tiles. The creation of a room is the exact same process as creating a "No touch" zone. It's a rectangular block of a random width and random height that starts at our current position. To put a little variety, the digger will occasionnaly allow a wall to remain in the room, or rarely create a shootable blockage instead of a wall. For later use, each of these block is saved in an internal list. When the room is done, the digger continues with the standard process.

In the example below, two open rooms have been highlighted in yellow.

Jumping Jack

The digger may take the decision to abruptly stop from its current digging and jump along the edge of an existing path. This creates 'T' or '+' shape intersections and better looking bases. It tries a maximum of 900 times to find a suitable place to start digging, which is a wall that is surrounded by 3 walls.

Cell ID

Each time the digger removes a wall, it replaces it with a sequential number. Since the digger has started where the droids are (the base entrance a.k.a. the root), it gives as hint as to which cell is closer to the root compared to other cells. This will be used later.

To see it all in action, here is a little video that shows the digger working. Note that the base creation has been slowed down for your viewing pleasure!

Now that the paths are created, the generator replaces all the "No touch" zones with regular walls to allow them to be modified. In the end, we have our empty floor plan.