Lenia

Lenia - Real-Time GPU-Accelerated Artificial Life Simulator

C++20 OpenGL Platform Release

A high-performance, real-time implementation of Lenia, a continuous cellular automaton system that produces life-like emergent behaviors. This project leverages GPU compute shaders for massively parallel simulation, enabling smooth interactive exploration of complex artificial life patterns.

Features

Core Simulation

Multichannel System

Visualization

Analysis & Monitoring

User Interface

Requirements

Build Requirements

Runtime Requirements

Building

Quick Build

.\build_windows.bat

Build Options

.\build_windows.bat --clean      # Clean rebuild
.\build_windows.bat --no-pause   # No pause at end (for scripts)
.\build_windows.bat --help       # Show options

The build script automatically:

Manual Build

If you prefer using Make directly:

mingw32-make -j8

Usage

Controls

| Key | Action | |—–|——–| | Space | Pause/Resume simulation | | S | Single step (hold for continuous stepping) | | Shift+S | Fast continuous stepping | | R | Reset with current preset | | C | Clear grid | | Arrow Keys | Pan view | | Scroll | Zoom in/out | | Middle Mouse | Pan view (drag) | | F | Fit view to grid |

Getting Started

  1. Launch bin/lenia.exe
  2. Browse presets in the Presets section
  3. Select a category (e.g., “Multichannel”) and choose a species
  4. Press Space to start the simulation
  5. Adjust parameters in real-time using the UI panels

Architecture

GPU-Accelerated Pipeline

Input → Kernel Generation → Convolution (Compute Shader) → Growth Function → State Update → Render

Key Components

| Component | Description | |———–|————-| | LeniaEngine | Core simulation controller | | SimulationState | Double-buffered texture management | | KernelManager | Kernel generation and caching | | Renderer | Display and colormap application | | AnalysisManager | Pattern tracking and statistics | | UIOverlay | Dear ImGui interface |

Performance

Project Structure

Lenia/
├── src/                   # C++ source files
│   ├── Main.cpp           # Entry point
│   ├── Application.*      # Main loop and coordination
│   ├── LeniaEngine.*      # Simulation engine
│   ├── KernelManager.*    # Kernel texture generation
│   ├── Renderer.*         # Display rendering
│   ├── UIOverlay.*        # ImGui interface
│   ├── AnalysisManager.*  # Pattern analysis
│   └── Presets.*          # Species database
├── assets/
│   ├── shaders/           # GLSL compute and fragment shaders
│   └── init/              # Initialization patterns
├── colormap/              # Custom colormap files
└── libs/                  # Pre-built libraries

Technical Details

Simulation Parameters

| Parameter | Range | Description | |———–|——-|————-| | R (Radius) | 1-50 | Kernel radius in cells | | μ (mu) | 0.0-1.0 | Growth function center | | σ (sigma) | 0.001-0.3 | Growth function width | | dt | 0.01-1.0 | Time step per update |

Supported Grid Sizes

Credits

Lenia Research

Libraries