planetsim/src/render/Colors.hpp
Jonas Reith ee2ef3655b Civ Step 3: territory, nations & political borders
Group settlements into realms (city-states / kingdoms / empires) and give them
territory + political borders, all derived deterministically from the saved
settlement set (no save-version bump, step-back free).

- PlanetNation.{hpp,cpp}: computeTerritory() — size-scaled influence range per
  settlement, realm grouping (a town joins the nearest larger capital within its
  annexation reach, else founds its own nation), tier by member count / total pop,
  and per-cell ownership maximising range - angular-distance (wilderness frontiers
  where no settlement reaches). No RNG → tectonic stream untouched.
- Territory colour mode + nationColor, buildNationBorders (plate dual-contour
  reused), realm labels at capitals, a Realms info tab, cell-info realm line, and
  kind=4 WorldEvents (realm founded / rises to empire / collapsed). Key P toggles
  the view + borders; territory recomputed once per sim year, on placement, load
  and step-back.
- civTerritory*/civVassalRange/civEmpire* config knobs (self-describing → no save
  break); test_nation.cpp covers ownership/wilderness, empires vs city-states,
  realm grouping, tiers, determinism, RNG isolation, save/load parity.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 14:00:32 +02:00

47 lines
2.2 KiB
C++

#pragma once
#include "raylib.h"
#include "PlanetTypes.hpp" // Biome
// Cell color mapping for the viewer. Pure functions of cell properties.
enum class ColorMode { Elevation, Plate, Age, Crust, Biome, Temperature, Precip,
FloraDensity, FaunaDensity, FungaDensity,
Ecoregion, Habitability, Territory,
TempSummer, TempWinter, Seasonality }; // 6 cycles these temp sub-views
Color elevationColor(double e, double seaLevel);
Color plateColor(int id);
Color ageColor(double age, double maxAge);
Color crustColor(bool oceanic);
// Phase-2.5 inland water (lakes): a bright turquoise, clearly distinct from ocean.
Color lakeColor();
// Phase-3 biome palette + display name.
Color biomeColor(Biome b);
const char* biomeName(Biome b);
// Human-readable name of a color mode (for the active-view label).
const char* colorModeName(ColorMode m);
// Phase-3 climate: temperature in deg C (blue cold -> red hot); precip normalized 0..1
// (tan dry -> green -> blue wet).
Color tempColor(double celsius);
Color precipColor(double moist01);
// Seasonality: summer-winter temperature range in deg C (grey calm -> orange extreme).
Color seasonColor(double rangeC);
// Tide level (m), diverging around 0: low tide amber -> high tide cyan. `range` sets the
// saturation scale (meters at which the colour is fully amber/cyan).
Color tideColor(double level, double range);
// Biota density ramps (0..1): flora barren->lush green, fauna pale->amber/red,
// funga pale->violet/brown.
Color floraColor(double d01);
Color faunaColor(double d01);
Color fungaColor(double d01);
// Marine biota density ramps (0..1) -- a distinct sea palette so ocean reads as
// ocean: marine flora deep blue->bright teal/green bloom, marine fauna deep
// blue->cyan->warm. Used for water cells in the flora/fauna views.
Color marineFloraColor(double d01);
Color marineFaunaColor(double d01);
Color ecoregionColor(int id, Biome b, double productivity);
// Habitability heat map (0..1): barren grey -> fertile green/gold (where civilization can thrive).
Color habitabilityColor(double h01);
// Per-nation territory tint (golden-ratio HSV, offset from plateColor so realms read distinctly).
Color nationColor(int id);