- Python 100%
Bio-Spatial Engine: Flow Lenia #
A high-performance Universe Construction Kit implementing an Ecological Actor Model on a continuous Latent Field. This engine moves beyond standard Cellular Automata by treating activations as a mass-conserving informational fluid.
🚀 Vision: Informational Fluids #
Standard Lenia architectures often suffer from "heat death" or "explosion" due to the lack of conservation laws. Flow Lenia solves this by treating cellular activations as a physical fluid via Reintegration Tracking (RT).
By embedding parameters (DNA) directly into the mass, we enable a self-organizing ecosystem where "creatures" are stable, competing, and evolving informational entities.
🧠 Core Architecture #
1. The Substrate (Latent Field) #
Space is the only global state. Everything—density, probability, and energy—is stored in flat, C-contiguous float32 tensors.
2. The Ecosystem (Actor Pipeline) #
The universe evolves through a sequential pipeline of Actors:
- Layer 1: Base (Entropy) – Manages thermal death and information fading.
- Layer 2: Energy (Injection) – External perturbations (user input, stochastic noise).
- Layer 3: Existence (Assertion) – Morphogenesis via localized Lenia kernels.
3. Mass Conservation & Advection #
- Reintegration Tracking: Ensures $\sum A$ remains constant across millions of timesteps.
- Parameter Localization: The "DNA" of a creature moves with its mass, allowing for multi-species interaction and competitive inheritance.
- Softmax Sampling: A winner-take-most mechanism that prevents "Grey Mush" and maintains biodiversity.
🛠️ Implementation Standards #
- Zero Allocation: The core loop is optimized for performance, using pre-allocated double buffering.
- Vectorized Logic: Built on NumPy/SciPy for dimensional-agnostic processing.
- WGPU Enhanced: Rendering is handled by a high-performance WGPU-accelerated viewport.
📦 Installation #
Ensure you have Python 3.10+ and install the dependencies:
pip install -r requirements.txt
🎮 Usage #
Run the primary simulation:
python -m main
Controls #
- Runtime Tuner: Use the sidebar to adjust ecosystem parameters (mu, sigma, rho) in real-time.
- Interaction: UI-driven perturbations to inject energy or seed new species.
📖 Technical Specification #
For a deep dive into the mathematical foundation, Reintegration Tracking, and the Softmax Sampling Rule, see Flow Lenia.md.
Developed as part of the Advanced Agentic Coding initiative.