I think I need to switch to trying Simplex noise or stop trying to copy Earth
This commit is contained in:
+14
-7
@@ -67,7 +67,7 @@ local biomes = {
|
||||
-- },
|
||||
[900] = {
|
||||
name = "deep ocean",
|
||||
altitude = {min = -math.huge, max = -400},
|
||||
altitude = {min = -math.huge, max = -5000},
|
||||
temperature = {min = -math.huge, max = math.huge},
|
||||
humidity = {min = -math.huge, max = math.huge},
|
||||
color = {0, 0, 0.25, 1},
|
||||
@@ -114,19 +114,26 @@ local function generate()
|
||||
|
||||
map.size = 500
|
||||
map.tile_size = 1
|
||||
map.altitude = heightmap.create(map.size, map.size, -440, 8849) -- meters
|
||||
map.altitude = heightmap.create(map.size, map.size, 0, 1) -- meters
|
||||
map.temperature = heightmap.create(map.size, map.size, -89.2, 56.7) -- celsius
|
||||
map.humidity = heightmap.create(map.size, map.size, 18, 3240) -- millimeters rainfall
|
||||
|
||||
local function altitude_ocean_bias(altitude)
|
||||
local bias = 3.5 -- higher -> more ocean
|
||||
local normalized_altitude = (altitude - -400) / (8849 - -440)
|
||||
return -440 + normalized_altitude^bias * (8849 - -440)
|
||||
-- local function earthlike_altitude_adjustment(altitude)
|
||||
-- -- max too low, min too high, too much ocean
|
||||
-- return 6099 - 114909 * altitude + 830891 * altitude^2 - 2.72e6 * altitude^3 + 4.19e6 * altitude^4 - 3.02e6 * altitude^5 + 815866 * altitude^6
|
||||
-- end
|
||||
local function earthlike_altitude_adjustment(altitude)
|
||||
-- good oceans, too much high altitude
|
||||
return -10948 + 101018 * altitude - 643382 * altitude^2 + 2.17e6 * altitude^3 - 3.62e6 * altitude^4 + 2.87e6 * altitude^5 -852042 * altitude^6
|
||||
end
|
||||
-- local function earthlike_altitude_adjustment(altitude)
|
||||
-- -- only creates ocean (wtf)
|
||||
-- return -10851 + 151279 * altitude - 1.14e6 * altitude^2 +3.84e6 * altitude^3 -6.11e6 * altitude^4 +4.48e6 * altitude^5 - 1.21e6 * altitude^6
|
||||
-- end
|
||||
local min, max = math.huge, -math.huge
|
||||
for x = 0, map.size do
|
||||
for y = 0, map.size do
|
||||
local value = altitude_ocean_bias(map.altitude[x][y])
|
||||
local value = earthlike_altitude_adjustment(map.altitude[x][y])
|
||||
if value > max then max = value end
|
||||
if value < min then min = value end
|
||||
map.altitude[x][y] = value
|
||||
|
||||
Reference in New Issue
Block a user