I am making a terrain generator using Perlin noise.
local seed = Random.new():NextNumber(1, 100000)
local x = 100
local z = 100
local noise = 5
local partSize = 4
local partY = partSize * noise
for x = -x, x do
for z = -z, z do
local noise = math.noise(seed, x/10, z/10) * noise
local part = Instance.new(“Part”)
part.Anchored = true
part.Size = Vector3.new(partSize,partY,partSize)
part.Position = Vector3.new(x, noise, z) * partSize
part.Position = Vector3.new(part.Position.X,math.round(part.Position.Y / 5) * 5, part.Position.Z)
part.Parent = game.Workspace
part.BrickColor = BrickColor.new(“Forest green”)
part.Material = Enum.Material.Grass
end
end
local seed = Random.new():NextNumber(1, 100000)
local x = 100 -- this makes the start pos at x
local z = 100 -- this makes the start pos at y
local noise = 5 -- this `noise` makes the differences throughout the picks in the gen
local partSize = 4 -- obviously the part Size (hwr x, z)
local partY = partSize * noise -- part Size (hwr y)
for x = -x, x do
for z = -z, z do
local noise = math.noise(seed, x/10, z/10) * noise -- this is the point of the starting Y and lasting Y of the 'noise'
-- so if you want more 'extreme' picks, you should
-- change the previous `5` noise setted value...
local part = Instance.new(“Part”)
part.Anchored = true
part.Size = Vector3.new(partSize,partY,partSize)
part.Position = Vector3.new(x, noise, z) * partSize
part.Position= Vector3.new(part.Position.X,math.round(part.Position.Y / 5) * 5, part.Position.Z)
part.Parent = game.Workspace
part.BrickColor = BrickColor.new(“Forest green”)
part.Material = Enum.Material.Grass
end
end
So simply as moddifing the ‘noise’ you get more amplitud at your terrain.
I hope this helps you out, I’m sorry for the codewriting but, I’m at cellphone, so I can’t do much more…
local size = 200
local scale = 100 -- Higher number means more spread out
local frequency = 0.4 -- Lower number makes changes less frequent
local amplitude = 15 -- Adjusts the height of the features
for x = 0, size do
for z = 0, size do
local noiseValue = math.noise(x / scale * frequency, z / scale * frequency) * amplitude
-- Add 0.5 to shift the range from [-0.5, 0.5] to [0, 1] for heightmaps
local height = (noiseValue + 0.5) * amplitude
-- Your terrain generation code
end
end
So just replace the lines of code that may have change,
It is very easy, just add the first variables in the code, then insert the noiseValue and the height in the body of the chunck of ‘for z…’ and in your code search for the peviously variables like ‘noise’ and delete them, replace the other references to the next variable noiseValue , so you can identify better your code and you learn a basic syntax correction tip.
I hope this is of help to you! If it is give me the answer pla!
The typical use of Perlin noise for 2D height maps involves using a weighted sum of multiple calls to math.noise, sampled at different intervals. Most commonly, this is done in “octaves” which is just a fancy way of saying powers of 2; the term octave comes from music, the fact that 8 whole note intervals is a doubling. So your noise sampling call would have the form:
Where s is some appropriate scale factor to tune for the lowest frequency you want to sample at for the scale of terrain changes you want, and the weights w1 … wn are the coefficients for how much you want each octave to contribute (similar to Fourier Series coefficients ).
Also worth noting is that if you call math.noise with all integer coordinates, it returns zero. For this reason, I like to have either the seed or the scale factor be something irrational, like some number times math.pi, for example. This way, you won’t have obvious periodic nodes in the results.
Lastly, you do not have to just scale the noise result linearly, you can do non-linear things to it for different looks to your terrain. For example, squaring the height value (or raising to any power > 1) will make things more “peaky”, by emphasizing values near +/-1 and scaling down values nearer to zero. You can apply all kinds of non-linear weighting and distribution functions, play around with it.
I’ve never seen it done this way, by editing the noise itself once in place. I guess it could be done that way, but why not just add that option to the noise generation in the first place.