fucking things up, frozen
This commit is contained in:
+6
-4
@@ -74,11 +74,11 @@ love.draw = function()
|
||||
|
||||
for x = 1, map.size do
|
||||
for y = 1, map.size do
|
||||
-- local value = map.biome[x][y]
|
||||
local value = map.temperature[x][y]
|
||||
local value = map.biome[x][y]
|
||||
-- local value = map.temperature[x][y]
|
||||
if value then
|
||||
-- love.graphics.setColor(value)
|
||||
love.graphics.setColor( (value + map.temperature.max) / (map.temperature.max + math.abs(map.temperature.min)) , 0, 0, 1)
|
||||
love.graphics.setColor(value)
|
||||
-- love.graphics.setColor( (value + map.temperature.max) / (map.temperature.max + math.abs(map.temperature.min)) , 0, 0, 1)
|
||||
love.graphics.rectangle("fill", x * map.tile_size, y * map.tile_size, map.tile_size, map.tile_size)
|
||||
end
|
||||
end
|
||||
@@ -90,6 +90,8 @@ love.keypressed = function(key)
|
||||
love.event.quit()
|
||||
elseif key == "r" then
|
||||
love.load()
|
||||
elseif key == "t" then
|
||||
print(running_average.count("minT"))
|
||||
elseif key == "=" then
|
||||
map.tile_size = map.tile_size * 2
|
||||
elseif key == "-" then
|
||||
|
||||
+18
-4
@@ -5,6 +5,13 @@ local simplex_map = require "lib.simplex_map"
|
||||
|
||||
local biomes = {
|
||||
-- biomes are checked in order, with the first candidate always being selected
|
||||
[800] = {
|
||||
name = "sea ice",
|
||||
altitude = {min = -math.huge, max = 0},
|
||||
temperature = {min = -math.huge, max = -2},
|
||||
rainfall = {min = -math.huge, max = math.huge},
|
||||
color = {0.6, 0.6, 1, 1},
|
||||
},
|
||||
[900] = {
|
||||
name = "deep ocean",
|
||||
altitude = {min = -math.huge, max = -5000},
|
||||
@@ -19,6 +26,13 @@ local biomes = {
|
||||
rainfall = {min = -math.huge, max = math.huge},
|
||||
color = {0, 0, 0.5, 1},
|
||||
},
|
||||
[1500] = {
|
||||
name = "frozen (definition, 0 C)",
|
||||
altitude = {min = -math.huge, max = math.huge},
|
||||
temperature = {min = -math.huge, max = 0},
|
||||
rainfall = {min = -math.huge, max = math.huge},
|
||||
color = {1, 1, 1, 1},
|
||||
},
|
||||
[2000] = {
|
||||
name = "snowline (middle estimate)",
|
||||
altitude = {min = 4000, max = math.huge},
|
||||
@@ -59,8 +73,8 @@ local generate = function()
|
||||
}
|
||||
map.temperature = simplex_map.generate{ -- in celsius
|
||||
-- -20 to 45 chosen by looking at the temperature range shown on https://openclimatemap.org/
|
||||
size = map.size, scale = 0.005, min = -20, max = 45, -- approximate target extremes of -89.2 to 56.7
|
||||
octaves = 1, lacunarity = 2, gain = 0.5,
|
||||
size = map.size, scale = 0.005, min = 20, max = 65, -- approximate target extremes of -89.2 to 56.7
|
||||
octaves = 2, lacunarity = 2, gain = 0.5,
|
||||
}
|
||||
map.rainfall = simplex_map.generate{ -- in millimeters of rainfall
|
||||
size = map.size, scale = 0.005, -- min = 18, max = 3240,
|
||||
@@ -103,8 +117,8 @@ local generate = function()
|
||||
temperature = temperature + altitude / 1000 -- -1 C / km (deep water adjustment)
|
||||
end
|
||||
-- modify temperature by latitude
|
||||
local polar_distance = math.abs(y - (map.size / 2))^1.1 -- experimenting with slight non-linearity
|
||||
local max_temperature_delta = 40
|
||||
local polar_distance = math.abs(y - (map.size / 2))^1.3 -- experimenting with slight non-linearity
|
||||
local max_temperature_delta = 10
|
||||
temperature = temperature - (polar_distance / map.size * 2 * max_temperature_delta)
|
||||
-- 'save' temperature changes
|
||||
map.temperature[x][y] = temperature
|
||||
|
||||
Reference in New Issue
Block a user