This project was something small I could work on for a few days on the side of my other main projects. The idea is that it is a 3D game of life.
To create the cubes, I used the InstancedMesh
tool that three.js provides. This allows you to create many of the same object with varying materials and at low processing cost.
The simulation controls are displayed on the right. You can change them any way you choose, although some require a restart. Also, once you have made changes, you can share them by just copying the link and the simulation will play out exactly the same.
The parameters are as follows, although by checking the wikipedia page these should become apparent
size
– Size of the grid to simulate the cells inbMin
– Minimum number of neighbour cells to survivebMax
– Maximum number of neighbour cells to survives
– If this number of neighbouring cells is reached exactly, the current cell becomes alivemode
– Whether cell death or birth takes priority
spacing
– gap between cell modelstick
– time between updating simulation. Recommended to set high for large sizespause
– whether to pause the simulation or not
step
– used when paused, advance the simulation by one tickrestart
– restart the simulation
