- What do you want to achieve? Keep it simple and clear!
What I would like to achieve/gain is the ability to use and learn Fractal Brownian Motion. (a.k.a. FBM)
- What is the issue? Include screenshots / videos if possible!
My issue is implementing it into my noise script.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
The solutions I’ve tried so far are, looking on YouTube, and Developer Hub (I don’t know many scripting help website so any feedback on that would be great!)
So this is the code I want to add FBM to.
function NoiseGeneration(mapsize,freq,seed)
local heightmap = {}
for x = -mapsize,mapsize do
local hx = {}
heightmap[x] = hx
for z = -mapsize,mapsize do
local y = math.noise((x+seed)/freq ,(z+seed)/freq)
hx[z] = math.clamp(y+.5,0,1)
end
end
return heightmap
end
function TreeVisualize(mapsize,freq,seed)
local HeightMap = NoiseGeneration(mapsize,freq,seed)
local rng = Random.new()
local tree = game.ReplicatedStorage.Tree
-- Plane
local Part = Instance.new("Part",workspace)
Part.Name = "Plane"
Part.BrickColor = BrickColor.Green()
Part.Size = Vector3.new(mapsize,2,mapsize)
Part.Anchored = true
Part.Position = Vector3.new(0,0,0)
for x = -#HeightMap,#HeightMap do
wait()
local hx = HeightMap[x]
for z = -#hx,#hx do
local y = hx[z]*2
local chance = rng:NextInteger(0,1)
--print(chance<y,y)
if (chance < y) then
local tree = tree:Clone()
tree:SetPrimaryPartCFrame(CFrame.new(
x,
.5,
z
))
tree.Parent = workspace
end
end
end
end
function FBM()
-- Where I want to add the code
end
Please do not give me entire scripts or design entire systems for me.
Thank You!