Hello! recently I’ve been working a lot on Perlin Noise Terrain Generation however I’ve run into a issue with the randomizer I’m using this code block right here
local X = 225
local Z = 225
local randomNum = math.random(15, 200) --Defines the stretch of the terrain
local waterHeight = math.random(-35, -20) --Defines the height of the water
local sandHeight = math.random(waterHeight+2, waterHeight+4) --This determines how much extra sand will appear
local treeRarity = math.random(75, 100) --The higher the number the more rare trees become
-----------------------------------------------
local Seed = math.random(randomNum-20, randomNum+20)
local randomNumTwo = math.random(randomNum-10, randomNum+10)
local grid = {}
for x = 1, X do
grid[x] = {}
for z = 1, Z do
grid[x][z] = math.noise(x/randomNum, z/randomNumTwo) --Issue Here
end
end
and though it will use Perlin Noise Generation it won’t appear random. Any help is appreciated!
what this means is our alpha value is equivalant to the parameters we pass for f(a,b,t) now let’s say we know what a and b and f(a,b,t) is. How could we find what t is? We would need to solve the equation for t. Now let’s start with a more simple example, lets say we have
f(x) = 2x
we know what f(x) is but we don’t know what value we passed, say f(x) was 4. We can rewrite this as
4=2x
and then we can simply solve the equation by moving the variable x by using a system of equation to get 4/2 = x
we can rephrase this as
local X = 225
local Z = 225
local randomNum = math.random(15, 200) --Defines the stretch of the terrain
local waterHeight = math.random(-35, -20) --Defines the height of the water
local sandHeight = math.random(waterHeight+2, waterHeight+4) --This determines how much extra sand will appear
local treeRarity = math.random(75, 100) --The higher the number the more rare trees become
-----------------------------------------------
local Seed = math.random(randomNum-20, randomNum+20)
local randomNumTwo = math.random(randomNum-10, randomNum+10)
local grid = {}
for x = 1, X do
grid[x] = {}
for z = 1, Z do
grid[x][z] = math.noise(x/f(a,b,t), z/f(a,b,t) --Issue Here
end
end