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
The Generators
Locking Trill
Shops and Computers
Pushable Walls
The Puzzles
Grate Traps
Cupboard Traps
Raiser Walls
Wall Holes
Mines and Cupboards
Grates and Fire Hydrants
Wall Decorations
Fake Walls and Spinners
Outside a Base

Floor Offsets

Now that the floor layout is set, we can build a table of floor offsets. This will be used when changing floor level to know exactly where to transport in the map, and for this, the generator needs to know the offset of all connected floors. It starts with the first floor and goes up to the top floor.

While creating the floor layout, the level of each section was stored in a table. The first four numbers of that table are the first row sections, the next four numbers are the second row, and so on. For example, in the case of map 17.3, the table looks like this: 3333 3443 4442 1111 (sections 1, 2, 3, 4, 5, 8 are level 3, sections 6, 7, 9, 10, 11 are level 4, etc.)

When creating the floor offsets, the generator looks for any index of that table that has the value of the floor we're examining. Once found, it can know the physical position of the related floor section with a simple formula.

Y1 = Index / 4
X1 = Index - (Y1 * 4)

Then, it looks for any index of that table that has the value of the floor above the one we're examining. Once found, it also get the physical positon of the related floor section with the same formula.

Y2 = Index / 4
X2 = Index - (Y2 * 4)

Finally, a little substraction for the offset and multiplication to adapt from floor sections to map cells.

Offset X = (X1 - X2) * 16
Offset Y = (Y1 - Y2) * 8

The generator stores this in a table and goes to the next floor until the offset of the top floor is calculated.