Skip to main content

Lifecycle Model

This page defines the mathematical model used by the standalone Python simulation tool. The purpose is not to be biologically perfect. The purpose is to make Faerals tunable before the game systems are implemented in Rust.

The model tracks populations by zone × species, then updates them each tick using climate, biome fit, predator pressure, player pressure, migration, and sanctuary restoration.

Core loop

State variables

Each simulated pair keeps four values:

  • population - current local density in the range 0.0 to 1.0
  • pressure - how heavily the player has been farming that pair
  • anomaly_pressure - how unstable the zone currently is
  • extinction_streak - how many ticks the population has stayed below the extinction threshold
  • region_affinity - intrinsic pull toward a region, independent of pressure and climate
  • habitat_tags - region features such as water, grass, sand, snow, hot, or sunny

Compatibility score

The simulation computes a compatibility score for each zone × species pair.

compatibility =
hard_habitat_gate
× combined_biome_habitat_climate_food_score
× prey_balance_score
× sanctuary_score
× region_affinity

hard_habitat_gate is 0 when a species requires a habitat tag that the zone does not have. That means a water-bound species cannot spawn in a dry zone, even if other factors look favorable.

This score drives both spawn likelihood and migration pressure.

Spawn score

The encounter model is:

spawn_score =
base_spawn_modifier
× compatibility
× support_score

support_score is shaped by current population presence, prey balance, player pressure, and sanctuary stability. The result stays in the 0.0 to 1.0 range. If compatibility is 0, the spawn score is 0.

Parameter reference

ParameterWhat it controlsWhen you raise it
season_length_ticksHow fast the world moves through Spring, Summer, Autumn, WinterSeasons turn over faster and climate swings become more visible
biome_weightHow much preferred biome matters in spawn scoreSpecies become more concentrated in their home biomes
climate_weightHow much temperature and humidity matterClimate mismatches suppress spawns more aggressively
population_weightHow strongly local abundance affects spawnsDense populations become easier to encounter and observe
region_affinity_weightHow much intrinsic region pull affects spawnsSpecies cluster more strongly in their preferred regions
predator_weightHow much prey/predator balance mattersFood-chain pressure has a larger effect on encounters
pressure_weightHow much capture pressure suppresses spawnsRepeated farming drives spawn rates down faster
sanctuary_weightHow much restoration stabilises a zoneRestored sanctuaries recover encounter density sooner
base_capture_rateThe baseline strength of player capture activityEncounters convert into population loss more quickly
pressure_gain_per_captureHow much one capture raises pressureFarming leaves a longer trace in that zone
pressure_decay_rateHow quickly pressure fades with no farmingOverused species recover faster after the player leaves
sanctuary_recovery_rateHow quickly restored zones shed anomaly pressureRecovered sanctuaries become stable faster
anomaly_growth_rateHow quickly unrested zones worsenUnrestored zones become unstable faster
local_extinction_thresholdThe population level that counts as dangerously lowSpecies are declared extinct sooner
local_extinction_ticksHow long low population must persistExtinction becomes stricter and less noisy
reintroduction_rateHow much released Faerals restore a depleted zoneReleasing Faerals has a stronger recovery effect

Visual companion

The simulator writes plots into tools/lifecycle-sim/outputs/:

  • population_timeseries.png
  • spawn_score_timeseries.png
  • pressure_recovery.png
  • zone_species_heatmap.png
  • spawn_rates_by_region.png
  • heatmap_frames/tick_####.png
  • zone_species_heatmap.gif
  • events.jsonl
  • extinction_risk.png
  • sanctuary_timeline.png

Running the tool

cd tools/lifecycle-sim
python -m faerals_lifecycle.cli run --scenario balanced_mvp --ticks 240 --seed 42 --out outputs/balanced

The balanced_mvp, overcapture, delayed_sanctuaries, and reintroduction scenarios are designed to stress different parts of the lifecycle loop. Migration is intentionally small per tick. A species only shifts noticeably when local compatibility drops or a neighboring region becomes clearly better. If climate, prey balance, or sanctuary state improves again, the flow reverses and the population drifts back toward the more compatible region. The CLI shows a progress bar while the simulation runs and streams major events such as sanctuary restoration, reintroduction, and local extinction.