Fauna

Wildlife roams the world as a living ecosystem. Deer herds cross meadows, foxes stalk the forest edge, songbirds migrate with the seasons, and individual animals near your settlement can become companions. The fauna system operates on three layers: regional population pools, visible roaming herds, and settlement individuals that bond with elves.

Overview

At world generation, 7 procedural species are created -- each with a unique name (e.g., "Ember Stag", "Copper Fox", "Sun Thrush") and ecological parameters. Every geological region maintains population counts for each species. When a region's population grows large enough, herds manifest as visible entities on the map. Animals that wander near buildings become individuals that elves can observe and bond with.

Species

The Food Web

ArchetypeTrophic LevelSizeSocialSeasonalTemperament
DeerHerbivoreMediumHerd (5--10)ResidentTolerant
RabbitHerbivoreSmallHerd (5--14)ResidentShy
FoxPredatorMediumPair (2--4)ResidentCurious
WolfPredatorLargePack (5--7)ResidentShy
SongbirdPollinatorTinyFlock (5--20)MigrantTolerant
BeePollinatorTinySwarm (5--20)HibernatorTolerant
CrowScavengerSmallPair (2--4)ResidentCurious

Source: crates/er-sim/src/sim/fauna_gen.rs, ARCHETYPES.

Trophic Cascade

The food web creates a chain of dependencies:

Flora density -> Herbivore capacity -> Predator capacity

  • Herbivore carrying capacity scales with flora count in the region (up to 2x base).
  • Predator carrying capacity scales with herbivore population (0.3x--2.0x base).
  • Predators consume up to 15% of herbivores per day.
  • Deforestation reduces flora, which reduces herbivore food, which reduces predator numbers -- a visible cascade.

Seasonal Behavior

PatternSpringSummerAutumnWinter
ResidentBreeding (1.5x births)NormalReduced breeding (0.6x)Minimal breeding (0.2x)
MigrantReturnNormalNormal90% depart
HibernatorNormalNormalNormalDormant (no births/deaths)

Migrant species (Songbird) mostly leave in winter -- their population drops to ~10% of normal. When they return in spring, their numbers recover through high birth rates.

Source: crates/er-sim/src/sim/fauna_systems.rs, fauna_pool_system.

The Three Layers

Layer 1: Regional Population Pools

Each geological region tracks population counts per species. Lotka-Volterra dynamics run at day boundary:

  • Logistic growth: births scale with distance from carrying capacity.
  • Predation: predators reduce herbivore populations proportionally.
  • Seasonal breeding: spring is boom time (1.5x), winter is lean (0.2x).
  • Fractional accumulation: sub-unit daily growth (e.g., 0.3 births/day) is tracked across days to prevent small populations from being stuck.

Pools seed at 40% of base capacity at world generation and recover naturally if depleted.

Layer 2: Roaming Herds

When a species' regional population exceeds 130% of base carrying capacity, herds manifest as ECS entities on the map:

  • Herds spawn near the region center with slight position jitter.
  • Maximum 2 herds per species per region.
  • Herds alternate between Grazing (stationary) and Migrating (walking to another region).
  • Migration uses A* pathfinding -- herds follow valid terrain paths, avoiding impassable tiles.
  • Movement updates every 10 ticks for smooth visible motion.
  • When a herd reaches its destination, it starts grazing again.
  • Herds dissolve back into the regional pool when their count drops below the species minimum (Solitary: 1, Pair: 2, Herd: 5).

Source: crates/er-sim/src/sim/fauna_systems.rs, herd_spawn_system, herd_move_system, herd_dissolve_system.

Layer 3: Settlement Individuals

Animals within 8 tiles of any building are "individuated" from their regional pool -- they become named ECS entities that persist near the settlement:

  • 15% daily chance of a new individual appearing near a building (drawn from the regional pool).
  • Maximum 4 individuals per species to keep entity counts bounded.
  • Shy species (Rabbit, Wolf) rarely individuate (10% of normal rate).
  • Individuals that wander more than 16 tiles from any building are dissolved back into the pool.
  • Bonded animals (with an elf companion) are never dissolved regardless of distance.

Source: crates/er-sim/src/sim/fauna_systems.rs, individuation_system.

Animal Bonding

How Bonds Form

Elves within 2 tiles of a bondable individual animal build a bond over time:

  1. The elf must be near the animal during a bonding tick (every 50 ticks).
  2. Bond growth depends on the elf's Stewardship skill: base 1 + (stewardship / 3), clamped to 1--5 per tick.
  3. Curious species (Fox, Crow) can be bonded by any elf.
  4. Tolerant species (Deer, Songbird, Bee) require Stewardship >= 3.
  5. Shy species (Rabbit, Wolf) cannot be bonded.
  6. Only one elf can bond with a given animal -- the first to reach threshold wins.

Bond Strength

RangeStatusEffect
0--19WaryAnimal tolerates proximity
20--59FamiliarAnimal follows loosely
60--100CompanionAnimal is named, follows elf, full bond

At strength 60, the animal becomes a companion:

  • It receives an automatic name (e.g., "Copper Fox Friend").
  • The bonding elf receives +20 Stewardship XP.

Bond Decay

Bonds decay when elf and animal are apart:

  • After 5 days without interaction, bond strength decreases by 1/day.
  • If bond drops to 0, the animal is no longer bonded and may be dissolved.

Source: crates/er-sim/src/sim/fauna_systems.rs, animal_bond_system, animal_bond_decay_system.

Observation and Inspiration

Elves near animals gain Nature inspiration:

  • Checked every 50 ticks.
  • Picks the most inspiring nearby species (not cumulative across animals).
  • Grants +1 Nature inspiration, soft-capped at 40 -- animals flavor inspiration rather than dominate it.
  • Observation radius: 3 tiles (Manhattan distance).

Species inspiration values:

SpeciesInspiration
Wolf4
Songbird4
Deer3
Fox3
Bee2
Crow2
Rabbit1

Source: crates/er-sim/src/sim/fauna_systems.rs, animal_observation_system.

Interactions

  • Seasons & Weather -- seasonal breeding rates drive population dynamics. Migrants depart in winter. Hibernators go dormant.
  • Hydrology -- drought concentrates fauna at water sources. Frozen rivers change herd movement paths.
  • Forest Spirit -- deforestation reduces flora, which reduces herbivore carrying capacity, which reduces predator populations.
  • Skills -- Stewardship skill gates bonding speed and species eligibility.
  • Inspiration -- animal observation contributes to Nature inspiration (soft-capped at 40).

Tips

  • Build near forests for deer. Forest-habitat species (Deer, Fox, Wolf) prefer forested regions. Settlement buildings on the forest edge attract individuated Deer for observation and bonding.

  • Songbirds vanish in winter. Migrant Songbirds drop to 10% population in winter, taking their +4 inspiration bonus with them. Enjoy them in spring and summer.

  • Level Stewardship to 3 early. Curious species (Fox, Crow) bond easily but most forest animals are Tolerant, requiring Stewardship 3+. Assign an elf to spend time near animals.

  • Predators keep the ecosystem balanced. Wolf and Fox populations control herbivore numbers, preventing overgrazing that would damage flora and soil. Resist the urge to "protect" prey -- healthy predator populations mean a healthy forest.

  • Watch for herds crossing the map. When you see a herd entity moving between regions, that's the ecology in action -- populations responding to carrying capacity. A region with many herds is thriving.

  • Companions follow their elf. A bonded companion at strength 60+ follows its elf, providing a persistent +1 Nature inspiration within observation range. This is worth the Stewardship investment.

  • Don't neglect bonds. After 5 idle days, bond strength decays. Keep bonded elves near their companions or the bond will weaken.