Converting perlin noise from mapgen.cpp to lua format
So i found the perlin for choosing normal or desert biomes ...
0.6 and 0.2 seem to be the offsets, 250 the scale, 9130 the seeddiff, 3 octaves, 0.5 persistence.
Would the lua equivalent perlin pattern be ...
?
Since 0.6 * 250 = 150 and 0.2 * 250 = 50.
I want to get a grip on the pattern used for desert biomes :)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
double d = noise2d_perlin(
0.6+(float)p2d.X/250, 0.2+(float)p2d.Y/250,
seed+9130, 3, 0.50);
if(d > 0.45)
return BT_DESERT;
if(d > 0.35 && (noise2d( p2d.X, p2d.Y, int(seed) ) + 1.0) > ( 0.45 - d ) * 20.0 )
return BT_DESERT;
return BT_NORMAL;
0.6 and 0.2 seem to be the offsets, 250 the scale, 9130 the seeddiff, 3 octaves, 0.5 persistence.
Would the lua equivalent perlin pattern be ...
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local perlin1 = env:get_perlin(9130, 3, 0.5, 250)
local noise = perlin1:get2d({x=pos.x + 150, y=pos.z + 50})
Since 0.6 * 250 = 150 and 0.2 * 250 = 50.
I want to get a grip on the pattern used for desert biomes :)