Each square is referred to as a “cell” which holds the possible models that could fit into that area, a sort of superposition. The wave function then creates a grid of your map area, you can sort of image this as a chess board. These are refereed to as “possible neighbours”. Then, you just define which sides of the model can connect to other sides of other models. In your case, you could build several hall type modules and pillars, each taking up say 10x10 studs. Ignore the blue, that’s just water in this generation.Įssentially the idea is to create tiles or prebuilt models, sort of in a modular state so that they can attach to other parts. You could picture the green parts as walls, and the yellow as floor. Once of the times I ran it, it produces a sort of map similar to what you might expect the backrooms to be. I made a module for it recently for my survival game I’m working on in order to build the terrain. It’s an interesting algorithm with some really creative games made with it. One method you can try to use is Wave Function Collapse. That’s about it, if you have any questions reply/dm me. If it doesn’t generate a wall, decrease the variable generation chance by 1. Then do if math.random(1, variableGenerationChance) then generate a wall at position Vector3.new(X minimum + (current X position iteration * size X of your wall), desired Y position, X position calculation but with Z instead of X) end obviously, that isn’t functioning code. If there is one, set the variable generation chance to the nearby generation chance. With every iteration of the inner loop, check if the position has a nearby wall. Loop through X positions divided by X size of your wall, then nest another loop inside it doing the same thing with Z positions. Generation chances are 1/variable, so the higher the number the less likely it is to generate. A variable generation chance, set at the start of the script to the base chance.An empty table to insert generated positions into.Generation chance if there’s a nearby wall. This is literally what I’ve been working on.įor this, you would want to have 4 variables.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |