I need a random map generation script for a game. It needs to have ores, trees, cactus, different biomes. I tried two ways one of them I kind of worked I managed to make a random block placer thing but that’s not really what I need I also tried using Berazaas Mining Kit to make the ores but I couldn’t do that is there an article for this? or a code? maybe a plugin?
There are so many resources on terrain generation you can read. Use your search engine.
You might want to use scattered transparent parts which you can choose one randomly. Then you can replace a clone of model you want to put with thechoosen part
This want is used a lot for coin generation
local Part = Instance.new("Part") --For cloning Part.Anchored = true Part.FormFactor = "Custom" Part.Size = Vector3.new(4,4,4) Part.TopSurface = "Smooth" local seed = math.random(1, 10e6) local frequency = 3 local power = 10 local resolution = 100 for x = 1, resolution do for z = 1, resolution do local y1 = math.noise( (x*frequency)/resolution, (z*frequency)/resolution, seed ) local y2 = math.noise( (x*frequency*.125)/resolution, (z*frequency*.125)/resolution, seed ) local y3 = math.noise( (x*frequency*4)/resolution, (z*frequency*4)/resolution, seed ) local y = (y1*y2*power*power)+y3 local Part = Part:Clone() Part.Parent = game.Workspace Part.CFrame = CFrame.new(x,y,z) if math.abs(y2) < .1 then --You can remove this if statement Part.BrickColor = BrickColor.Green() elseif math.abs(y2) > .25 then Part.BrickColor = BrickColor.Red() else Part.BrickColor = BrickColor.Blue() end end end
I found this code on Reddit you can customize it.
But if you guys have better ones pls send them to me or if you have tutorials for random map generation
The best way is using perlin noise for the surface generation
Perlin noise is indeed pretty cool. It can be used to create a lot of different stuff. For reference, here’s an example of something I made using only perlin noise:
Then you can use other methods to add things on the surface. The good thing about perlin noise is that it’s very easily customizable and you can get really cool effects using it.
There a couple good scripting helpers articles on perlin noise.
(Terrain generation, what and how? - Scripting Helpers)