MapGenerator: new map

This commit is contained in:
Van
2026-08-30 18:19:05 +03:00
parent 582658d437
commit 7a06e7fffb
2 changed files with 82 additions and 10436 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
-- --- MapGen definiton --- -- --- MAPGEN DEFINITION ---
local id = core.get_content_id local id = core.get_content_id
local mathRound = math.round local mathRound = math.round
@@ -52,8 +52,10 @@ mapGenerator:registerLayer('midgard', {
humidityMapScale = 100, humidityMapScale = 100,
}) })
-- --- CLIMATE ZONES ---
-- TODO: Config should be imported from .json file in the world's folder -- TODO: Config should be imported from .json file in the world's folder
local ocean = { local warmOcean = {
['landscape'] = { ['landscape'] = {
offset = -10, offset = -10,
scale = 3, scale = 3,
@@ -83,7 +85,67 @@ local ocean = {
}, },
} }
local common_lands = { local temperateOcean = {
['landscape'] = {
offset = -10,
scale = 3,
spread = {x = 10, y = 10, z = 10},
seed = 420,
octaves = 2,
persistence = 0.4,
lacunarity = 2,
},
['temp'] = {
offset = -10,
scale = 5,
spread = {x = 10, y = 10, z = 10},
seed = 47,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
['humidity'] = {
offset = -10,
scale = 5,
spread = {x = 10, y = 10, z = 10},
seed = 47,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
}
local coldOcean = {
['landscape'] = {
offset = -10,
scale = 3,
spread = {x = 10, y = 10, z = 10},
seed = 420,
octaves = 2,
persistence = 0.4,
lacunarity = 2,
},
['temp'] = {
offset = -10,
scale = 5,
spread = {x = 10, y = 10, z = 10},
seed = 47,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
['humidity'] = {
offset = -10,
scale = 5,
spread = {x = 10, y = 10, z = 10},
seed = 47,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
}
local tropicalSoutheast = {
['landscape'] = { ['landscape'] = {
offset = 10, offset = 10,
scale = 5, scale = 5,
@@ -113,7 +175,7 @@ local common_lands = {
}, },
} }
local foresty_lands = { local steppeSouthwest = {
['landscape'] = { ['landscape'] = {
offset = 5, offset = 5,
scale = 8, scale = 8,
@@ -143,7 +205,7 @@ local foresty_lands = {
}, },
} }
local hilly_lands = { local temperateCentralZone = {
['landscape'] = { ['landscape'] = {
offset = 15, offset = 15,
scale = 12, scale = 12,
@@ -173,7 +235,7 @@ local hilly_lands = {
}, },
} }
local low_mountains = { local lowMountains = {
['landscape'] = { ['landscape'] = {
offset = 30, offset = 30,
scale = 20, scale = 20,
@@ -203,37 +265,7 @@ local low_mountains = {
}, },
} }
local high_mountains = { local subarcticNorth = {
['landscape'] = {
offset = 60,
scale = 35,
spread = {x = 30, y = 30, z = 30},
seed = 22222,
octaves = 4,
persistence = 0.55,
lacunarity = 2,
},
['temp'] = {
offset = -10,
scale = 15,
spread = {x = 35, y = 35, z = 35},
seed = 54,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
['humidity'] = {
offset = 20,
scale = 10,
spread = {x = 30, y = 30, z = 30},
seed = 55,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
}
local highest_peaks = {
['landscape'] = { ['landscape'] = {
offset = 100, offset = 100,
scale = 50, scale = 50,
@@ -263,7 +295,7 @@ local highest_peaks = {
}, },
} }
local rivers = { local antarcticNorth = {
['landscape'] = { ['landscape'] = {
offset = -5, offset = -5,
scale = 2, scale = 2,
@@ -293,7 +325,7 @@ local rivers = {
}, },
} }
local lakes = { local icyNorthernMMountains = {
['landscape'] = { ['landscape'] = {
offset = -8, offset = -8,
scale = 2, scale = 2,
@@ -323,237 +355,21 @@ local lakes = {
}, },
} }
local rocky_shores = {
['landscape'] = {
offset = 2,
scale = 4,
spread = {x = 80, y = 80, z = 80},
seed = 66666,
octaves = 3,
persistence = 0.5,
lacunarity = 2,
},
['temp'] = {
offset = 15,
scale = 8,
spread = {x = 15, y = 15, z = 15},
seed = 62,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
['humidity'] = {
offset = 70,
scale = 10,
spread = {x = 15, y = 15, z = 15},
seed = 63,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
}
local rocky_islands = {
['landscape'] = {
offset = 8,
scale = 10,
spread = {x = 12, y = 12, z = 12},
seed = 77777,
octaves = 3,
persistence = 0.5,
lacunarity = 2,
},
['temp'] = {
offset = 20,
scale = 8,
spread = {x = 20, y = 20, z = 20},
seed = 64,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
['humidity'] = {
offset = 60,
scale = 15,
spread = {x = 20, y = 20, z = 20},
seed = 65,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
}
local swamp_land = {
['landscape'] = {
offset = 10,
scale = 2,
spread = {x = 120, y = 120, z = 120},
seed = 88888,
octaves = 2,
persistence = 0.4,
lacunarity = 2,
},
['temp'] = {
offset = 25,
scale = 5,
spread = {x = 15, y = 15, z = 15},
seed = 66,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
['humidity'] = {
offset = 85,
scale = 10,
spread = {x = 15, y = 15, z = 15},
seed = 67,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
},
}
local v = vector.new local v = vector.new
for _, c in ipairs({'landscape', 'temp', 'humidity'}) do for _, c in ipairs({'landscape', 'temp', 'humidity'}) do
mapGenerator:registerLayerNoiseColor('midgard', c, '#4978c6', ocean[c]) mapGenerator:registerLayerNoiseColor('midgard', c, '#5792ce', warmOcean[c])
mapGenerator:registerLayerNoiseColor('midgard', c, '#81c948', common_lands[c]) mapGenerator:registerLayerNoiseColor('midgard', c, '#4978c6', temperateOcean[c])
mapGenerator:registerLayerNoiseColor('midgard', c, '#187726', foresty_lands[c]) mapGenerator:registerLayerNoiseColor('midgard', c, '#4763b1', coldOcean[c])
mapGenerator:registerLayerNoiseColor('midgard', c, '#357a60', hilly_lands[c]) mapGenerator:registerLayerNoiseColor('midgard', c, '#a0ab72', tropicalSoutheast[c])
mapGenerator:registerLayerNoiseColor('midgard', c, '#5a7269', low_mountains[c]) mapGenerator:registerLayerNoiseColor('midgard', c, '#dcd492', steppeSouthwest[c])
mapGenerator:registerLayerNoiseColor('midgard', c, '#773b18', high_mountains[c]) mapGenerator:registerLayerNoiseColor('midgard', c, '#a3c27c', temperateCentralZone[c])
mapGenerator:registerLayerNoiseColor('midgard', c, '#a3a3a3', highest_peaks[c]) mapGenerator:registerLayerNoiseColor('midgard', c, '#999d8f', lowMountains[c])
mapGenerator:registerLayerNoiseColor('midgard', c, '#182077', rivers[c]) mapGenerator:registerLayerNoiseColor('midgard', c, '#569574', subarcticNorth[c])
mapGenerator:registerLayerNoiseColor('midgard', c, '#06f5ff', lakes[c]) mapGenerator:registerLayerNoiseColor('midgard', c, '#76c2b6', antarcticNorth[c])
mapGenerator:registerLayerNoiseColor('midgard', c, '#677a48', rocky_shores[c]) mapGenerator:registerLayerNoiseColor('midgard', c, '#bac0ad', icyNorthernMMountains[c])
mapGenerator:registerLayerNoiseColor('midgard', c, '#e4dc36', rocky_islands[c])
mapGenerator:registerLayerNoiseColor('midgard', c, '#3b7718', swamp_land[c])
end end
--[[
local land1 = {
offset = -10,
scale = 5,
spread = {x = 10, y = 10, z = 10},
seed = 47,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
}
local land2 = {
offset = 20,
scale = 5,
spread = {x = 30, y = 30, z = 30},
seed = 47,
octaves = 3,
persistence = 0.4,
lacunarity = 2,
}
local land3 = {
offset = 40,
scale = 5,
spread = {x = 45, y = 20, z = 45},
seed = 472,
octaves = 3,
persistence = 0.3,
lacunarity = 2,
}
local climat1 = {
offset = 80,
scale = 10,
spread = {x = 10, y = 10, z = 10},
seed = 47,
octaves = 8,
persistence = 0.6,
lacunarity = 2,
}
local climat2 = {
offset = 30,
scale = 10,
spread = {x = 10, y = 10, z = 10},
seed = 47,
octaves = 8,
persistence = 0.6,
lacunarity = 2,
}
local climat0 = {
offset = 50,
scale = 0,
spread = {x = 10, y = 10, z = 10},
seed = 47,
octaves = 8,
persistence = 0.4,
lacunarity = 2,
}
local v = vector.new
--[[
mapGenerator:register2DPeaks('midgard',
{
landscapeNoise = land1,
tempNoise = climat2,
humidityNoise = climat2,
},{
v(500, 0, 500),
v(-500, 0, -500),
v(-500, 0, 500),
v(500, 0, -500),
})
mapGenerator:register2DPeaks('midgard',
{
landscapeNoise = land2,
tempNoise = climat1,
humidityNoise = climat1,
},{
v(-300, 0, 300),
v(200, 0, -400),
})
mapGenerator:register2DPeaks('midgard',
{
landscapeNoise = land2,
tempNoise = climat2,
humidityNoise = climat2,
},{
v(200, 0, 100),
v(-300, 0, -200),
})--]]
--[[
for _, c in ipairs({'landscape', 'temp', 'humidity'}) do
mapGenerator:registerLayerNoiseColor('midgard', c, '#4978c6', land1)
mapGenerator:registerLayerNoiseColor('midgard', c, '#77ea72', land2)
mapGenerator:registerLayerNoiseColor('midgard', c, '#46B331', land3)
--[[
mapGenerator:register2DPeaks('midgard', c, {
{
color = '#77ea72',
pos = vector.new(512, 0, 512)
},
{
color = '#4978c6',
pos = vector.new(512, 0, -512)
},
{
color = '#77ea72',
pos = vector.new(-512, 0, -512)
},
{
color = '#4978c6',
pos = vector.new(-512, 0, 512)
},
})
end
--]]
-- [[
-- --- Biomes --- -- --- Biomes ---
---@type ValueNoise ---@type ValueNoise