So im making a 3D puzzle-platformer game and I was planning to make the maps randomly generated with puzzles to solve. The problem is that idk how to do true generation with out it being a pain in the ass to manage and being not so efficient. Also My friend recommended me seeded generation for what im aiming, but i don’t truly know how to do that…
Here’s a thread from not too long ago on random map generation. You are asking for a fairly advanced technique and one that isn’t particularly supported by Roblox, where Godot has gridmaps. I believe a puzzle platformer would be better off with hand crafted levels. Randomly generated levels usually don’t hold up when levels are the meat and potatoes of the game, especially with puzzles involved since levels need to be smart where randomly generated levels are quite literally cobbled together by a machine.
Regardless in general the flow is like this.
Generate 2d noise, ie. convert (x,y) to a big random number
pick a tile based on the noise
depending on complexity make rules for which tile can be picked (has an entrance facing north)
if the player has travelled far enough start over at 2.
Making 2D noise is pretty easy with roblox math.noise, and used like this math.noise(grid.x, grid.y) % #tiles will get you a randomly picked tile. Now the hard part is making your ‘grid’ and managing your tiles.
A simple grid will be the width and length of a tile, so we can get the player’s position on this grid with
local player_grid_position = Vector2.new(math.floor(position.x / gridSize), math.floor(position.z / gridSize))
I think the last thread I linked has more on cloning the tiles and managing that, It’s certainly a lot to write about, fairly difficult and up to you to decide what your tiles are. Good luck!
I suppose there are even more details to iron out. Do you already have 500 levels? you mention repeating levels are you just trying to decorate the levels randomly? I assumed you were making a large map with continuous random tiles like the backrooms thread, if you’re just decorating the levels randomly then it might be less complicated.
For a decoration system making some preset decorations like trees, tables, or dressers and having a script to turn them off if a certain random number is met. Using the Collection Service will cut down on scripting and you can just tag objects that can be potentially hidden. That system might look like this
local rng = Random.new()
local hiddenChance = 60
local function randomhide(object: Part)
local hidden = rng:NextInteger(1, 100) < hiddenChance
object.Transparency = if hidden then 1 else 0
object.CanCollide = not hidden
end
for _, object in ipairs(collectionService:GetTagged("RandomDecor")) do
randomhide(object)
end
Also sorry for the ping for the other thread, it was very useful!
No… You see. Each level is a room. A room filled with randomized puzzle stuff (or mechanics if you know what i mean) which lets you solve a puzzzle. You enter an elevator, solve the puzzle to open another elevator door then go to the next door. I really dont have 500 maps. But what I do plan to do is add preset puzzle mechanics and 1 room (basically 4 parts making up the rooms).
Thank you for explaining it further, I think randomizing the puzzle aspect and keeping it fun will be extraordinarily difficult. Hand crafted will probably be more fun unless you love programming, like I do!
That being said I think with some luck you could use the hidden decoration system as long as you paired keys and locks (aka mechanics if you know what I mean ) to always show key if a lock is present. Then you only have to set up a few rooms in this way with a bunch of puzzle mechanics to be hidden, and randomize them with each floor you go down, and you can seed this with local rng = Random.new(elevatorFloor).
I can make a room filled with all the mechanics, then make it so that it randomizes their position and hides them (or stores them away, deleting when the map is gone)
Now, The map will be serialized into a string that the player can access and/or always use to generate puzzles.
Now thats what i see working. My biggest fear about this is generation bugs, but that’ll be rare imo.