I want to play around with different local rules for discrete and continuous cellular systems on arbitrarily large sparse 2D grids.
Think a 2D simulation of the wave equation, heat equation, electromagnetics (em wave equation and fields, not particles), but also the game of life and other interesting cellular automata rules (wireworld, the Powder Toy/’falling sand’ style physics sandbox games…), air/fluid pressure & velocity simulations etc. Simple pixel-graphics editors (think mspaint in Windows 95) would also be possible in this framework when combined with the interactivity.
Each cell needs to store the same amount of data and the grid should be stored sparsely (in a hashmap or so) so that I only pay for the data that is actually doing something interesting. The unallocated data would default to some fixed or merely coordinate-dependent or maybe interpolated value. However, new cells could always be allocated.
I only care about playing around with the rules and animating through the steps, coloring/visualizing and interacting with the results. I would prefer not having to build the whole framework for rendering the result and interacting with it myself.
The grid cells would have uniform size (A: if you know one that can progressively refine cells even better). The visualization and interaction should allow to easily zoom, rotate and pan the canvas in an arbitrary way (similar to https://apps.apple.com/us/app/stretchpaper/id1209617522 ). Each cell would be presented in a single, solid, programmable color (derived from or stored in the per-cell data). One or more pointing devices could be used to manipulate cells in the selected location on the grid. The conversion from screen to grid coordinates should be built-in to the framework.
Here are my other dream specs:
- the computation rules can be written in C++ (or some shader language, UCDA, OpenCL or so) supporting machine integers and floats and executed on any available processors (GPU, CPU, FPGA, computer cluster) – if everything runs locally that’s fine too though… The rules will always be trivially parallelizeable, refering only to a few neighboring cells within a small radius.
- if the rules could be specified in some declarative/scripting language that would be nice too, but they should definitely be compiled down to machine code to leverage all the FLOPs the machine(s) have
- millions of pixels can be shown at the same time (A: bonus points if it can merge adjacent cells at high zoom levels for a kind of multigrid/multiscale display)
- the visualization and interaction framework works on Windows/Unix/Mac/iOS/Android (think Unity…); the computation rules work on basically anything…
- simulation and visualization are decoupled – the visualization should only access the data that is currently visible and we can skip simulation-frames from visualization
- Some simple UI widgets based on something like Dear ImGui/AntTweakBar can be used for interactive tweaking of simulation parameters
Here are some examples for the kinds of systems I would like to be able to implement with this:
- http://www.jgallant.com/LiquidSimulator/ (I don’t care about the half-filled cells or the arrows though)
- this one kind of agent based system stretches the concept of "local rules" a bit I guess, because there might be nonlocal/n^2 rules for how the agents interact – it would be nice if there may be agents/points other objects in memory which ultimately determine the colors of the cells or "field points"; the final visualization would however always be cellular and the color of the cells could be determined in parallel given all the locations of the agents that influence a cell; imagine a visualization of the electric field strength around a bunch of electrons
Did you ever work on something like this? Are there (non-dead…) projects that do something like this out there? What should I combine to get there in a reasonable time? Any input is appreciated.
Should I use Unity? Should I look into some fractal/cellular simulation collection like Visions of Chaos https://softology.com.au/voc.htm ?
I imagine this kind of framework opens up the possibilities for tons of (scaleable) computational fun and exploration for students and players alike.
Source: Windows Questions C++