Conway's Game of Life but cells grow and shrink vertically over time on procedurally generated terrain.
Drag or click with the mouse to paint or erase cells. This will be the starting pattern for the game. When you are ready, press spacebar to start the game. Press spacebar again to end the game and return to edit mode.
Hotkey | Function |
---|---|
Spacebar | Enter/exit simulation |
C | Clear the board in edit mode |
R | Randomize the board in edit mode |
The simulation follows Conway's original rules for the Game of Life.
Every tick, I check the state of each cell. If the cell is alive, it builds up one block, as if by expansion. If the cell is dead, it collapses one block, as if by deterioration. This essentially creates a heatmap of how long a cell has been alive in the form of a building.
For the terrain I use 2D Perlin noise to procedurally generate the Minecraft-like terrain. I think it adds interesting height variations to the buildings, as if the cells live and build on top of actual geography.
I borrowed the logic to elegantly count a cell's neighbors from this p5.js example by Daniel Shiffman.