This is an experiment with cellular automata. A functional mod for Rem’s Engine.
When experimenting, I found the Sierpinski Triangle the easiest to type in + most interesting: births = 1, survives = 0, states = 5.
The following images show the cellular automate with those settings:
I was inspired to experiment with cellular automata by Tantan.
This is a mod for Rem’s Engine, so first build the engine. Then you can build this project, e.g. with Intellij Idea. There are no dependencies besides my engine.
I’ve compiled a version including the dependencies into Demo.jar. It should run on Windows and Linux.
My focus went more towards GPU optimizations, because they were the bottleneck at 50³ cells at the start. Now, the CPU performance could be improved substantially, e.g. by using good multithreading (mine currently doesn’t work efficiently, idk why).
First I implemented the visualization using instanced rendering & blocks. I added a MeshSpawner for that purpose into my engine (CellularAutomaton1). However, probably because of overdraw, the performance was quite bad, and a fractal cube with 50³ cells already caused my RX580 to go down to 30fps at 1080p.
I then tried to create chunks like in Minecraft, just to see what the performance would be. Unsurprisingly, it was no better.
Then I tried raytracing within the cells boundaries. This was a large win, and brought my fps back to 160 in 1080p (CellularAutomaton2). First I used the front face of the bounds-cuboid as a ray-starting point and a mask of where to raytrace. But this made movement inside the cell volume inpossible. I then rewrote the shader such that you’re able to render from any point. The mask is now the backside of the cuboid.