Fauna
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 has 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
| Archetype | Trophic Level | Size | Social | Seasonal | Temperament |
|---|---|---|---|---|---|
| Deer | Herbivore | Medium | Herd (5--10) | Resident | Tolerant |
| Rabbit | Herbivore | Small | Herd (5--14) | Resident | Shy |
| Fox | Predator | Medium | Pair (2--4) | Resident | Curious |
| Wolf | Predator | Large | Pack (5--7) | Resident | Shy |
| Songbird | Pollinator | Tiny | Flock (5--20) | Migrant | Tolerant |
| Bee | Pollinator | Tiny | Swarm (5--20) | Hibernator | Tolerant |
| Crow | Scavenger | Small | Pair (2--4) | Resident | Curious |
Source: crates/er-sim/src/sim/fauna_gen.rs, ARCHETYPES.
Trophic Cascade
The food web is 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.
Seasonal Behavior
| Pattern | Spring | Summer | Autumn | Winter |
|---|---|---|---|---|
| Resident | Breeding (1.5x births) | Normal | Reduced breeding (0.6x) | Minimal breeding (0.2x) |
| Migrant | Return | Normal | Normal | 90% depart |
| Hibernator | Normal | Normal | Normal | Dormant (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 breeding is 1.5x, winter breeding is 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 and avoid 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:
- The elf must be near the animal during a bonding tick (every 50 ticks).
- Bond growth depends on the elf's Stewardship skill: base 1 + (stewardship / 3), clamped to 1--5 per tick.
- Curious species (Fox, Crow) can be bonded by any elf.
- Tolerant species (Deer, Songbird, Bee) require Stewardship >= 3.
- Shy species (Rabbit, Wolf) cannot be bonded.
- Only one elf can bond with a given animal -- the first to reach threshold wins.
Bond Strength
| Range | Status | Effect |
|---|---|---|
| 0--19 | Wary | Animal tolerates proximity |
| 20--59 | Familiar | Animal follows loosely |
| 60--100 | Companion | Animal 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 add flavor to inspiration but do not dominate it).
- Observation radius: 3 tiles (Manhattan distance).
Species inspiration values:
| Species | Inspiration |
|---|---|
| Wolf | 4 |
| Songbird | 4 |
| Deer | 3 |
| Fox | 3 |
| Bee | 2 |
| Crow | 2 |
| Rabbit | 1 |
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. They are present in spring and summer.
-
Level Stewardship to 3 early. Curious species (Fox, Crow) can be bonded by any elf, but most forest animals are Tolerant and require Stewardship 3+. Assign an elf to spend time near animals.
-
Predators keep the ecosystem balanced. Wolf and Fox populations limit herbivore numbers, which prevents overgrazing that would damage flora and soil. Do not try to "protect" prey: healthy predator populations mean a healthy forest.
-
Watch for herds crossing the map. A herd entity moving between regions is a population responding to carrying capacity. Herds first appear when a species' regional population exceeds 130% of its base carrying capacity.
-
Companions follow their elf. A bonded companion at strength 60+ follows its elf, providing a persistent +1 Nature inspiration within observation range.
-
Don't neglect bonds. After 5 idle days, bond strength decays. Keep bonded elves near their companions or the bond will weaken.