Smooth artificial life: glowing creatures that glide, spin and divide.
Lenia is Conway's Game of Life made continuous. Every cell holds a value between 0 and 1, sums up its neighbors through a smooth ring-shaped kernel, and grows or shrinks according to a bell-shaped growth function. With the right parameters, stable creatures emerge: Orbium glides, the spinner rotates in place, and the colony grows by dividing. The kernel is up to 37 cells wide, so the convolution is done with a hand-written FFT on a grid stored in typed arrays.
Try it. Click to drop a new creature. Drag to paint life. Press 1 to 3 to switch species (Orbium, Spinner, Colony) and R to reseed.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a Lenia simulation (Bert Chan's continuous Game of Life) with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a canvas that fills the window. Simulate a 128 by 128 grid that wraps around at the edges, store it in a Float32Array of values between 0 and 1, and draw it scaled up with image smoothing on.
- Build the kernel: for every offset within radius R = 13, compute r = distance / R and weight it with the smooth bump exp(4 - 1 / (r * (1 - r))), which is zero at the center and the edge, so the kernel is a soft ring. Normalize the weights to sum to 1.
- Each step, compute U, the kernel-weighted sum around every cell. Then apply the growth function G(U) = 2 * exp(-((U - m)^2) / (2 * s^2)) - 1 with m = 0.15 and s = 0.015, and update A = clamp(A + G(U) / 10, 0, 1).
- Seed the world with a few discs of random values. Most will die, but some should settle into a gliding creature called Orbium.
- Do the convolution directly first, skipping the many zero weights. Keep the grid small.
Once that works, make it beautiful:
- Map values through a glowing palette (deep violet, magenta, amber, white) and keep a fading trail buffer so moving creatures leave comet tails.
- Add a cheap bloom: draw the frame into a small canvas and stretch it back over the top with "lighter" blending.
- Let me click to drop a new random seed and drag to paint life.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as computing the convolution with an FFT so the grid can be much larger, trying multi-ring kernels for other species, or an autopilot that keeps the world populated.