summaryrefslogtreecommitdiff
path: root/server/worldgen.lua
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-02-11 15:33:13 +0000
committerubq323 <ubq323@ubq323.website>2023-02-11 15:33:13 +0000
commitb4c189ab1b6233c7e7e260446e80b789f375b5d6 (patch)
treea051262e11172ccd65015fc89f4b92adf0de2ae7 /server/worldgen.lua
parent81ee73e37348eaae6b1e4a23378d13d129133904 (diff)
change from random worldgen to be based on a hash of position; implement serverside chunk unloading
Diffstat (limited to 'server/worldgen.lua')
-rw-r--r--server/worldgen.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/worldgen.lua b/server/worldgen.lua
index 2ef1ac0..0a8485b 100644
--- a/server/worldgen.lua
+++ b/server/worldgen.lua
@@ -4,18 +4,18 @@ local chunk = require"common.chunk"
local ChunkS = require"chunk".ChunkS
local CHUNK_SIZE = require"common.constants".CHUNK_SIZE
-local function p(amp,scale) return {scale=scale,amp=amp,gen=noise.PerlinNoise:make()} end
--- local ng = noise.NoiseAgg:make{
--- p(1,20),
--- -- p(0.7,2),
--- p(0.5,15),
--- --p(2,200),
--- }
+local function p(amp,scale,seed)
+ return {
+ scale=scale,
+ amp=amp,
+ gen=noise.PerlinNoise:make(seed)
+ }
+end
-- whether there is a tile there or not
-local surface_ng = noise.NoiseAgg:make{p(1,20),p(0.5,15)}
+local surface_ng = noise.NoiseAgg:make{p(1,20,1),p(0.7,5,2)}
-- if there is a tile there, what color should it be
-local color_ng = noise.NoiseAgg:make{p(1,20),p(0.5,15)}
+local color_ng = noise.NoiseAgg:make{p(1,20,3),p(0.5,15,4)}
local function gen_chunk(chpos)