A nice bit of web programming. The smoke effects look cool. Pity solids don't conduct heat - the first thing I always try and do in these is boil a pot of water.
If you've never seen this kind of thing before, the canonical PC example is The Powder Toy, which is so amazing I wish there a 3D Minecraft-like version. But it's really CPU-heavy even in 2d.
This is great, I love falling sand games.
The only downfall is that the Pythagorean Cup didn't work?
Several years ago I wrote a falling sand game for the Parallax Propeller chip, which is an 8-core microcontroller. One core was needed to drive the video output, and I had up to 7 other cores running a simple ruleset:
1. If a sand pixel had an empty pixel below it, exchange them. 2. If more than two sand pixels are stacked but there's space to the side, kick one sand grain out to that side.
These rules were enough to make the sand form simple hill shapes. All of the cores bash on the same shared memory array; rather than use locks or synchronization I just had each core start in a different column of the screen and all move left to right by columns - in theory there should be enough separation that they'd never conflict.
However - and this is the part I thought interesting to post about - somehow after a few seconds or minutes the 7 cores would catch up with each other and start running in lockstep (effectively reducing the speed of the simulation to equivalent of 1 core).
Barring a bug that was simply crashing cores, what I think was happening was that not every control flow path took the same number of cycles, so a core processing a column with a complex sand pattern might slow down and allow another core to catch up to it. Once two cores were operating on exactly the same data, they'd be doing the same deterministic logic on the same inputs and writing out the same result, effectively just duplicating the work in lockstep.
I wasted hours on these types of games back in the flash era, people were constantly releasing new ones with more types of sand and various effects and combinations, its a shame that whole segment of internet history was deprecated along with flash, good times.
What's the performance difference from a pure JavaScript version?
Recently, I made a particle game which originally planned to be implemented with WASM. However, I decided to implement it with pure JS firstly. The result is some surprising that the JS version runs so smoothly that I think a WASM version is not essential any more.
This brings to mind a game that many people here might enjoy once it gets released – Noita: a magical action roguelite where every pixel is physically simulated.
https://store.steampowered.com/app/881100/Noita/
(Disclosure: it's being developed by a bunch of my old co-workers.)
Fun feature: on mobile, if you drop a bunch of lava on a bunch of fireworks, your phone gets hot.
Nice work.
Brings me back some good old memories from this game:
Got tired of all the phalic-volcanoes so I made something nice for you https://sandspiel.club/#2scDpZpyMACGp65FrkPT
This very strongly reminds me of a game called "Hydroxis" (or at least I think so) for the Amiga. You started with water pooling in some cavity in an otherwise static level and had to move it to a target location by means of enabling and disabling some blocking segments in the level. That was fun!
I had remembered that one a decade or so ago and it turned out to be the single hardest thing I tried to find for my WinUAE collection :-(
Grow some plants. Light a fire. Frantically try to put it out with water and watch helplessly as the plants grow due to water, providing more and more fuel for the growing flames, until you have an unstoppable conflagration on your hands. There must be some moral lesson to learn from this.
Make a lake of oil, set it aflame and then pour water on it. A small amount of water causes the burning oil to flare and spread. A large amount of water extinguishes the fire. Very cool!
I wish fire or lava would make steam out of water, but I love the smoke effect. It was a really nice surprise when the rest of it was so low resolution, great combo.
If you like this game, you might find this project interesting:
http://tinlizzie.org/~ohshima/shadama2/live2017/
http://tinlizzie.org/~ohshima/shadama2/
It's a bit similar, but uses GPU and spawns millions of particles. On the other hand, it's less of a sandbox and more of a demo. You can write your own code in the browser too, but it's a bit tricky to program, because it compiles to shader language and it has some weird limitations.
This is awesome! A few years ago I built a more rudimentary version of a falling sand game with just Javascript and WebGL: http://ericleong.me/sand.js/
I tried to embed the "scripting" language as a texture in WebGL to keep the implementation very fast (note that every pixel is a cell), but I think I worked myself into a corner.
Source code here: https://github.com/ericleong/sand.js
Any source code for this? I'm learning rust right now and it would be really cool to see how this was made
Once I realized that pausing the FSG was a thing...
This is a perfect example of why I'm still in Chrome. At least for me this runs at 60fps in Chrome on my Mac but 30-45 in Firefox. I see this often in animated sites.
Thousands of particles and the worst frame rate I saw on my iPhone 6 was 25fps. Impressive.
Not seeing vaporizing water when lava was put into it was a bit of a bummer, otherwise it's great
Love the performance, no trouble with 60fps. The swirly wind, fire, and smoke effects are beautiful! It’s also the only part here with which I would not know how to get started building, could anyone share their thoughts on the implementation?
This feels wayyy smoother than I remember this game being.
A question to the creator: is the fungus growing respecting the rules of Conway's Game of Life? It seems very much like that. Very nice app!
My current map set up, paused. https://imgur.com/71p1H8W
Holy shit, I remember playing something very similar to this for hours on end in the early 90s as a kid; it might have even been an early version of the powder toy (another user mentioned it), not entirely sure, but regardless this thread is making me go back down memory lane and now I'd love to get into the insides of a game like this one and understand how it works!
You can get some interesting effects if you put a grid of one-pixel cloners, make them clone gas and put some lava at the bottom.
Literally unplayable, exploding gas goes through thick solid walls without even damaging the wall.
Awesome game, I love the options :)
There's an off by one error on sides, fire and it's effects can go along the sides.
You can create a little self-sustaining motion with a cloner covered in something that falls over a lake of acid.
This is great. I'm almost tempted to redo this with believable thermodynamics.
Working in Safari on iOS 12
Reminds me of The Powder Toy, which is great by the way, lots of fun!
Drop oil on lava.
The effect is worth it.
I remember watching Confetti Factory on After Dark, which I think of as a primitive precursor to this. Must have been very early 1990s. Any earlier examples?
I love fungus. It makes the plant grow. Pour some acid on it, it will regrow! On the other hand, fire is pretty destructive.
You know what feature I miss? Fast-forwarding!
Does this game have any objective? I didn't get it.
This was mesmerizing. Well done, thoroughly enjoyed it.
Wind effect is beautiful and looks like a Julia set.
Really liked lava and fire. I don’t know why gravity doesn’t affect the blue stuff. Can you disable page swipe gestures on mobile chrome?
I've always been fascinated by these simulations. Can anybody give a rough overview of how these (I guess?) fluid simulations work?
Great ! Was just looking for something like this for a snow effect. I used to do something with falling snow on text for Christmas.
It's weird, but I can't share the link on Twitter, and goo.gl shortlink doesn't work either.
Does anyone have the same problem?
Weird, I was just looking at this today. Very cool project! I have a feature idea on my stack of ideas I hope to get to
Site is got down of big HN hug I guess
This is excellent fun. I'm kind of curious though as to why blowing wind at the dust ignites it?
The smoke and explosion effects are amazing, better than any other FSG I've tried. Very cool.
I had fun with this. Great effects. Lava, lol.
I got a lot going, 25fps Samsung Note 8, Power Saving Mode
32 fps Performance Mode
Will activating WebRender improve framerates?
Not that it needs improving anyway... just curious.
Fun little game! 42FPS on my iPhone X, too. And best of all no excessive heat
Lava cannot melt ice? :D
Ice can hold lava?
btw, adding oil over lava produces a very cool smoke effect.
This is incredible. Runs flawlessly and surprisingly smooth
Reminds me of Clonk!
I get 1-2 FPS running this in Chrome on macOS Mojave.
Lava should make water turn to gas and blow up!
I like the smoke when you burn the fungus.
This is fun
nothing happens on mobile
Fun, but a bit blurry.
create some plants, and drop some seed on it
This is fun!
Is it really a "game" if there's no goal or "win" condition? Or is it a "webtoy" or "simulation" (or... "sandbox". Think it's a sandbox).
https://sandspiel.club/#A6xPmAP4TSEpcwThAFSB
erase the thingy to the right, and the planets on the left grow upwards again.
I've never played Powder Toy, but I do remember playing something called Powder Game. Are they related in some way?
This is the most satisfying thing I've ever seen on HN!
Wow! This thread brings back some fond memories. Long ago, I came across a tiny Java applet linked on Fark to a Japanese forum post. Everyone loved it but I found it annoyingly small. It was barely 300px x 400px. I had been coding my senior thesis in Java and had recently learned how to use a Java decompiler.
So I downloaded the applet, decompiled it, spent a few minutes figuring out exactly where the dimensions were setup, changed them to 960x640, compiled it all, and hosted it on my site: http://chir.ag/stuff/sand/
I'm always apprehensive about taking any credit for the Falling Sand Game because I DID NOT make it but I'm always glad to see it in the wild. First it was Fark, then a few months later Digg, then Reddit. At one point someone created a Wikipedia page linking to the enlarged version I was hosting, then it got deleted as not-notable, then someone wrote a song about FSG, then a hundred different versions of FSG popped up, many non-Java and functioning much better than the applet, then the Wikipedia page came back up.
I've long stopped getting giddy emails from office slackers about how much time they waste on my site but even though I didn't really create this amazing game/toy/zen-garden, I feel lucky to have been a tiny part of the arcane pop-culture movement.