Waverse - Infinite Genetic World Generator

python 3d procedural generation evolution

An infinite procedural world where terrain, plants, creatures, and structures are all generated from DNA-like structures that mutate and crossover as you explore. Built from stacked wave functions, Waverse creates landscapes that evolve continuously through genetic algorithms.

The source code can be found on GitHub.

A DNA-Driven World Generation

Waverse generates terrain by stacking sine waves, perlin noise, and other wave functions on top of each other - like a Fourier transform for landscapes. But what makes it unique is that everything has DNA that evolves as you explore.

How Genetic Evolution Works

Each chunk of the world contains pools of DNA templates for:

  • Terrain colors - Ground hues, rock tints, water colors
  • Flora DNA - Plant shapes, sizes, colors, growth patterns
  • Fauna DNA - Animal body types, behaviors, movement patterns
  • Sky DNA - Sun size, moon glow, star density, atmospheric tints

When a new chunk generates:

  1. It examines DNA from neighboring chunks
  2. Selects parent DNA templates from those neighbors
  3. Creates offspring through crossover (blending traits) and mutation (random changes)
  4. Uses the evolved DNA to generate the new chunk's content

This means if you walk in one direction, you'll see gradual shifts in everything - the forest slowly changes character, creatures morph in form, even the sun and sky evolve over long distances.

Flora DNA System

The plant generation system uses genetic algorithms to create 15 different plant types: grass, flowers, ferns, bushes, trees, pines, palms, willows, cacti, mushrooms, coral, crystals, and alien forms.

Flora Evolution Tests

Each plant has DNA genes controlling:

  • Growth patterns - Trunk curve, twist, taper ratios
  • Branching structure - Multi-segment trunks, branch angles, canopy shapes
  • Color genetics - Hue shifts, saturation, brightness variations
  • Size variance - From tiny grass to massive trees
  • Morphological features - Leaf shapes, bark textures, flowering patterns

The flora test system runs evolution experiments where populations of plants grow from different corners of a grid and merge through genetic crossover, creating hybrid species with blended characteristics.

Evolution Visualization

The evolution system can be observed in real-time through specialized test modes that show how genetic populations interact and evolve.

Continuous Evolution Mode

In continuous evolution mode, plants have lifespans of approximately 15 generations before dying off, ensuring the ecosystem constantly evolves. This prevents genetic stagnation and creates dynamic, ever-changing environments.

Terrain Generation Through Wave Functions

The terrain system stacks multiple wave functions to create complex, realistic landscapes:

  • Continental-scale variation with lower frequency base waves
  • Sin, cosine, perlin, and ridged noise layered for detail
  • Continuous infinite world via chunk-based generation
  • Background worker threads pre-generate chunks ahead of exploration
  • Genetic terrain colors that evolve per-chunk through DNA

Fauna DNA System

Animal life follows similar genetic principles with 10 creature types: insects, birds, fish, mammals, reptiles, amphibians, jellyfish, worms, metroids, and alien creatures.

Each animal has DNA controlling:

  • Body structure - Size variance from small critters to large beasts
  • Articulated anatomy - Body segments, limbs, joint configurations
  • Behavioral patterns - Wander, graze, flock, swarm, flee responses
  • Movement characteristics - Speed, agility, territorial ranges

Sky DNA Evolution

Even the sky evolves through genetic algorithms:

  • Sun and moon sizes/colors evolve across chunks
  • Star count and brightness shift gradually over distance
  • Sky tints and atmospheric colors change over long journeys
  • Day/night cycle variations with shifting orbital paths

Exploration and Discovery

The infinite world encourages exploration through genetic diversity. Walk far enough in any direction and you'll discover:

  • New biome transitions as terrain DNA evolves
  • Unique flora combinations from genetic crossover
  • Novel creature behaviors emerging from DNA mutations
  • Atmospheric changes as sky genetics shift over distance

Dev Videos

DNA Deformation System

The flora system uses vertex shaders with DNA parameters for real-time plant deformation:

  • Trunk curve, twist, and taper controlled by genetic values
  • Branch positioning and angles determined by DNA sequences
  • Color variations driven by genetic color genes
  • Growth patterns following DNA-encoded instructions

Chunk-Based Evolution

  • Background worker threads generate chunks with evolved DNA
  • Neighboring chunk analysis for genetic parent selection
  • Crossover algorithms blend DNA traits from multiple parents
  • Mutation rates vary by DNA type (e.g. terrain: 15%, sky: 5%)

Future Evolution

The Waverse project continues to evolve, with ongoing development in:

  • Advanced creature AI with genetic behavioral patterns
  • Weather systems controlled by atmospheric DNA
  • Seasonal changes driven by temporal genetic cycles

Installation

pip install -r requirements.txt
WAVERSE_STATIC_FLORA=1 python main.py # only evolve flora when we generate new chunks

To run evolution experiments:

python -m waverse.dna_flora_test --evolve --continuous


Projects

Site

Games

Tags