Allow me to recommend The Powder Toy[0]. It is to date, as far as I can tell, The most advanced falling sand game available, aside from maybe Noita, though the focus there is quite different from most falling sand games. It has hundreds of different elements to play with. It simulates air pressure and can with the toggle of a button simulate ambient heat, water pressure, and newtonian gravity. People have built everything from bombs to CPUs in it.
Disclaimer: I did some minor development work on TPT and am involved in the community. Still though, great game.
There's something about the feeling of this that reminds me of being much younger, running demos in DOS, and how insanely performant they'd be at running the same sort of thing.
It was like magic at those times.
This is so far abstracted from the magic hyperoptimizations that were used for those demos it's mindblowing, but it's still fun to see and neat to play with.
Love the gravity addition, that's a clever trick for dealing with fractional velocity. Pausing rendering when there are no changes is also a nice touch.
I notice on my machine the background is initially white and only acquires the grey background color after a sand has fallen past a given pixel. I encountered the same bug when building my own version off of this from your last post, my fix was to initialize the dirty set to be the full set of indexes for the first frame. Also, some of the buttons are pure white, the text is invisible. (I suspect both of these are light mode only bugs)
I thought treating fractional velocity as the probability to move was a fun hack. Unlike rounding, it makes it feel a bit more fluid as the batch of particles placed at a time step move two different distances.
Oh no! I clearly have a bug. I develop in dark mode and apparently broke something during this post and didn't verify light mode. I will look into it now!
Thank you! I'd be very interested to see that. I've had a couple of fun Sundays now. I'm looking forward to the next pieces- but moving the logic to the gpu (either by shaders or GPGPU) has not been something I've been planning to do.
The simulation being massively parallel, it is a perfect fit for a fragment shader. Since the interactions between the particles are mostly local, taking advantage of the fact that the GPU loads a block of neighbouring fragments in the cache to be able to compute the standard derivatives, it should run very well. I will notify you when I find some time to play with it.
I'm hosting on Github Pages, which seems to have a feed plugin for RSS, so I'll investigate that! Right now I've just been posting to Twitter (so far it's the only thing I've used it for) and HN.
Small bug: if you two finger touch on iOS (or hit clear all), the screen clears to a different color background, lighter than the new sand dispenser, so now the sky becomes darker as you drag around.
If there's interest, I can definitely take a crack at it!
My current plan was to introduce some new particle types as there is some pretty stimulating emergent behavior that comes out particles with different rules interacting with one another.
I'm also really interested in exploring 2D velocity and acceleration- how we could go about enabling particles to be thrown and bounce off of walls- or each other.
If you don't mind spoiling your plans, are you thinking of continuing with the subclass-per-particle type approach, or eventually moving to something like a simple ECS architecture?
A full ECS architecture? I don't plan on it. But using some sort of trait / component structure could be worth if enough particles with a mixture of different and overlapping behaviors were introduced.
Have you thought about modeling aeolian transport (wind-blown sand?) the mechanics of it are poorly understood and this could be a decent starting point. I know the other models attempting to capture aeolian transport are extremely lacking.