Cellular Life
This simulator implements a complete ecosystem on the GPU where cellular organisms compete for resources (organics and energy) distributed across a soil substrate. Organisms are guided by genetic programs encoded in 32-gene genomes, enabling complex behaviors like growth, migration, energy trading, and reproduction.
The entire simulation runs on the GPU via compute shaders, with only minimal CPU orchestration for UI, parameter adjustment, and async readback of statistics.
World Structure
Environment & Resources
The world is a continuous 2D grid containing two primary resources:
- Soil Organics — Available through roots, decays through diffusion, represents plant matter and nutrients
- Soil Energy — Available through antenna structures, produced by leaf photosynthesis, gradually diffuses across the landscape
- Sunlight — Global parameter that boosts leaf production efficiency
Simulation Cycle
Each frame executes 12 sequential substeps:
- Energy Diffusion — Soil energy disperses across the grid (9-point averaging kernel)
- Leaf Production — Leaf cells convert available organics into cellular energy (photosynthesis-like process)
- Root Absorption — Root cells extract organics from soil and convert to energy; convert to wood if starving
- Antenna Absorption — Antenna cells extract energy from soil; convert to wood if source depleted
- Energy Rerouting — Cells establish energy transport channels with neighbors based on availability
- Energy Transport — Energy flows between connected cells along established channels
- Life Maintenance — All cells consume energy to stay alive
- Death Check — Cells die if energy depleted or local conditions become unfavorable
- Cell Death Processing — Dead cells spill resources back into soil; cleanup connections
- Seed Movement — Seed cells migrate if unattached; convert to sprouts upon maturation
- Decision Making — Sprout cells read their genome and select an action
- Action Execution — Execute the selected behavior (grow, move, eat, separate, etc.)
Cell Types & Behaviors
Cell Type Hierarchy
Each cell has a fundamental type that determines its role in the organism:
- Leaf — Primary energy producer; absorbs light energy from abundant organics
- Root — Resource harvester; extracts organics from soil substrate
- Antenna — Energy collector; extracts soil energy for distribution
- Wood — Structural support and energy conduit; inert but efficient at transport
- Sprout — Active growth node; interprets genome and executes behaviors
- Seed — Mobile reproduction unit; migrates before developing into sprout
- Empty — No cell present; available for growth
Genetic System
Genome Structure
Each organism carries a 32-gene genome. Each gene encodes:
- Growth directions — Which cell types to spawn in each relative direction
- Conditions — Two environmental checks (resource abundance, obstacles, neighbor comparison, randomness)
- Parameters — Thresholds and comparison values for conditions
- Commands — Action to execute if conditions succeed (with fallback if they fail)
- Gene transitions — Which gene becomes active next based on success/failure
Available Gene Conditions
- Organic vs. Energy — Check if soil has more organics than energy
- Obstacle detection — Test for neighbors blocking growth/move
- Resource comparison — Compare resource levels in neighboring cells
- Abundance checks — Local or regional resource availability
- Randomness — Probabilistic branching
Available Commands
Commands allow organisms to:
- Grow — Spawn new cells in specified directions
- Move — Relocate in the cell direction (single cells)
- Rotate — Reorient the cell direction (single cells)
- Extract — Harvest organics or energy from soil
- Trade — Exchange resources with neighboring cells
- Reproduce — Create seeds for dispersal
- Consume — Eat nearby cells for quick energy
- Separate — Break connections
- Adapt — Transform into a seed to wait for better environment conditions
- Attach — Attach to nearby organism to receive energy from it
Evolution & Mutation
Reproduction Strategy
When an organism creates an offspring (seed or sprout):
- Inherit the parent's genome or create a mutated copy (25% chance)
- Placement of offspring depends on available space and genetic program
- Initialization with modest energy; must survive on its own
Mutation Mechanism
When mutations occur, a random gene is selected and one of its properties is randomly modified:
- Growth direction types shift
- Condition thresholds adjust
- Command sequences change
- Gene transitions rewrite
- Behavioral parameters drift
The combination of finite energy, spatial constraints, and random mutations drives continuous adaptation. Successful strategies persist; failed experiments die and are recycled into the soil.
Getting Started
Requirements
- GPU supporting Compute Shaders (most modern GPUs)
- HLSL/Compute Shader support in your graphics backend
Running the Simulation
- Use Space to pause/resume
- Use [1-4] to switch visualization modes
- Use [R] to restart with a fresh world
- Use brush tools to interact with the environment
Customization
- Adjust sunlight intensity to change energy availability
- Modify cell constants (growth cost, maintenance, diffusion rate) to tune difficulty
- Adjust brush properties to control interaction magnitude
Source code with implementation details can be found here.
| Published | 1 day ago |
| Status | Released |
| Platforms | HTML5 |
| Rating | Rated 5.0 out of 5 stars (1 total ratings) |
| Author | meownsk |
| Genre | Simulation |
| Made with | Unity |
| Tags | Idle, Pixel Art |
| Content | No generative AI was used |




Leave a comment
Log in with itch.io to leave a comment.