How do I make a procedurally generated map?

I’m trying to replicate a system for my game like SCP:CB, where every room is procedurally generated to keep the game random.

The rooms should be randomly picked instead of being created and the hallways should be as random as possible.

Any help on better understanding this topic would be greatly appreciated.

to get a random thing out of a table do

local Table = {'hello','goodbye'}
local item = Table [1,#Table]

But how do I make it detect if theres empty space for a room or not?

please give a script
even @Roblox says it

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

I’m not asking for a script, I’m asking on how to better understand this topic.

Look at the last example.

1 Like

If your talking about the layout, probably use an algorithm like Wave Function Collapse or another constraint satisfaction algorithm. You would probably need to do your own research and your own implementation as WFC is a bit complicated and there isn’t much documentation on how to implement it in Roblox. I definitely recommend The Coding Train’s tutorial on YouTube on this if you’re going with WFC as he explains the concept perfectly.

If you already have the layout and just need to fill in the rooms, just make a bunch of room/hallway templates and randomly insert them into each section/space in the layout.

Oh no worries, I’ve already figured this out. Forgot to close the topic.

1 Like