Hey @Wall_Dweller, howâs it going?
Iâm currently working on an SCP: Containment Breach port for Roblox, and yeah map generators can be super confusing at first. Once you get the hang of them though, theyâre actually pretty fun to mess around with.
In SCP:CB, the map generator starts with a 2D grid and uses a seed-based generation system to randomly place rooms, forming a maze like modular layout. It always makes sure essential rooms (like SCP-173âs chamber or the special rooms) are included and that everything is reachable, while still giving you different layouts for each zone (Light, Heavy, Entrance, etc).
In Luau, you can use 2D arrays to handle something similar. Hereâs a basic setup example:
local MapTemp = {}
local MapName = {} -- MapName[x][y] = string (room type or special name)
for x = 0, MapWidth do
MapTemp[x] = {}
MapName[x] = {}
for y = 0, MapHeight do
MapTemp[x][y] = 0
MapName[x][y] = ""
end
end
When placing rooms, youâll want to check neighboring cells to make sure connections line up properly (hallways, corners, T-junctions, crossroads, etc).
If youâre stuck making your generator, I can share my current code, itâs still a bit buggy and some seeds break the layout, but itâs a REALLY good starting point. And donât stress it everyone struggles with map generation at first. Iâm still working through some issues myself, especially with room model alignment, since different meshes have weird sizes or offsets, and itâs quite annoying actually lol.
I hope this helps you, have a nice day.