Skip to content

UnIvErZe is a comprehensive artificial life simulation platform that models biological evolution from first principles, implementing sophisticated genetic regulatory networks, developmental embryogeny, and multi-level selection pressures within a physics-based cellular automaton environment.

License

Notifications You must be signed in to change notification settings

Devanik21/Deep-Universe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

357 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnIvErZe: A Digital Universe for Infinite Evolution

Abstract

UnIvErZe is a comprehensive artificial life simulation platform that models biological evolution from first principles, implementing sophisticated genetic regulatory networks, developmental embryogeny, and multi-level selection pressures within a physics-based cellular automaton environment. This research tool enables the exploration of open-ended evolutionary dynamics through a configurable "God Panel" exposing over 200 tunable parameters governing universal physics, genetic mutation operators, fitness landscapes, and meta-evolutionary processes.

Unlike traditional genetic algorithms that optimize toward predetermined objectives, UnIvErZe implements truly generative evolution where novel morphologies, chemical bases, sensory modalities, and even the laws of physics themselves can emerge through stochastic innovation and selection. The system has successfully demonstrated the spontaneous emergence of complex multi-cellular organisms, colonial superorganisms, and sophisticated genetic regulatory programs across simulation runs spanning hundreds to thousands of generations.

Research Motivation

The central question driving this work is: Can we create a computational universe where life evolves forms and behaviors that surprise us?

Traditional evolutionary algorithms suffer from premature convergence to local optima and fail to generate the radical, open-ended novelty observed in biological evolution. This project implements several key innovations to overcome these limitations:

  1. Generative Development: Organisms are not hand-designed blueprints but emerge from growth programs encoded in genetic regulatory networks (GRNs)
  2. Chemical Diversity: Life is not constrained to a single "carbon" archetype but can evolve using 15+ distinct chemical bases with unique physical properties
  3. Meta-Innovation: The system can invent new sensory modalities, genetic operators, and even mutate fundamental physical constants
  4. Ecological Complexity: Multiple kingdoms co-evolve within shared resource landscapes, driving Red Queen dynamics and niche specialization

After hundreds of generations across multiple experimental runs, the system has successfully generated organisms exhibiting:

  • Complex segmented body plans with specialized tissue types
  • Emergent oscillatory growth patterns and developmental timers
  • Intercellular communication networks enabling morphogenesis
  • Colonial aggregation and division of labor
  • Autotelic fitness objectives that diverge from universal defaults

Theoretical Framework

Genetic Regulatory Networks as Turing-Complete Programs

The genotype in UnIvErZe is not a fixed blueprint but a computational program specifying context-dependent developmental rules. Each organism's genome consists of:

  1. Component Genes: A chemical alphabet defining the cellular building blocks available (analogous to proteins in biology)
  2. Rule Genes: Conditional logic statements forming the GRN, with structure IF [environmental/internal conditions] THEN [developmental action]

This architecture enables Turing-complete computation during ontogeny, supporting:

  • Temporal Logic: Internal timers allow cells to execute sequential developmental programs
  • Genetic Cascades: Rules can enable/disable other rules, creating hierarchical control networks
  • Morphogenetic Signaling: Cells emit and sense chemical signals, enabling reaction-diffusion pattern formation

Multi-Scale Fitness Landscapes

Fitness evaluation occurs across three nested scales:

  1. Individual Fitness: Energy acquisition efficiency, structural integrity, and longevity during a simulated lifetime
  2. Group Selection: Optional multi-level selection where colonies compete based on aggregate performance and specialization
  3. Meta-Objectives: When autotelic evolution is enabled, organisms can evolve their own fitness functions, creating diverse "philosophies of life"

The Innovation Engine: Toward Infinite Diversity

The system implements three levels of generative innovation:

Level 1: Parametric Mutation

  • Continuous mutation of rule thresholds, probabilities, and action parameters
  • Enables hill-climbing optimization within existing genetic architectures

Level 2: Structural Innovation

  • Addition/deletion of GRN rules (altering program logic)
  • Invention of new component genes from chemical base templates
  • Gene duplication and horizontal transfer via endosymbiosis

Level 3: Meta-Innovation ("Truly Infinite")

  • Invention of new sensory modalities (e.g., sense_neighbor_complexity)
  • Co-evolution of physical constants (via "physics drift")
  • Modification of developmental rules affecting growth mechanics

This three-tier architecture prevents evolutionary stagnation by continuously expanding the search space rather than merely optimizing within it.

System Architecture

Core Components

1. Environmental Simulation (UniverseGrid)

  • 2D cellular automaton with configurable dimensions (50-500 cells)
  • Spatially distributed resources: light, minerals, water, temperature
  • Procedural generation using multi-octave Perlin noise
  • Dynamic resource diffusion and decay

2. Developmental Embryogeny (Phenotype)

  • Growth from single zygote cell via iterative GRN evaluation
  • Configurable development duration (10-200 timesteps)
  • Cell differentiation, division, and programmed death
  • Energy metabolism and structural integrity constraints

3. Genetic Encoding (Genotype)

  • Variable-length genome supporting 0-100+ rules and components
  • Explicit representation of chemical base (Carbon, Silicon, Plasma, etc.)
  • Evolvable hyperparameters (mutation rate, innovation rate)
  • Optional autotelic objective weights

4. Evolutionary Operators

  • Tournament selection with configurable pressure (0.1-0.9)
  • Mutation with dynamic rate modulation (cataclysm-induced hypermutation)
  • Optional crossover and horizontal gene transfer
  • Fossil record archive for phylogenetic analysis

5. Analytics & Visualization

  • Real-time 3D fitness landscape rendering
  • Multi-panel evolutionary dashboard with 9 synchronized metrics
  • Genesis Chronicle: Automatic detection and logging of 7 classes of evolutionary events
  • Elite lineage viewer with 16 distinct GRN visualization algorithms
  • Custom analytics laboratory supporting 12 statistical plot types

Technical Implementation

Technology Stack

  • Core Framework: Python 3.8+ with Streamlit for interactive UI
  • Scientific Computing: NumPy, SciPy (entropy, clustering, optimization)
  • Network Analysis: NetworkX (phylogenetic trees, GRN topology)
  • Visualization: Plotly (interactive 3D plots), Matplotlib (network graphs)
  • Data Persistence: TinyDB (JSON-based document store)

Performance Characteristics

  • Simulates 50-200 organisms per generation
  • Typical runtime: 1-5 seconds per generation (50-cell organisms, 50 development steps)
  • Scales to 1000+ generations without memory overflow
  • Checkpoint system enables pause/resume of multi-hour experiments

Experimental Design Guidelines

Quickstart: Your First Universe

For first-time users, the recommended approach is:

  1. Accept Default Settings: The system ships with balanced parameters suitable for initial exploration
  2. Run for 200 Generations: Sufficient to observe initial adaptation and speciation
  3. Examine the Dashboard: Focus on the "Kingdom Dominance" chart to assess diversity
  4. Inspect Elite Organisms: Use the Specimen Viewer to see evolved body plans
  5. Read the Genesis Chronicle: Review key evolutionary events and innovations

Combating Convergence: Forcing Novelty

The primary challenge in artificial life research is premature convergence to simple, "good enough" solutions. To achieve complex, surprising organisms:

Critical Parameter Adjustments

  • Complexity Pressure (w_complexity_pressure): Increase from 0.0 to 0.2-0.3 to directly reward genomic and morphological complexity
  • Development Steps (development_steps): Increase from 50 to 100-150 to allow complex embryogenies sufficient time to complete
  • Component Innovation Rate (component_innovation_rate): Increase from 0.01 to 0.03-0.05 to accelerate invention of new building blocks

Enabling Diversity-Preserving Mechanisms

  • Red Queen Co-evolution (enable_red_queen): Forces an evolutionary arms race by introducing a parasite that targets dominant forms
  • Cataclysms (enable_cataclysms): Periodic mass extinctions clear ecological niches, enabling adaptive radiation
  • Speciation (enable_speciation): Protects nascent innovations from competition with optimized incumbents

Advanced: Meta-Evolution

  • Physics Drift (enable_physics_drift): Allows fundamental chemical properties to slowly mutate over eons
  • Autotelic Objectives (enable_objective_evolution): Permits organisms to evolve their own fitness goals
  • Hyperparameter Evolution (enable_hyperparameter_evolution): Enables mutation rates themselves to adapt

Experimental Protocols

Protocol 1: Baseline Evolutionary Dynamics

  • Purpose: Characterize basic system behavior
  • Settings: All defaults, 500 generations
  • Metrics: Mean fitness trajectory, kingdom succession events, final complexity distribution

Protocol 2: Complexity Emergence Under Pressure

  • Purpose: Test capacity for open-ended innovation
  • Settings: w_complexity_pressure=0.3, development_steps=150, component_innovation_rate=0.05
  • Observe: Segmentation emergence, specialized tissue types, GRN sophistication

Protocol 3: Red Queen Dynamics

  • Purpose: Study host-parasite co-evolution
  • Settings: enable_red_queen=True, red_queen_virulence=0.2, 1000 generations
  • Metrics: Cycling dominance patterns, innovation rate correlation with virulence

Protocol 4: Multi-Level Selection

  • Purpose: Investigate major evolutionary transitions
  • Settings: enable_multi_level_selection=True, colony_size=15, group_fitness_weight=0.4
  • Observe: Colonial emergence events, caste specialization, altruistic component evolution

Results: Emergent Phenomena

Across extensive experimental runs, the following phenomena have been consistently observed:

1. Morphological Complexity Cascades

When complexity pressure is enabled, populations transition through discrete phases:

  • Generation 0-100: Simple 5-15 cell "blob" organisms with minimal differentiation
  • Generation 100-300: Emergence of segmentation, bilateral symmetry, and specialized organ-like structures
  • Generation 300-500+: Highly complex organisms with 50-100+ cells, hierarchical tissue organization, and sophisticated developmental programs

2. The Cambrian Explosion Pattern

Red Queen dynamics reliably trigger rapid diversification events reminiscent of the biological Cambrian explosion:

  • Initial dominance by a single kingdom (e.g., 90% Carbon-based life)
  • Parasite adaptation targeting the dominant form
  • Sudden collapse of dominant lineage and rapid radiation of minority kingdoms
  • Stabilization into a diverse multi-kingdom ecosystem (40% Carbon, 30% Silicon, 20% Plasma, 10% other)

3. Genetic Programming Sophistication

Advanced GRNs evolve hierarchical control architectures:

  • Genetic Switches: Rules that enable/disable other rules, creating developmental stages
  • Oscillators: Timer-based pulsed growth producing segmented body plans
  • Morphogenetic Fields: Signal-based pattern formation creating layered structures (core, mantle, shell)
  • Homeostatic Circuits: Feedback loops maintaining energy balance and structural integrity

4. Autotelic Divergence

When objective evolution is enabled, lineages diverge into distinct "philosophies":

  • Efficiency Maximizers: Evolve to prioritize w_efficiency, producing small, metabolically efficient forms
  • Complexity Seekers: Shift weight to w_complexity_pressure, generating baroque, ornamental structures with no survival advantage
  • Reproductive Strategists: Emphasize w_reproduction, creating fast-growing, short-lived r-selected organisms

5. Meta-Innovation Events

The system has demonstrated spontaneous invention of:

  • 15+ novel sensory modalities (e.g., sense_energy_gradient_N, sense_neighbor_type_diversity)
  • 30+ hybrid chemical bases (e.g., Psionic-Carbon-Core, Quantum-Metallic-Lattice)
  • Emergent genetic operators (timer-based sequential logic, signal-based communication)

Technical Deep Dive: Key Algorithms

Fitness Evaluation Algorithm

def evaluate_fitness(genotype, grid, settings):
    # 1. Developmental Phase: Grow organism from zygote
    organism = Phenotype(genotype, grid, settings)
    if not organism.is_alive:
        return 0.0
    
    # 2. Lifetime Simulation: Run metabolism for N ticks
    for tick in range(settings['max_organism_lifespan']):
        organism.run_timestep()
        if not organism.is_alive:
            break
    
    # 3. Multi-Objective Fitness Calculation
    energy_efficiency = organism.total_energy_production / (organism.total_energy_consumption + 1e-6)
    lifespan_score = organism.lifespan / settings['max_organism_lifespan']
    reproduction_bonus = organism.total_energy / settings['reproduction_energy_threshold']
    complexity_score = genotype.compute_complexity() * settings['w_complexity_pressure']
    
    # 4. Weighted Aggregation
    fitness = (
        lifespan_score * settings['w_lifespan'] +
        energy_efficiency * settings['w_efficiency'] +
        reproduction_bonus * settings['w_reproduction'] +
        complexity_score
    )
    
    return max(1e-6, fitness)

Developmental Embryogeny Algorithm

def develop(self):
    for step in range(max_development_steps):
        # 1. Signal Diffusion: Calculate morphogen gradients
        signal_snapshot = {}
        for (x,y), cell in self.cells.items():
            signal_snapshot[(x,y)] = cell.state_vector.get('signals_out', {})
        
        for (x,y), cell in self.cells.items():
            neighbors = self.grid.get_neighbors(x, y)
            incoming_signals = {}
            for neighbor in neighbors:
                if (neighbor.x, neighbor.y) in signal_snapshot:
                    for signal_name, value in signal_snapshot[(neighbor.x, neighbor.y)].items():
                        incoming_signals.setdefault(signal_name, []).append(value)
            cell.state_vector['signals_in'] = {k: np.mean(v) for k,v in incoming_signals.items()}
        
        # 2. GRN Evaluation: Test all rules against all cells
        actions_to_execute = []
        for (x,y), cell in self.cells.items():
            context = build_context(cell, self.grid.get_cell(x,y), neighbors)
            for rule in self.genotype.rule_genes:
                if check_conditions(rule, context, cell):
                    actions_to_execute.append((rule, cell))
        
        # 3. Action Execution: Grow, differentiate, signal, etc.
        actions_to_execute.sort(key=lambda x: x[0].priority, reverse=True)
        for rule, cell in actions_to_execute:
            execute_action(rule, cell, new_cells)
        
        # 4. Timer Updates: Decrement internal clocks
        for cell in self.cells.values():
            if 'timers' in cell.state_vector:
                for timer_name in list(cell.state_vector['timers'].keys()):
                    cell.state_vector['timers'][timer_name] -= 1

Component Innovation Algorithm

def innovate_component(genotype, settings):
    # 1. Select Chemical Base from Registry
    allowed_bases = settings['chemical_bases']
    base_name = random.choice(allowed_bases)
    base_template = CHEMICAL_BASES_REGISTRY[base_name]
    
    # 2. Generate Unique Name
    prefix = random.choice(['Proto', 'Hyper', 'Neuro', 'Xeno', 'Meta', 'Quantum'])
    suffix = random.choice(['Polymer', 'Matrix', 'Core', 'Processor', 'Lattice'])
    new_name = f"{prefix}-{base_name}-{suffix}_{random.randint(0,999)}"
    
    # 3. Sample Properties from Base Template
    new_component = ComponentGene(name=new_name, base_kingdom=base_name)
    new_component.mass = random.uniform(*base_template['mass_range'])
    new_component.structural = random.uniform(0.1, 0.5) * base_template['structural_mult'][0]
    
    # 4. Bias Specialized Functions by Chemical Base
    for prop in ['photosynthesis', 'chemosynthesis', 'compute', 'armor']:
        bias = base_template.get(f"{prop}_bias", 0.0)
        if random.random() < abs(bias) + 0.05:
            value = np.clip(random.uniform(0.5, 1.5) + bias, 0, 5.0)
            setattr(new_component, prop, value)
    
    return new_component

Genesis Chronicle: Automated Event Detection

The system implements a sophisticated event logging system that automatically detects and records seven classes of evolutionary milestones:

  1. Genesis Events: First emergence of each chemical kingdom (e.g., "Genesis of Silicon Life")
  2. Succession Events: Major ecological shifts where one kingdom displaces another
  3. Complexity Leaps: Organisms crossing thresholds of 10, 25, 50, 100, 200, 500 genomic complexity units
  4. Component Innovations: Invention of novel cellular building blocks
  5. Sense Innovations: Evolution of new sensory modalities (meta-innovation)
  6. Major Transitions: Emergence of multicellularity, colonial life, intercellular communication
  7. Cognitive Leaps: Development of internal timers (memory), genetic switches (computation), autotelic objectives (philosophy)

Each event is logged with:

  • Generation timestamp
  • Detailed natural language description
  • Causal lineage information (which dynasty invented what)
  • Thematic icon for visual scanning

This automated historiography enables post-hoc analysis of evolutionary trajectories and identifies the specific mechanisms driving complexity increase.

Visualization System: 16 Perspectives on Genetic Architecture

The Specimen Viewer implements 16 distinct graph layout algorithms to visualize genetic regulatory networks, each revealing different structural properties:

Force-Directed Layouts (Physics-Based)

  1. Spring Layout: Standard force simulation revealing natural clustering
  2. Kamada-Kawai: Path-distance proportional layout emphasizing symmetry
  3. Tight Spring (k=0.1): High repulsion exposing dense core structures
  4. Loose Spring (k=2.0): Low repulsion untangling long-range connections
  5. Settled Spring (200 iterations): Fully converged, stable configuration
  6. NEATO: Graphviz force model providing alternative optimization

Geometric Layouts (Pattern Discovery)

  1. Circular: All nodes on circle, revealing cross-cutting edges
  2. Random: Null hypothesis control showing unstructured baseline
  3. Shell: Concentric circles for rank visualization
  4. Spiral: Sequential chain detection
  5. Planar: Tests mathematical planarity (no edge crossings)
  6. Dual-Shell: Custom logic separating genes from rules

Hierarchical Layouts (Control Flow)

  1. Graphviz DOT: Top-down flowchart exposing master regulators
  2. Graphviz TWOPI: Radial hierarchy showing influence propagation
  3. Graphviz NEATO: Alternative force-based layout

Variation Testing

  1. Spring (Alternate Seed): Tests configuration stability via different initial conditions

This multi-perspective approach addresses the fundamental challenge of graph visualization: no single layout is optimal for all graph topologies. By providing 16 views, researchers can identify the most informative representation for each specific GRN.

Installation & Usage

Prerequisites

Python 3.8+
pip install streamlit numpy pandas scipy networkx plotly tinydb

Quick Start

# Clone repository
git clone https://github.com/devanik/univErze.git
cd univErze

# Launch application
streamlit run UnIvErZe.py

# Navigate to localhost:8501 in browser

First Experiment

  1. Sidebar Configuration: All parameters are exposed in the left sidebar under collapsible sections
  2. Ignite Big Bang: Click the red "🚀 IGNITE BIG BANG" button to begin simulation
  3. Monitor Progress: Live metrics display mean fitness, diversity, and mutation rate
  4. View Results: Navigate tabs for Dashboard (macro trends), Specimen Viewer (phenotypes), Elite Analysis (genomes), Genesis Chronicle (event log)
  5. Download Checkpoint: Click "📥 Download All Results as .zip" to save complete universe state

Continuing Experiments

The system supports pause/resume workflow:

  1. Run initial simulation (e.g., 200 generations)
  2. Download checkpoint file
  3. Close application
  4. Later: Upload checkpoint via sidebar
  5. Click "🧬 CONTINUE EVOLUTION" to extend simulation from saved state

Checkpoints preserve:

  • Complete population genotypes
  • Fossil record archive (up to 100,000 specimens)
  • All historical metrics and event logs
  • Current physics constants and evolved senses
  • Grid resource state

Known Limitations & Future Work

Current Limitations

  1. Spatial Constraints: Fixed 2D grid topology prevents evolution of truly 3D morphologies
  2. Physics Simplification: Energy metabolism uses linear approximation rather than thermodynamically accurate chemical kinetics
  3. Scalability: Single-threaded Python implementation limits population sizes to ~200 organisms
  4. Determinism: Random seed control does not guarantee reproducibility across Python versions due to floating-point variance
  5. Analysis Depth: Phylogenetic reconstruction is approximate; true cladistic analysis requires explicit parentage tracking

Planned Enhancements

Near-Term (Next Release)

  • GPU acceleration for fitness evaluation using PyTorch or JAX
  • 3D rendering engine for volumetric morphologies
  • Neural network-based fitness predictors to reduce computational cost
  • Interactive GRN editor for hypothesis testing

Long-Term Research Directions

  • Self-modifying code evolution (organisms that can rewrite their own developmental interpreter)
  • Multi-scale physics (molecular, cellular, organismal, ecological)
  • Embodied cognition via reinforcement learning controllers
  • Open-ended social evolution (cooperation, communication, cultural transmission)
  • Integration with large language models for natural language genome description

Reproducibility & Open Science

All experimental results are fully reproducible given:

  1. Specific Python version (tested on 3.8.10, 3.9.7, 3.10.4)
  2. Fixed random seed (set via sidebar parameter)
  3. Exact parameter configuration (exported in checkpoint file)

To reproduce published results:

  1. Download checkpoint file from repository /results directory
  2. Load checkpoint via sidebar interface
  3. Verify settings match publication
  4. Run simulation with matching generation count

The system automatically logs all parameter changes to enable audit trails.

Credits & Acknowledgments

Primary Developer: Devanik (GitHub)

AI Collaboration: This system was developed through an iterative human-AI partnership with Gemini AI (Google DeepMind), which contributed:

  • Architectural design decisions based on academic literature
  • Implementation of advanced algorithms (spectral GRN layout, Red Queen dynamics)
  • Documentation and scientific framing
  • Debugging and optimization strategies

Theoretical Foundations:

  • Genetic Regulatory Networks: Artificial Embryogeny literature (Stanley & Miikkulainen, Eggenberger, Bongard)
  • Multi-Level Selection: Price Equation framework (Hamilton, Wilson, Sober)
  • Open-Ended Evolution: Novelty Search (Lehman & Stanley), MAP-Elites (Mouret & Clune)
  • Artificial Life: Tierra (Ray), Avida (Ofria et al.), Geb (Channon)

Citation

If you use UnIvErZe in academic research, please cite:

@software{univErze2025,
  author = {Devanik and {Gemini AI}},
  title = {UnIvErZe: A Digital Petri Dish for Infinite Evolution},
  year = {2024},
  url = {https://github.com/devanik/univErze},
  note = {Open-source artificial life simulation implementing genetic regulatory networks, developmental embryogeny, and meta-evolutionary dynamics}
}

License

This project is released under the MIT License. See LICENSE file for details.


Project Status: Active Development | Last Updated: November 2025

For questions, bug reports, or collaboration inquiries, please open an issue on GitHub or contact the author directly.

About

UnIvErZe is a comprehensive artificial life simulation platform that models biological evolution from first principles, implementing sophisticated genetic regulatory networks, developmental embryogeny, and multi-level selection pressures within a physics-based cellular automaton environment.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages