Conway's Game of Life written using Haxe and WebGL. Run it in your browser.
- Select from thousands of Game of Life patterns, add them to the simulation with one click.
- Speed up, slow down, frame-step, pause and clear the game world.
- Browse, preview and pick the patterns to add interactively.
Run the demo, and press anywhere on the Game of Life canvas to add a pattern to the simulation. Here it is in action:
Select from thousands of different Life patterns via the selection dropdown or the pattern previews section:
Resize the browser window to change the simulation size. The canvas scales by powers of two (1024x512, 1024x1024 etc):
The Game of Life is a cellular automaton invented by John Conway in 1970. It is a simulation that takes place on a two-dimensional orthogonal grid of square cells, each of which can either be dead or alive.
Each time the simulation is updated, every cell in the grid interacts with its eight neighboring cells in accordance with these four rules:
- Any live cell with fewer than two living neighbours dies (isolation).
- Any cell with two or three living neighbours survives this time (survival).
- Any cell with more than three living neighbours dies (overpopulation).
- Any dead cell with three living neighbours comes to life (reproduction).
Conway designed these rules to produce interesting results - even self replicating patterns can be produced. Read more here.
In this implementation, the Game of Life rules are applied via a GLSL shader that runs on the graphics card. It uses a ping-pong technique with two render targets: one render target contains the current simulation step, and the other receives the results of applying the rules of the game to produce the next simulation step. In other words, we use the output of the last simulation step as input to the next one, alternating between render targets on every step.
- The patterns are from the LifeWiki collection. Credit for these goes to the original creators.
- This project was inspired by Golly, a cross-platform cellular automaton simulator.
- Images can be sent to the software through a binary-mode WebSocket, enabled by appending "?socket=<your_ip>%3A<your_port>" to the URL. It expects messages in the form: width:int32, height:int32, RGBA8888pixels:array.
- If you have any questions or suggestions then send Sam a message on Twitter or open an issue.
- The Haxe and webpage code, but not the pattern files, are licensed under the GPL.
- The noUiSlider settings sliders are WTFPL.
- The three.js library is MIT.