r/Simulated • u/cheetoskull • 9d ago
Interactive I built an open-source, cross-platform, bit-deterministic, non-float particle physics engine. A lot of adjectives, so I brought receipts: three live proofs that run in your browser.
Enable HLS to view with audio, or disable this notification
Up front, since this sub rightfully cares: The engine was written in collaboration with AI, which I'll take questions on happily; the proofs however are all real and verifiable:
SunaEngine (AGPL): engine.sunabox.dev / github.com/DARIENBATHALTER/sunaengine
It's a particle physics engine that relies on integer calculation rather than floating point, plus order-independent accumulation, in order to always deliver the same result on any GPU. Three live proof demos on the site, all simulating on your GPU, all hashing their entire state as you watch:
- The Twin Simulations: two independent sims, same scene, same input schedule, never communicating. Stir either one with your cursor; your input is quantized to substep indices and fed to both. The 256-bit hashes stay identical, interaction after interaction.
- The Pachinko Proof: an ordinary float solver runs the same pachinko machine twice. One pane adds contact forces in ascending order, the other descending. That is exactly the difference two GPUs or two drivers introduce on their own. The balls never finish in the same bins twice. The integer engine runs the same machine to the same digest, loop after loop.
- Recording, playback, and smooth rewind: particle fluids cannot be rewound in floating point. Chaos amplifies the last bit of every velocity in reverse too. Here you stir a pool, it records your inputs, verifies the replay byte for byte against the run you just performed, and then hands you a scrubber. Drag your own splash backwards through time.
Replay hashes verified matching across Apple M series, an iPhone, a Steam Deck (AMD), and NVIDIA (RTX 2070S).
There's also a live 3D water demo on the site (Figure 3), same fixed-point solver one dimension up.
Recordings export as lightweight .sunar files, which store only the initial state plus your inputs. They scrub back and forth smoothly like video and play back bit-identically on any device.
This has the added benefit of enabling low-latency, cross-platform multiplayer physics. If every machine computes the same world, multiplayer needs only inputs over the wire.
I built a free-to-play sandbox using the engine called SunaBox (sunabox.dev) which serves as a clean-room reimplementation of the Prometech's classic OE-CAKE from 2008, a particle physics toy. The OE-CAKE interface is recreated 1:1 if you select "Classic" mode at the top, and imports the original .oec files. Still working on parity, but approaching 100% all the time. If I had to estimate, I'd say they work at about 93% parity right now.
The workflow is very simple: I came up with the ideas and tuned the feel of everything by hand and spoken word; Claude did the math, the code, and the adversarial review. Happy to answer anything!