Skip to main content

Overview

Hyperscape’s terrain generation uses a biome system with biome-specific parameters for height variation, vegetation density, and resource distribution. Each biome has unique visual characteristics and gameplay properties.
Added in commits 82a5365, 2751b269, dd8d6ad, and 6295345 (March 12, 2026).

Biome Types

Biome Characteristics


Tree Configuration

Each biome defines its own tree distribution, placement rules, and density.

BiomeTreeConfig

Forest Biome Trees

Canyon Biome Trees

Tundra Biome Trees


Tree Placement Rules

Height Constraints

Trees can specify minimum and maximum terrain heights:
Use Cases:
  • Mountain trees (high minHeight)
  • Valley trees (low maxHeight)
  • Coastal trees (near water level)

Water Affinity

Trees can prefer or avoid water proximity:
Use Cases:
  • Palm trees (high water affinity)
  • Coconut trees (very high water affinity)
  • Desert trees (avoid water)

Water Avoidance

Trees can avoid spawning below water level:
Use Cases:
  • Cacti (avoid wet areas)
  • Desert vegetation (avoid flooding)

Slope Rejection

Trees are rejected on steep terrain slopes (added in commit dd8d6ad):
Implementation:
  • Estimates terrain gradient using central differences (±1m samples)
  • Calculates slope magnitude from gradient vector
  • Skips placement when slope exceeds threshold
Biome-Specific Thresholds:
  • Forest: 1.5 (moderate slopes)
  • Canyon: 2.0 (steeper slopes allowed)
  • Tundra: 1.5 (moderate slopes)
Impact: Prevents trees floating on cliff faces, more realistic placement.

TreeId Enum

Type-safe tree identifiers replace hardcoded strings (added in commit 2751b269):

Migration


Getting Biome Config


BiomeResourceGenerator

The BiomeResourceGenerator class handles biome-aware resource placement:

Worker Integration

Biome constants are injected into web workers for consistent terrain generation:

Future Enhancements

Biome Blending

Smooth transitions between biomes with gradient blending

Dynamic Biomes

Weather and seasonal biome variations

Custom Biomes

User-defined biomes with custom tree configs

Biome-Specific Mobs

Spawn different mobs based on biome type

Terrain LOD

Hierarchical quadtree LOD for infinite terrain

Tree Instancing

Multi-variant tree rendering with BatchedMesh

Resource System

Resource spawning and gathering mechanics

World Generation

Procedural world generation pipeline