better sizing of current status

This commit is contained in:
2026-08-19 00:20:16 -06:00
parent 4484e5be27
commit c04b9d4574
3 changed files with 96 additions and 73 deletions
+17
View File
@@ -556,4 +556,21 @@ function simplex.Seed(seed)
end
end
-- TODO test functionality
function simplex.FractalBrownianMotion2D(x, y, octaves, lacunarity, gain)
octaves = octaves or 4
lacunarity = lacunarity or 2
gain = gain or 0.5
local total, amplitude, frequency, peak_amplitude = 0, 1, 1, 0
for i = 1, octaves do
total = total + amplitude * simplex.Noise2D(x * frequency, y * frequency)
peak_amplitude = peak_amplitude + amplitude
amplitude = amplitude * gain
frequency = frequency * lacunarity
end
return total / peak_amplitude -- normalize to [-1, 1]
end
return simplex
+6
View File
@@ -1,3 +1,5 @@
math.randomseed(os.time())
local map_generator = require "map_nextgen"
local lovebird = require "lib.lovebird"
local lume = require "lib.lume"
@@ -81,5 +83,9 @@ love.keypressed = function(key)
love.event.quit()
elseif key == "r" then
love.load()
elseif key == "=" then
map.tile_size = map.tile_size * 2
elseif key == "-" then
map.tile_size = map.tile_size / 2
end
end
+2 -2
View File
@@ -54,7 +54,7 @@ simplex_map.generate = function(size, scale, min, max)
for x = 1, map.size do
map[x] = {}
for y = 1, map.size do
map[x][y] = simplex.Noise2D(x * scale, y * scale)
map[x][y] = simplex.FractalBrownianMotion2D(x * scale, y * scale, 7)
end
end
@@ -117,7 +117,7 @@ local generate = function()
local map = {}
map.size = 500
map.tile_size = 1 -- TODO tile_size really shouldn't be the responsibility of the map generator - it's a rendering detail, not a map feature
map.altitude = simplex_map.generate(map.size, 0.005, 0, 1) -- meters
map.altitude = simplex_map.generate(map.size, 0.001, 0, 1) -- meters
map.temperature = simplex_map.generate(map.size, 0.005, -89.2, 56.7) -- celsius
map.rainfall = simplex_map.generate(map.size, 0.005, 18, 3240) -- millimeters rainfall