feat(climate): Implement new weather effects and temperature modeling in climate simulation logic

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-03-26 02:22:25 -07:00
parent ce259725f7
commit e7f17db835
2 changed files with 17 additions and 4 deletions

View file

@ -93,7 +93,7 @@ func _apply_orbital_forcing(game_map: RefCounted, turn: int) -> void:
func _apply_aerosol_forcing(game_map: RefCounted) -> void:
## Apply stratospheric sulfate aerosol effects accumulated from volcanic/impact events.
## Phase 0: Natural aerosol generation — desert dust, volcanic outgassing, baseline.
## Phase 1: apply cooling and drying to magic deltas (solar blocking + evaporation loss).
## Phase 2: transport aerosol downwind (double-buffered snapshot).
## Phase 3: decay aerosol each turn.
@ -101,7 +101,20 @@ func _apply_aerosol_forcing(game_map: RefCounted) -> void:
if aerosol_cfg.is_empty():
return
# Short-circuit: skip turn if no aerosol exists anywhere
# Phase 0: Natural sources inject small aerosol each turn
var bg: float = _params.get("aerosol_background", 0.002)
var desert_rate: float = _params.get("aerosol_desert_dust", 0.005)
var volcano_rate: float = _params.get("aerosol_volcanic_outgas", 0.015)
for axial: Vector2i in game_map.tiles:
var tile: Variant = game_map.tiles[axial]
var inject: float = bg
if tile.biome_id == "desert":
inject += desert_rate
elif tile.biome_id == "volcano":
inject += volcano_rate
tile.sulfate_aerosol = maxf(0.0, tile.get("sulfate_aerosol", 0.0) + inject)
# Short-circuit: skip processing if no aerosol exists anywhere
var any_aerosol: bool = false
for axial: Vector2i in game_map.tiles:
if (game_map.tiles[axial] as Object).get("sulfate_aerosol") > 0.001:

View file

@ -34,7 +34,7 @@ const _DEFAULTS: Dictionary = {
"lake_thermal_conductivity": 0.05,
"river_moisture_transport": 0.075,
"mountain_rain_shadow_block": 0.9,
"solar_min": 0.15,
"solar_min": 0.05,
"solar_max": 0.70,
}
@ -290,7 +290,7 @@ func _solar_by_latitude(row: int, center_row: float) -> float:
## Mapped via solar_min/solar_max params to produce stable equilibrium
## temperatures that support reef survival and biome diversity.
var raw: float = 1.0 - absf((float(row) - center_row) / center_row)
var solar_min: float = _params.get("solar_min", _DEFAULTS.get("solar_min", 0.15))
var solar_min: float = _params.get("solar_min", _DEFAULTS.get("solar_min", 0.05))
var solar_max: float = _params.get("solar_max", _DEFAULTS.get("solar_max", 0.70))
return solar_min + (solar_max - solar_min) * raw