r/Simulated • u/cheetoskull • Aug 16 '26
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.
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!
35
u/AsTiClol Aug 16 '26
maybe next time use your own words to understand what you've done than let the shoggoth speak for you
0
Aug 16 '26
[deleted]
2
u/CHROME-COLOSSUS Aug 16 '26
People are lazy.
I myself have been accused of using or being Ai (I’m human and have never used Ai even once), so I take issue with anyone who dismisses a response just because it’s on the longer side.
I think you represent a subset of people who are so obsessed with Ai shock that you falsely interpret careful or exhaustive articulation as not being a thing that humans are capable of. A sort of filtering by lowering the human bar.
As someone who has (once or twice) written REDDIT comments so long that they required me to break them into TWO comments (having hit the character limit), I think it’s pretty fucking shitty to dismiss length or depth as evidence of Ai in itself.
I don’t know OP, and for all I know they might use Ai to help articulate coherent responses as well as their programming goals, but I don’t think you know either.
Beyond that, if a reply communicates information you were asking for, then did you ever care about the information or are you just trying to feel smort for calling out a generative assist?
Foid for thought.
-1
u/AsTiClol Aug 16 '26
you do realise nobody has a problem with vibe coding here, but the problem is when you cant take the time to write things yourself. writing is an activity in thinking, asking others to read the text your ai wrote for you is considered a social faux pax.
^ if you cant understand that, you dont understand human communication post-ai
2
u/CHROME-COLOSSUS Aug 16 '26
I read the replies, and whether they were wholly written by OP or by Ai that OP used, or 50/50 they made sense to me and delivered the info.
Are you looking for a human bond here, or an articulate and timely reply?
2
u/cheetoskull Aug 16 '26
Happy to provide a human bond in any case. I really don’t understand the whole “You aren’t being human enough”- like I literally came here and made myself completely vulnerable. You just can’t please some folks
1
u/CHROME-COLOSSUS Aug 16 '26
You can’t.
Welcome to the future, where the more some things change, the more some things stay the same.
7
17
1
u/CHROME-COLOSSUS Aug 16 '26
I’m not a computer-savvy person, and I don’t understand half the words you’ve used in this post and your replies to others…
…but I’m very much able to recognize how a function reached through a very different approach, and which yields uniquely-reproducible results, might be of real interest to some folk.
Feels like something that hints at a broad spectrum of future use-cases, but as you say… it offers the possibility of perfectly-shared multiplayer environments and physics. That’s a pretty intriguing thing.
I dunno why on earth you’re getting so much pushback from such a cool post. Thanks for sharing!
3
u/cheetoskull Aug 16 '26
You get it completely! Thank you for your comment. I see this as frontier work and felt I had a duty to steward it to those will use and appreciate it. Thank you again.
3
u/garnet420 Aug 16 '26
You can make deterministic summation algorithms for floating point data on the GPU.
Once you do that, the non-determinism often artises not out of summation order but from got fused multiply-add instructions are generated.
1
u/q120 Blender Aug 16 '26
This takes me back to all of those Falling Sand Game games and Powder Toy. Very cool.
And I don’t care if you used AI for this at all.
1
u/cheetoskull Aug 16 '26
Thank you! If you haven't, please go check out the browser sandbox at sunabox.dev (:
0
Aug 16 '26
[deleted]
3
u/cheetoskull Aug 16 '26
This comment made my night, I was hoping this would be seen as an altruistic move?Thanks for the kindness, inputs over the wire while every machine computes the same world is exactly the dream. Thank you.
0
Aug 16 '26
[deleted]
0
u/antiundead Aug 16 '26
I question how it can be open source when the Ai is most likely trained on other people's work without their permission.
6
u/CHROME-COLOSSUS Aug 16 '26
Programming is probably the single best argument for generative Ai / machine learning that there is.
9
u/Neex Aug 16 '26
For what it’s worth, there are terabytes of open source code. Like, truly open source, available for people to do what they wish. Training an LLM to write code is not as deep of an ethical dilemma as you think. The training material isn’t a pile of copyrighted material in the same way video or image generators are.
0
u/antiundead Aug 16 '26
Yes but you cannot be certain it was trained on only open-source data, can you? Have you not seen how all the Ai companies are getting challenged in court for taking books from anna-archive or other illegal book hosting sites? They have no morals, anything to feed the machine.
38
u/Quartinus Aug 16 '26
You don’t really explain why on any of these points. Why is it useful to have independent twin simulations? Is this for research or games? If it’s for research, why is it Q16.16? Which physics are you simulating? Looks like collisions and some basic fluid stuff? Who is using those for simulation?
When research sims for rigid body dynamics run, they don’t just run two copies and compare bit hashes. We use tools like energy conservation, positive definite matrices, etc. But research is the only spot where I can see spending all of this extra time on simulation and guarantees of exactness being useful.
So I ask: who did you build this for and why?