Game Of Life
Conway's cellular automaton as a ComfyUI mask/image generator
- optional_start
- image
- mask
- off
- on
Yes, that Game of Life - John Conway's 1970 cellular automaton, the one where cells live, die, and reproduce on a grid based on three simple rules, and somehow produces gliders, oscillators, and other structure out of pure noise. spacepxl's node runs it right inside your ComfyUI graph and hands you both a rendered image and a set of masks. It's the odd one out in this pack - everything else here is a practical filter, this one is closer to a procedural texture generator, but it earns its keep whenever you need organic, structured-but-not-random binary patterns rather than plain noise.
What it's actually for
Pure random noise (static) has no structure. Perlin/simplex noise has structure but it's smooth and blobby. Game of Life sits in an interesting middle ground: cellular, high-contrast, and full of the kind of jagged, semi-organic shapes that look nothing like either. That makes it a fun source for starting masks in inpainting experiments, a stylized texture/pattern generator you can feed into a ControlNet or img2img pass, or just a novelty background generator. It also accepts a mask as the starting condition instead of random cells, so you can seed the simulation with a shape of your choosing and let it evolve from there rather than starting from scratch.
Inputs and outputs
width/height(8–1024, default 32) - the simulation grid dimensions, in cells.cell_size(8–1024 in steps of 8, default 16) - how many pixels each cell renders as in the output image. Grid size times cell size gives you your final resolution.seed(default 0) - random seed for the starting state, when you're not feeding inoptional_start.threshold(0–1, default 0.8) - controls the density/cutoff of the starting condition (how much of the grid starts alive versus dead).steps(default 64) - how many generations the simulation advances before the node hands you the result. More steps means the pattern has had more time to settle into gliders, stable blocks, or die out entirely.optional_start(MASK, optional) - feed in your own mask to seed the starting cells instead of relying on the random seed.
Four outputs come back: image (the rendered final generation), mask (the living cells as a mask), and off / on (masks breaking out the dead versus alive cells specifically at the final step) - handy if you want the "on" cells as one selection and the empty space as a separate one, rather than inverting a single mask yourself.
Installing it
ComfyUI Manager: search "ComfyUI-Image-Filters," install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-Image-Filters
Run pip install -r requirements.txt (or install.bat on Windows), then restart. No model weights involved - this node is pure simulation code, so it adds nothing to your download queue.
Same OpenCV caveat as the rest of the pack applies at the install level: if you already have a different opencv/cv2 build installed from another node pack and see import errors on startup, run import_error_install.bat to reinstall the single correct variant (opencv-contrib-python) instead of chasing version conflicts by hand.
Common issues
Because steps defaults to 64 and cellular automata can either die out completely or stabilize into an unchanging pattern well before that, don't be surprised if a high step count gives you a mostly-empty or mostly-static result - that's the simulation converging, not a bug. If you want more visual variety, lower steps to catch it mid-evolution, or adjust threshold to change how dense the starting grid is (a very high threshold gives it more live cells to start, which changes how it evolves). If you're feeding in optional_start, remember it only sets the starting condition - the automaton still runs forward from there for the full steps count, so a carefully drawn starting mask can still evolve into something unrecognizable if you let it run too long.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 328–1024 | — |
| height | INT | 328–1024 | — |
| cell_size | INT | 168–1024 | — |
| seed | INT | 00–18446744073709550000 | — |
| threshold | FLOAT | 0.800–1 | — |
| steps | INT | 641–999999 | — |
| optional_startopt | MASK | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| off | MASK | — |
| on | MASK | — |