Thanks for the interest! 
Honestly, the Backrooms generation system isn’t that complicated. Let me explain it quickly:
For the walls and maze, I use a version of the “Growing Tree” algorithm that goes like this:
Example
-- Simplified example of how I generate the paths
function generateMaze(map, width, height)
-- Start with all walls up
for y = 1, height do
for x = 1, width do
map[y][x] = {north=true, east=true, south=true, west=true, visited=false}
end
end
-- Choose random initial cell
local x, y = math.random(width), math.random(height)
map[y][x].visited = true
-- Frontier of cells to visit
local frontier = {}
addNeighbors(map, x, y, frontier, width, height)
-- While there are cells in the frontier
while #frontier > 0 do
-- Choose a random one and knock down the connecting wall
local idx = math.random(#frontier)
local cell = frontier[idx]
table.remove(frontier, idx)
if not map[cell.y][cell.x].visited then
connectCells(map, cell.x, cell.y)
map[cell.y][cell.x].visited = true
addNeighbors(map, cell.x, cell.y, frontier, width, height)
end
end
end
-- Then I verify accessibility with a BFS
function verifyAccessibility(map, startX, startY)
-- Reset accessibility
for y = 1, #map do
for x = 1, #map[1] do
map[y][x].accessible = false
end
end
-- BFS from starting point
local queue = {{x=startX, y=startY}}
map[startY][startX].accessible = true
while #queue > 0 do
local current = table.remove(queue, 1)
local x, y = current.x, current.y
-- Check connected neighbors and mark them
if not map[y][x].north and y > 1 then
if not map[y-1][x].accessible then
map[y-1][x].accessible = true
table.insert(queue, {x=x, y=y-1})
end
end
-- And so on with the other 3 directions...
end
end
I kept it super short, but the idea is:
- You start with walls everywhere
- You strategically knock down walls to create paths
- Then you verify that everything connects with a BFS so nobody gets trapped
The trickiest part is optimizing how to physically build thousands of parts in Roblox without crashing the server, but that’s a whole other challenge!