nice
Play game
Loose Dirt 2's itch.io pageRate this game
Sign up with an itch.io account to rate and leave comments.
Comments
Other than the simulation itself (which is very cool) I just loved the lightning system. These are literally proper textures created with just shaders (afaict). I would've loved to see a simulation speed controller though, water takes a bit to properly settle :D Also, thanks for sharing the source code I can even make sense of it for the most part lol Joking aside, the code base is well organized; and the simulation is very elegant for something I'd have assumed to be much more complicated and sort of just "brute forcing" physics calculations type of thing. Thanks a lot for the game!

Thank you so much! I'm glad you enjoyed it.
Yes, the shading is entirely procedural. I give each cell a random number each simulation step, which is used as a seed for the randomness in the pixel shader. That shader samples a bunch of points up in a cone shape to check if they're occupied for "directional lighting", and some in a circle for checking for emission (lava and fire). Rather expensive, but a modern GPU can breeze through it anyways.
For simulation speed, I agree, but would've required some more optimized code. I could only push about a 2.5x tick rate before clogging my CPU. It's all single-threaded, (and embarassingly parallelizable) there's probably many easy wins to take still, but jams!
Specifically about water, one thing I think would help, would be to have the cells have a velocity property, so that momentum solves "piles of things" faster, rather than hoping for each layer of particles to effectively resolve one by one.
About the simulation code, that's one of the things I like about falling sand! Simple, combination-based logic causes interesting large-scale patterns. I definitely didn't come up with the idea, cellular automata and similar are a classic computer science topic.
Nice falling sand implementation. As a certified falling sand enjoyer I got trapped by this game for longer than I probably should have. Would have liked some more out-there interactions between the materials (and some more quirky ones) to better fit the Alchemy theme, but overall nice work.
Haha, "getting someone trapped in the game longer than there's any right to" is the highest compliment I can expect! I am proud of how it serendipitously has a "heat equation" type deal emerge from just water/lava/rock replacement interaction.
I agree, it's not a good fit to the theme. This was my backup idea 4 days in, and I got distracted trying to make it run entirely on the GPU for a while¹, so I didn't have a lot of time to add more things to it.
Thanks for playing!
Footnote 1
I wanted the game to run on web without requiring WebGPU, and WebGL does not have compute shaders, so I had to implement the simulation logic as a pixel shader. Not only just figuring out how to do that in Bevy took me a minute, it's also a horrible way to write a discrete simulation like this.
Because each pixel is independent, it meant I had to write code for both sides of a replacement, which is hella annoying to get right. Ported to CPU, or if I had access to compute shaders, it's just a memory swap. But in pixel shaders I have to write code to turn air into water AND water into air to move a water particle.
The final version is simulated on the CPU. I use pixel shaders, but only for the colors and lighting effects.
Fun sandbox! the simulation stays smooth with lots of particles and watching components react toghether is satisfying. A few sound effects would add a lot.
Nice remake!



Leave a comment
Log in with itch.io to leave a comment.