-
What do you want to achieve? Keep it simple and clear!
i want to achieve a smooth terrain generation like minecraft plains biome -
What is the issue? Include screenshots / videos if possible!
it keeps glitching and not generating the noise in x axis properly
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i tried searching videos on youtube, tried looking on developer hub, but it keeps glitching
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
here’s my code of the terrain generation:
worldsize = 100
blocksize = 3
layers = 5
chunksize = 10
waterlevel = -2
--World Generation
game.Workspace.GameLoaded.Value = false
seed = math.random()
print('Seed: ' .. seed)
frequency = 12
amplitude = 8
totalx = 0
totalz = 0
topblock = game.ReplicatedStorage.Blocks.Grass
for chunkindexX = 1,(worldsize / chunksize) do
game["Run Service"].Heartbeat:Wait()
for chunkindexZ = 1,(worldsize / chunksize) do
local chunk = Instance.new('Model',game.ReplicatedStorage.Storage)
chunk.Name = 'Chunk: ' .. chunkindexX .. '/' .. chunkindexZ
local chunkpos = Instance.new('Vector3Value',chunk)
chunkpos.Name = 'ChunkPosition'
chunkpos.Value = Vector3.new(chunkindexX* (chunksize * 3) + 3,0,chunkindexZ* (chunksize * 3) + 3)
for x = 1,chunksize do
totalx = totalx + 1
for z = 1,chunksize do
totalz = totalz + 1
local block = topblock:Clone()
block.Parent = chunk
noise = math.floor((math.noise(seed,totalx/frequency,totalz/frequency) * amplitude)) * 3
block.Position = Vector3.new( chunkindexX * 30 + x * blocksize,noise,chunkindexZ * 30 + z * blocksize)
block.Size = Vector3.new(blocksize,blocksize,blocksize)
for i = 1,layers do
if i < 4 then
local block2 = game.ReplicatedStorage.Blocks.Dirt:Clone()
block2.Parent = chunk
block2.Position = Vector3.new(block.Position.X,block.Position.Y - (i * blocksize),block.Position.Z)
block2.Size = Vector3.new(blocksize,blocksize,blocksize)
else
local block2 = game.ReplicatedStorage.Blocks.Stone:Clone()
block2.Parent = chunk
block2.Position = Vector3.new(block.Position.X,block.Position.Y - (i * blocksize),block.Position.Z)
block2.Size = Vector3.new(blocksize,blocksize,blocksize)
end
end
end
end
end
end
any help is appreciated!