3D Life
Play the Game of Life in three dimensions, free in your browser. Spin a cube of living cells, try five 3D rule sets and watch Web Workers share the work.
How to Play 3D Life
- Press Play to run the space, or Step to advance one generation at a time. The Interval slider sets the pause between generations, down to none at all.
- Drag to spin the cube, and pinch or hold Ctrl (⌘ on a Mac) while scrolling to zoom. Click any cube to see how many live neighbours it has and which rule decides its next state.
- Pick a rule set: each starts from its own seed, a random cluster in the middle, a full random soup or a single cell. New seed starts again from a fresh one and Reset returns to the current one.
- Choose a size from S (32 cells a side) to XL (96 a side, almost 885,000 cells) and whether the edges wrap around.
- Under Threads, run each generation on the main thread or split it across 1 to 16 Web Workers, and watch how long each worker took. Colour by Worker paints each cell in the colour of the worker that computed it; Born / survived picks out the cells born this generation.
Frequently Asked Questions
- How is 3D Life different from the Game of Life?
- Each cell sits in a cube of 26 neighbours instead of a square of 8, so the numbers change: in Carter Bays' Life 4555 a live cell survives with 4 or 5 live neighbours and a dead cell is born with exactly 5. Everything else works the same way: every cell changes at once, once per generation.
- How does the rule engine decide each cell?
- Every cell is described by two facts, whether it is alive and how many live neighbours it has, and checked against a list of named rules in priority order, the same rule engine the 2D Game of Life uses. The rules table counts how many cells each rule decided in the last step; clicking a cube shows the rule that decides it.
- What do the threads do?
- A generation depends only on the one before it, so the cube can be cut into horizontal slabs of layers and each slab computed by a separate Web Worker at the same time. A worker needs its own layers plus one layer above and below; it sends back its new layers and the page stitches them together. The result is exactly the same whatever the split.
- Why don't more threads make it much faster?
- Each worker's own share shrinks almost in proportion, but the cells have to be copied to every worker and back each generation, and that copying does not shrink. On the largest cube, four workers bring a step from about 5 ms to about 3.5 ms on a fast laptop; past that, the copying is most of the time. The worker bars show the split as it happens.
- What do the rule sets do?
- Life 4555 burns a random cluster down within about a hundred generations. Slow growth spreads outward a little each generation. Clouds clumps a half-full space into smooth blobs. Crystal grows a branching lattice from a single cell, and Replicator copies one cell to the corners: 8 copies at generation 2, 64 at 6, 512 at 14.
- Why do some cells look hidden?
- Only cells with at least one face open to empty space are drawn, since a cell buried on all six sides cannot be seen. The population counts every live cell, drawn or not.