By Tim King · Updated
Falling Sand Game
Pour Sand, Water and Walls in Your Browser
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Falling Sand works
This falling sand game simulates sand, water and more. Press Play, then click and drag on the canvas to pour. Sand piles up into slopes, water spreads flat and finds its level, and walls hold both back until you erase them. Choose the material and the brush size in the rail, shrink the grain size for a finer simulation, and go fullscreen to give yourself more room.
Falling sand game: getting a good result
The falling sand game is a cellular automaton that people play rather than watch. Every cell of the grid is empty, sand, water or wall, and once a frame each grain checks the cells around it and moves by a few simple rules. Sand falls straight down if it can, otherwise diagonally down-left or down-right, and if neither is free it stays put. That single rule produces the slopes at a natural angle of repose that you see when you pour a pile. Water follows the same falling rule and then adds one more: if it cannot fall it slides sideways, which is why it spreads out and levels off. Sand is heavier than water, so a sand grain landing on water sinks through it and the water is displaced upward.
Painting. The material menu chooses what the mouse pours. Sand and water are placed at half density inside the brush circle so a pour looks like a stream rather than a solid block; wall and eraser fill the circle completely. Brush size is the radius of the circle in grains. Build a wall with a gap, pour sand above it and watch it funnel through like an hourglass, or fill a bowl with water and drop sand in.
Grain size. The canvas is divided into cells of the chosen pixel size. Smaller grains give a finer, slower simulation with more of them; larger grains are faster and chunkier. Changing grain size clears the canvas because the grid has to be rebuilt. Resizing the window or going fullscreen does the same.
Order of update. Grains are processed from the bottom row upward so that a grain can fall into a cell that was vacated this frame, and the scan direction across each row is chosen at random every frame so that slopes do not lean systematically one way. These two details are most of what separates a convincing sand simulation from a lumpy one.
Where it comes from. Falling sand games appeared as Java applets in the mid-2000s and spawned a long line of "powder games" with dozens of elements — fire, oil, plants, acid. This tool keeps the original three plus an eraser because the interesting behaviour is all in how sand and water interact, and those are the ones people look for.
FAQ
Why does nothing happen when I press Play?
Because the canvas starts empty. Click and drag on it to pour the selected material; sand falls from wherever you draw it. The status line under the canvas reminds you of this after Play starts.
Can I add fire, oil or other elements?
Not in this version. Sand, water and wall cover the falling and flowing behaviour that people come for. Additional elements each need their own rules and interactions, and the tool is deliberately kept to the original set.
Why does water sometimes leave a gap under sand?
Sand sinks through water one cell per frame by swapping places with it, so a heavy pour of sand onto water can trap pockets briefly before they work their way up. It settles within a few frames; a smaller brush or a finer grain size makes it less noticeable.
Does Save PNG keep the picture?
Yes. Save PNG writes the canvas at its current size, so a fullscreen scene saves at full resolution. Pause first if you want to catch a particular moment mid-pour.
See also: all Simulations & Screensavers tools, Images, Audio, Video & Screen, PDF, SVG, Generative Art, Chart Makers, 3D Model Viewers, Drawing Pads, Mockups & 3D Making, Diagram Makers, 3D Science, Tracker Music.
Related tools
Game Of Life
Conway's cellular automaton with cell size, density and speed sliders.
Langton's Ant
Two-rule ant that builds chaos and then a highway; sliders and fullscreen.
Lava Lamp
Blobs that rise, merge and split; four colours, fullscreen.
Double Pendulum
Chaotic two-rod pendulum with a traced path; angle, length and speed sliders.
Domino Run Simulator
Lay a line of dominoes, press Topple and watch the chain reaction.