Minecraft 3D Cellular Automaton

Опубликовано: 14 Июль 2026
на канале: rypo falem
412
6

Source code: https://github.com/RypoFalem/Cellular...

Each cell checks its neighbors to the north, south, east, west, up and down. The cell will decide if it is active or inactive in the next iteration based on its neighbors.

Since there are 6 neighbors and each neighbor has two states, there are 64 (2^6) possible combinations of neighbors. A 64-bit integer is used as a chart to determine how to react to a certain combination of neighbors. If a cell's neighbors are in combination 62, a cell will look up the 62nd bit in that integer. If that bit is 1, the cell will be active the next generation. If that bit is 0, it will become inactive.

This all takes place on a 32x32x32 grid meaning there are 32,768 cells. If a cell on the very edge tries to check its neighbor, it will "wrap" to the other side (e.g. if a cell on the east edge tries to look further east, it will check the block on the far west side instead). This is why you see glass blocks that seemingly move to the opposite side.

The simulation starts with a single cell. With many rules, a single cell with no neighbors destroys itself so you never really get to see those.