FFT-accelerated continuous cellular automaton studio implementing Lenia with configurable kernel and growth function families, multi-shell convolution, and full 2D, 3D, and 4D support. Includes a curated organism catalogueue with taxonomic classification and tools for exploring the parameter space of smooth life-like dynamics.
- p5.js 2.2.3
- Web Worker (FFT convolution, kernel construction, analysis)
- Tweakpane 4.x (parameter interface)
- Radix-2 FFT (Cooley–Tukey, N-dimensional pencil decomposition)
- Radially-symmetric multi-shell kernel with four selectable core functions.
- Three growth function families (polynomial, exponential, step).
- FFT-based convolution for
$O(N^2 \log N)$ stepping. - Precomputed growth lookup tables with linear sub-LUT interpolation.
- Connected multi-step integration (3rd-order BDF approximation) and Arita dampening modes.
- 40+ per-frame statistics including symmetry detection, moment invariants, and periodicity analysis.
- LeniaNDStudio.js — p5.js lifecycle and asset loading
- core/AppCore.js — Application controller, worker orchestration, and parameter management
- worker/LeniaWorker.js — FFT solver, kernel builder, growth LUTs, and analysis pipeline
- model/Automaton.js — Kernel state container and sparse representation
- model/Board.js — Grid storage, pattern loading, scaling, and transformation
- render/Renderer.js — World/potential/growth/kernel rendering with LUT, overlays, and polar modes
- model/SolitonLibrary.js — Organism preset manager and parameter application
- ui/GUI.js — Tweakpane interface (6 tabs)
- input/InputHandler.js — Keyboard, mouse, and touch controls
- analysis/Analyser.js — Statistics, symmetry detection, moment invariants, periodicity
- media/Media.js — World/parameter/statistics import and export, image/media capture
- model/NDCompatibility.js — Canonical N-dimensional configuration and grid-size constraints (NDCompat class)
Lenia_ND_Studio/
├─ index.html
├─ LeniaNDStudio.js
├─ LeniaNDKC.py
├─ core/
│ ├─ AppCore.js
│ └─ methods/
│ ├─ AppCoreSolitonMethods.js
│ ├─ AppCoreControlMethods.js
│ ├─ AppCoreMutationMethods.js
│ ├─ AppCoreWorkerPipelineMethods.js
│ ├─ AppCoreImportExportMethods.js
│ └─ AppCoreRenderLoopMethods.js
├─ model/
│ ├─ SolitonLibrary.js
│ ├─ Automaton.js
│ ├─ Board.js
│ ├─ NDCompatibility.js
│ └─ RLECodec.js
├─ render/
│ ├─ Renderer.js
│ └─ methods/
│ ├─ RendererOverlayPanelMethods.js
│ └─ RendererStatsTrajectoryMethods.js
├─ ui/
│ ├─ GUI.js
│ └─ components/
│ └─ StatisticsGraph.js
├─ input/
│ └─ InputHandler.js
├─ analysis/
│ └─ Analyser.js
├─ media/
│ └─ Media.js
└─ worker/
├─ LeniaWorker.js
├─ WorkerAnalysis.js
├─ WorkerMainHandler.js
├─ WorkerND.js
├─ WorkerShared.js
└─ WorkerStep.js
- Continuous Cellular Automata
- The Lenia Update Rule
- Kernel Function
- Growth Function Families
- Time Integration Modes
- N-Dimensional Extension
- Model Parameters
Lenia (from Latin lenis, smooth) is a family of continuous cellular automata introduced by Bert Wang-Chak Chan (2019). Unlike binary automata such as Conway's Game of Life, Lenia operates on a continuous state field
The key parameters are the interaction radius
Each timestep executes three operations on the field
The local potential
For efficiency, this convolution is computed in the frequency domain using the Fast Fourier Transform:
where
The growth value at each cell is a function of the local potential:
The functional form of
The field is updated by adding a scaled growth increment and clipping to
where
The kernel is a radially-symmetric function with support on
For normalised radius r, default
The shell weight is selected as
Four families are available via the parameter
| Name | Formula | |
|---|---|---|
| 1 | Polynomial | |
| 2 | Exponential |
|
| 3 | Step | $k(r) = \begin{cases} 1 & 0.25 \leq r \leq 0.75 \ 0 & \text{otherwise} \end{cases}$ |
| 4 | Staircase | Step variant with half-weight for |
After construction, the kernel is normalised so that all weights sum to unity:
This ensures that convolution preserves the field's value range and that the growth function receives consistent inputs regardless of
Three families are available via the parameter
Compact support (exactly zero outside
Gaussian bell, never exactly zero but negligibly small far from
Binary growth/decay gate. Reproduces Larger-than-Life and Smooth Life rules as special cases.
Note
Growth functions are evaluated via precomputed lookup tables (32 768 entries) with linear sub-LUT interpolation for performance. The polynomial and exponential families each have a dedicated LUT.
Dampens oscillations by blending toward the growth target:
Uses current and previous growth fields for higher-order accuracy:
- Hard clip:
$\max(0,, \min(1,, x))$ - Soft clip: Smooth sigmoid approximation avoiding discontinuities at the boundaries.
The same algorithm generalises to arbitrary dimension
| Dimension | Supported Lattice Sizes | Default |
|---|---|---|
| 2D | 64, 128, 256, 512, 1024, 2048 | 128 |
| 3D | 32, 64, 128, 256 | 64 |
| 4D | 16, 32, 64, 128 | 32 |
For
- Slice: a 2D cross-section at selected depth indices
$(z, w)$ . - Projection: max or average projection over the extra axes.
| Parameter | Symbol | Default | Range | Description |
|---|---|---|---|---|
| Interaction radius | 13 | 2–50 | Kernel support radius (cells) | |
| Time scale | 10 | 1–1500 | Inverse timestep ( |
|
| Growth centre | 0.15 | 0–1 | Preferred local potential | |
| Growth width | 0.015 | 0.0001+ | Tolerance around |
|
| Shell weights | Real array | Multi-shell kernel weights | ||
| Kernel family | 1 | 1–4 | Kernel core function | |
| Growth family | 1 | 1–3 | Growth function family |
| Parameter | Default | Description |
|---|---|---|
softClip |
false | Use smooth sigmoid clipping |
multiStep |
false | 3rd-order BDF integration |
aritaMode |
false | Arita dampening |
h |
1.0 | Step-size coefficient (0.1–1.0) |
addNoise |
0 | Per-step noise injection (0–1, in tenths) |
maskRate |
0 | Random cell zeroing rate (0–1, in tenths) |
| Parameter | Default | Range |
|---|---|---|
| Grid size | 256 (2D) | 64–2048 |
| Dimension | 2 | 2, 3, 4 |
The worker implements a Cooley–Tukey radix-2 FFT algorithm with cached twiddle factors. The full stepping pipeline is as follows:
1. Zero-pad cells A into interleaved complex buffer [Re, Im, Re, Im, …]
2. Forward FFT (row/column for 2D, pencil for ND)
3. Element-wise complex multiplication: Û = Â ⊗ K̂
4. Inverse FFT → potential U
5. Growth mapping via LUT: G(U; m, s)
6. Time integration: A ← clip(A + dt·G)
Buffers are transferred with ownership (zero-copy ArrayBuffer transfer) between main thread and worker.
Three JSON libraries contain presets organised by biological-style taxonomy:
solitons.json— 2D organismssolitons3D.json— 3D organismssolitons4D.json— 4D organisms
Each preset stores parameters O2u (Orbium unicaudatus) which map to genus/species pairs.
| Mode | Data Source | Description |
|---|---|---|
| World | Cell state |
Primary view — LUT-coloured cell values |
| Potential | Convolution output heat map | |
| Growth | Growth/decay map (divergent colour: red = growth, blue = decay) | |
| Kernel | Interaction kernel shape |
Five polar overlay modes (off, symmetry, polar, history, strength) and eight additional overlays (grid, scale bar, legend, statistics, motion, symmetry, calculation panels, organism name) are togglable.
Per-frame statistics include:
| Category | Metrics |
|---|---|
| Mass & Growth | Total mass |
| Position | Centre of mass (Fourier-based toroidal centroid), growth centroid, centre distance |
| Motion | Speed, centroid velocity, angle, rotation speed |
| Symmetry | Rotational order |
| Shape | Gyradius, Hu moment invariants (1, 4–7), Flusser moment invariants (7–10) |
| Periodicity | Detected oscillation period (mass autocorrelation), confidence |
Symmetry detection decomposes polar samples from the centroid into Fourier harmonics and identifies the dominant rotational order.
| Key | Action |
|---|---|
Enter |
Run / pause |
Space |
Single step |
Del / Backspace |
Clear world |
N |
Randomise cells (Shift = seeded) |
| Keys | Parameter | Step | Shift (10×) |
|---|---|---|---|
Q / A
|
±0.001 | ±0.01 | |
W / S
|
±0.0001 | ±0.001 | |
R / F
|
±10 | ±1 | |
T / G
|
×2 / ÷2 | ±1 | |
E / D
|
paramP | ±10 | ±1 |
; / '
|
Remove / add shell | — | |
Ctrl+Y |
Cycle 1→2→3→4→1 | — | |
Ctrl+U |
Cycle 1→2→3→1 | — | |
Ctrl+I |
Soft clip | Toggle | — |
Ctrl+O |
Noise | Cycle 0→1 (tenths) | — |
Ctrl+P |
Arita mode | Toggle | — |
Ctrl+M |
Multi-step | Toggle | — |
| Key | Action |
|---|---|
Z |
Load selected preset |
C / V |
Previous / next organism (Shift = ±10) |
X |
Place organism at random position (Shift = toggle place mode) |
M |
Random parameters (Shift = extreme) |
| Key | Action |
|---|---|
← → ↑ ↓ |
Pan ±10 cells (Shift = ±1) |
Ctrl+← / Ctrl+→ |
Rotate ±90° |
= |
Flip horizontal (Shift = vertical) |
- |
Transpose |
| Key | Action |
|---|---|
Tab |
Cycle render mode (Shift = reverse) |
, / . |
Cycle colour map |
G |
Grid overlay (Shift = general overlay) |
L / B / O |
Legend / scale bar / statistics |
J |
Motion overlay (Shift = soliton name, Ctrl = symmetry) |
K |
Calculation panels |
' |
Auto-centre (Shift = auto-rotate, Ctrl = polar mode) |
| Key | Action |
|---|---|
PgUp / PgDn |
Z slice ±10 (Shift = ±1) |
Shift+Scroll |
W slice (4D) |
Ctrl+End |
Toggle slice / projection |
Ctrl+D |
Cycle dimension (2→3→4) |
| Key | Action |
|---|---|
H |
Toggle GUI panel |
# |
Toggle keymap reference |
Shift+P |
Export parameters (JSON) |
Shift+I |
Import parameters (JSON) |
Shift+J |
Export statistics (JSON) |
Shift+K |
Export statistics (CSV) |
Shift+W |
Export world (JSON + grids) |
Shift+Q |
Import world (JSON) |
F |
Export image |
V |
Start / stop recording |
- Chan, B.W.-C. Lenia: Biology of Artificial Life. arXiv 1812.05433 (2019). Complex Systems, 2019, 28(3), 251-286. https://arxiv.org/abs/1812.05433 DOI: https://doi.org/10.48550/arXiv.1812.05433. Related DOI: https://doi.org/10.25088/ComplexSystems.28.3.251
- Chan, B.W.-C. Lenia and Expanded Universe. arXiv 2005.03742 (2020). Artificial Life Conference Proceedings 2020, 32, 221-229. https://arxiv.org/abs/2005.03742 DOI: https://doi.org/10.48550/arXiv.2005.03742. Related DOI: https://doi.org/10.1162/isal_a_00297
- Lenia project page and interactive demos: https://chakazul.github.io/lenia.html
- Lenia rule summary: https://en.wikipedia.org/wiki/Lenia
cd library/Lenia_ND_Studio
python3 -m http.server 8080Open http://localhost:8080.