planetsim/docs/flora_generation_plan.md
Jonas Reith 53e371bb2f Add Biota stage: flora, fauna & funga (density + slot/point population)
World-Creation stage after biomes. Two layers (raylib-free engine):
- Per-cell density scalars (flora/fauna/funga in [0,1]) derived from the
  climate fields each tick (drive color modes 8/9/0). Flora = Liebig-min of
  temp & moisture; fauna ~ flora with carnivores gated on local prey; funga =
  moisture/organic-matter-led + cold-tolerant. Zero on water/ice.
- On-demand discrete population (key L, saved as v7): each land cell draws
  broad archetypes from a comprehensive table into a per-kind slot cap +
  density-scaled point budget (size -> cost), weighted by biome/climate
  suitability and a regional bonus for same-biome neighbours. Separate RNG
  seeded from cfg.seed so generating biota never perturbs tectonic determinism.

Organisms are labelled by taxonomy (Family + Size + role, e.g. "Felidae
(Big, Carnivore)") with the full Class > Order > Family tree stored, never an
informal common name. Cell-info panel word-wraps + aggregates duplicates so the
lists no longer get cut off.

New: src/sim/PlanetBiota.{hpp,cpp} + PlanetFlora/Fauna/FungiGen.cpp, color
modes/colors, bio* config knobs, save v7 (older saves load with empty
population), test_biota.cpp (densities, fauna<=capacity, carnivore gating,
slot/point budgets, determinism + RNG isolation, v7 round-trip). Docs updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 13:56:03 +02:00

369 lines
7.3 KiB
Markdown

Flora Generation Plan
For flora, I want the system to generate plant life based on biome, climate, terrain, water availability, and regional consistency. Like fauna, flora should not always be exact real-world species, but broader plant types that fit naturally into the environment.
1. Basic Plant Types
First, we should define basic plant categories that can appear across many environments, with variations depending on biome and climate.
For example:
Grasses
Dry grass in savannas
Marsh grass in wetlands
Alpine grass in mountains
Shrubs
Desert shrubs
Thorny shrubs
Berry bushes
Trees
Tropical trees
Conifer trees
Deciduous trees
Mangrove trees
Fungi
Forest mushrooms
Swamp fungi
Cave fungi
These should work similarly to the “basic animal types” from the fauna system. A plant type can exist in many places, but its exact form changes depending on the environment.
2. Flora Classification
Flora should be described using broad plant groups rather than exact species.
Possible classification fields:
Plant group
Growth form
Size category
Climate preference
Water requirement
Terrain preference
Ecological role
Example:
text
Plant: Desert shrub
Group: Angiosperm
Growth Form: Shrub
Size: Small
Climate: Arid / Hot
Water Requirement: Low
Terrain: Sandy / Rocky
Role: Ground cover / Food source
Another example:
text
Plant: Giant rainforest tree
Group: Angiosperm
Growth Form: Tree
Size: Huge
Climate: Tropical / Humid
Water Requirement: High
Terrain: Soil-rich lowland
Role: Canopy / Habitat
Possible growth forms:
Grass
Moss
Fern
Shrub
Bush
Tree
Vine
Reed
Cactus / succulent
Fungus
Aquatic plant
Possible size categories:
Tiny
Small
Medium
Big
Huge
3. Biome-Based Flora
Each biome should have a set of likely plant types.
Examples:
Desert
Likely flora:
Cacti / succulents
Dry shrubs
Thorn bushes
Sparse grasses
Drought-resistant flowers
Rare flora:
Oasis trees
Reeds near water
Desert fungi after rain
Forest
Likely flora:
Deciduous trees
Conifer trees
Ferns
Moss
Mushrooms
Berry bushes
Rare flora:
Ancient giant trees
Poisonous flowers
Medicinal herbs
Swamp / Wetland
Likely flora:
Reeds
Mangroves
Water lilies
Moss
Wetland grasses
Fungi
Rare flora:
Carnivorous plants
Giant swamp trees
Rare medicinal roots
Grassland / Steppe
Likely flora:
Grasses
Wildflowers
Small shrubs
Herbs
Rare flora:
Lone trees
Thorn bushes
Seasonal flowers
Mountain / Alpine
Likely flora:
Alpine grass
Lichens
Moss
Small shrubs
Hardy flowers
Rare flora:
Ancient mountain trees
Rare herbs
Snow-resistant plants
Tundra
Likely flora:
Moss
Lichens
Low shrubs
Cold-resistant grasses
Rare flora:
Seasonal flowers
Fungi
Hardy berry bushes
4. Cell Population System
Flora can also use a slot and point system, similar to fauna.
For example:
Each cell has 15 flora slots
Each cell has 30 flora points
Plants are added until either the slots or points are filled.
Suggested point cost by size:
Size Point Cost
Tiny 1
Small 2
Medium 3
Big 5
Huge 8
Flora may need more slots than fauna because plants are usually more numerous and layered.
A cell could contain:
text
Cell Flora:
- Forest floor moss, Tiny, 1 point
- Ferns, Small, 2 points
- Berry bushes, Small, 2 points
- Deciduous trees, Big, 5 points
- Ancient oak-like trees, Huge, 8 points
The system stops adding plants once either:
All flora slots are filled, or
All flora points are used
5. Flora Layers
To make flora feel more natural, each cell can have vegetation layers.
Possible layers:
Ground layer
Herb layer
Shrub layer
Understory layer
Canopy layer
Aquatic layer
Not every biome needs every layer.
Example for a forest:
text
Ground Layer: Moss, fungi
Herb Layer: Ferns, flowers
Shrub Layer: Berry bushes
Understory Layer: Young trees
Canopy Layer: Large trees
Example for a desert:
text
Ground Layer: Dry grass, small succulents
Shrub Layer: Thorn bushes
Tree Layer: Rare oasis trees
This helps prevent weird combinations, like a dense rainforest canopy appearing in a dry desert cell.
6. Climate and Terrain Rules
Flora should be strongly influenced by environmental conditions.
Important factors:
Temperature
Rainfall
Soil quality
Terrain type
Elevation
Nearby water
Sunlight
Seasonality
Examples:
High rainfall increases trees, moss, ferns, and fungi.
Low rainfall increases cacti, succulents, dry shrubs, and sparse grasses.
Cold climate increases moss, lichen, conifers, and low shrubs.
High elevation reduces large trees and favors alpine plants.
Wet terrain increases reeds, aquatic plants, mangroves, and swamp trees.
Poor soil reduces plant density.
Fertile soil increases plant diversity and size.
7. Regional Distribution
Like fauna, flora should check neighboring cells to create a more natural and homogeneous distribution.
Rules could be:
Same biome and same climate: high probability of sharing the same flora.
Same climate but different terrain: moderate probability of similar flora.
Different climate: generate new flora.
Nearby rivers, lakes, and coasts can spread wetland or aquatic plants.
Mountain ranges, deserts, and oceans can act as barriers to plant spread.
This means forests should gradually change into grasslands or swamps instead of switching completely from one cell to the next.
8. Rarity and Special Plants
The system should support common, uncommon, rare, and unique flora.
Possible rarity levels:
Common
Uncommon
Rare
Very rare
Unique
Examples:
text
Common: Grass, moss, reeds
Uncommon: Berry bushes, medicinal herbs
Rare: Carnivorous plants, glowing mushrooms
Very Rare: Ancient trees, magical flowers
Unique: World-tree fragment, legendary herb
Rarity can be affected by biome and world rules.
For example:
Carnivorous plants are rare in swamps.
Glowing mushrooms are rare in caves or dark forests.
Ancient trees are rare in old forests.
Medicinal herbs are uncommon in mountains or forests.
9. Ecological Role
Each plant type should have an ecological role. This can later connect flora to fauna, crafting, survival, or gameplay systems.
Possible roles:
Food source
Shelter
Nesting material
Medicine
Poison
Crafting material
Building material
Fuel
Soil stabilizer
Water indicator
Magical / special resource
Example:
text
Plant: Berry bush
Growth Form: Bush
Size: Small
Climate: Temperate
Water Requirement: Medium
Role: Food source for animals and humans
Example:
text
Plant: Thorn shrub
Growth Form: Shrub
Size: Small
Climate: Arid
Water Requirement: Low
Role: Shelter for small animals, natural barrier
10. Overall Goal
The goal is to create a flora system that feels natural, biome-based, and regionally consistent. Plants should be generated from broad categories, growth forms, ecological roles, and environmental requirements rather than needing to define every exact species.
The flora system should also support later gameplay features such as animal habitats, food chains, crafting materials, medicine, poison, and rare discoveries.