solzilberman /
3D_Cellular_Automata
:ice_cube: 3D CA in C++ using OpenGL, freeglut, glew
Loading repository data…
LelsersLasers / repository
3d Cellular Automata using Raylib in C++

To quickly download the latest executable and needed files (main.exe and the options.json), click here. Note: this was only build for Windows, but all libraries used are fully cross platform (I think). Information about compiling for non-Windows can be found here.
For graphics, the Raylib library is used. At first I wanted to use wgpu with Rust because there were many tutorials online. (UPDATE: I did it! Running live on the web: https://lelserslasers.itch.io/3d-cellular-automata-wgpu-rust) However, I quickly found that it was overkill for what I needed and I wanted to focus on the simulation rather than writing complex shader code. Raylib is very simple to use, just DrawCube(pos, w, l, h, color); and a 3d cube appears. Raylib is written purely in C99, but has bindings to many languages, including Python, Java, and Rust. I was tempted to use one of the bindings, but many of the binding were converted to fit the languages paradigms and did not match 1 to 1 with the documentation or examples. The library itself without any bindings is fully compatible with C++, and I really am used to using classes, so I chose C++ over C. (Note: there is a C++ binding that follows the C++ paradigm rather than the C one, but I chose not to use it for simplicity.)
A cellular automaton is a collection of "colored" cells on a grid of specified shape that evolves through a number of discrete time steps according to a set of rules based on the states of neighboring cells. The rules are then applied iteratively for as many time steps as desired.
— Wolframe MathWorld
A cellular automaton consists of a regular grid of cells, each in one of a finite number of states, such as on and off (in contrast to a coupled map lattice). The grid can be in any finite number of dimensions. For each cell, a set of cells called its neighborhood is defined relative to the specified cell. An initial state (time t = 0) is selected by assigning a state for each cell. A new generation is created (advancing t by 1), according to some fixed rule (generally, a mathematical function) that determines the new state of each cell in terms of the current state of the cell and the states of the cells in its neighborhood. Typically, the rule for updating the state of cells is the same for each cell and does not change over time, and is applied to the whole grid simultaneously.
— Wikipedia
Cellular automata are discrete, abstract computational systems that have proved useful both as general models of complexity and as more specific representations of non-linear dynamics in a variety of scientific fields. Firstly, cellular automata are (typically) spatially and temporally discrete: they are composed of a finite or denumerable set of homogeneous, simple units, the atoms or cells. At each time unit, the cells instantiate one of a finite set of states. They evolve in parallel at discrete time steps, following state update functions or dynamical transition rules: the update of a cell state obtains by taking into account the states of cells in its local neighborhood (there are, therefore, no actions at a distance). Secondly, cellular automata are abstract: they can be specified in purely mathematical terms and physical structures can implement them. Thirdly, cellular automata are computational systems: they can compute functions and solve algorithmic problems. Despite functioning in a different way from traditional, Turing machine-like devices, cellular automata with suitable rules can emulate a universal Turing machine (see entry), and therefore compute, given Turing’s thesis (see entry), anything computable.
— Stanford Encyclopedia of Philosophy
A cellular automaton is a collection of cells arranged in a grid of specified shape, such that each cell changes state as a function of time, according to a defined set of rules driven by the states of neighboring cells.
— TechTarget
Cellular automata are used to study the evolution of disease epidemics through computer modeling.
In anthropology, cellular automata with fundamental space-time representations are used to model the formation of civil societies.
Cellular automata are used to study the causes and effects of civil violence.
Several biological processes and systems are simulated using cellular automata, including the patterns of some seashells, moving wave patterns on the skin of cephalopods and the behaviors of brain neurons.
Cellular automata are used to simulate and study physical phenomena, such as gas and fluid dynamics.
Cellular automata automata are proposed for use in public key cryptography. They can be utilized to construct pseudorandom number generators, and to design error correction codes.
Sources:
There are 4 rules: survival, spawn, state, and neighborhoods. A cell can be in one of 3 states: alive, dying, or dead.
(Note: can just copy/replace in options.json)
"survival": [9, 10, 11, 12, 13, 14, 15, 16, 17, 18],
"spawn": [5, 6, 7, 12, 13, 15],
"state": 6,
"neighborhood": "M",
"survival": [2, 6, 9],
"spawn": [4, 6, 8, 9],
"state": 10,
"neighborhood": "M",
The rules, colors, and settings for the simulation can be found in options.json. When editing the file, make sure that all the keys/variables are still there, and that the types of the values (number, list of numbers, string) are not changed. The simulation loads the settings from the file when it is started, but they can be reloaded by pressing J.
The first 4 options (survival, spawn, state, neighborhood) are the rules for the actually cellular automata. The explanations for these rules are above (as well as their types).
Defaults:
"dualColorAlive": [0, 228, 48],
"dualColorDead": [230, 41, 55],
"dualColorDyingAlive": [230, 41, 55],
"singleColorAlive": [255, 20, 20],
"centerDistMax": [255, 255, 255],
See draw modes for more information about how the colors work. The values are a list of three numbers, representing the RGB values of the color where 255 = 100% color intensity, and 0 = 0%. (So [255, 0, 0] is red, [0, 0, 0] is black, [255, 255, 255] is white, etc.)
Defaults:
"cellBounds": 96,
"aliveChanceOnSpawn": 0.15,
"threads": 8,
"targetFPS": 15
Keyboard and
Selected from shared topics, language and repository description—not editorial ratings.
solzilberman /
:ice_cube: 3D CA in C++ using OpenGL, freeglut, glew
JannikNickel /
3D Cellular Automata in C++
kaiuerlichs /
Cellular Automaton simulator in C++; console-based menu with options to create customisable 1D automata, Game-of-Life based 2D automata, or toroid-shaped 3D automata.
sebimih13 /
3D Cellular Automata made with OpenGL and C++
lilfelix /
A C++ backend using gRPC to communicate with frontend for visualizing a cellular automata in 3D space with WASD fly controls