ive been attempting for hours to get room generation as i want it to be for the backrooms but all the ways ive done it i dont really like… one of the ways ive done was putting different parts in a room where other rooms could spawn after that point but i scrapped it because i wanted it to be almost all random like where walls get placed and i also want it to be almost endless going on for miles. but for the life of me i cant get something like that to work and even if i could i wouldnt know how to load in and out chunks to prevent massive lag. could i have any help on ways to achieve this sort of generation?
First create a chunk loading system. This way it doesn’t cause lag. What you wanna do is just put parts at Intervals of maybe 60 studs (depends on how long do you want a chunk to be.). Next just do a while loop and if you know how to compare magnitudes then just compare it with all of the parts and then we will add a attribute for loaded. If it’s true the model will be visible if not then it’s invisible. Then you wanna create some templates for chunks and then alas just do a random loop that will select a random template for each chunk.
I made a randomly generated backroom thing before. It was painful.
So I just prebuilt some cells/chunks and made a script that generates in a grid (Rows and columns.)
I also made it check for corners or edges so there are no gaps to the outside, which took a bit more time.
I wish I still had the video clip but I deleted it.
This is a basic format.
local row = 0
local column = 0
local max = 100
repeat
row += 1
repeat column += 1
[GENERATE CELL]
[TELEPORT CELL TO POSITION]
[SET NEW POSITION FOR NEXT CELL]
until column >= max
until row >= max
I made an infinitely generating backrooms game once, and it was pretty easy to make.
I had a set of tiles, and then generated them around players.
The list of tiles i had are:
- 2x empty tiles (Just floor and roof)
- 3x wall tiles (A tile with a wall on one side)
- 1x pillar tile (A tile with a pillar in the middle of it)
- 1x crawlspace tile (A tile with a hole in the wall that you could crouch through)
- 1x spawn tile (An empty tile with a spawn location on it)
I would of had only one of each tile if i properly understood how to have rarities for things.
Anyway, on top of making them generate around the player, I also had 4 attachment points per tile, one per side. I would weld the parts together so the game knew which tiles had already generated new tiles next to them, and it wouldnt cause any clipping issues.
The tiles also had a random rotation set when they spawned in, to make the game more random.
To make the tiles detect if they should spawn in, i used a simple method of getting all the parts in a box, and checking if any of the connector tiles were in the box, if so, it would check if they had no connections, and then it would make one, and parent the tile to workspace.
To make the game run well, i slowed down the generation time to be every 3 seconds or something like that, and I also used streaming enabled. Slowing down the spawning time thouigh, allowed for players to easily walk to the border of the generation, and they could see the map generate faster.
To make the tiles randomly generate around the player, I had a script running which detected how far away one of the connector parts was from the HumanoidRootPart of the player, and then generate a tile if the distance between the two was below a set number.
It was running through a server script, if i remember, and I also wrote it in a very unoptimized way, so even if i still had the code, it would be terrible and I wouldnt recommend using it.
However, I hope this information helps you out!
(Screenshot of infinite generation)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.