Draw with the mouse to create sand, smoke, fire or water. A cellular automaton simulates gravity, diffusion and combustion in real time. Materials interact — fire ignites wood, water extinguishes fire.
Each cell updates based on its neighbours: sand falls with gravity, smoke rises and diffuses, fire spreads to adjacent combustible cells, water flows and pools.
Select a material (sand, smoke, fire, water, wood) and draw. Watch interactions: fire + wood = smoke, water + fire = steam. Clear to restart.
This type of "falling sand" game was popularised by the 2005 Java applet "Hell of Sand" and inspired commercial games like Noita (2020), which builds entire worlds on pixel-level physics.
This is a "falling-sand" sandbox built on a cellular automaton. The screen is divided into a fine grid where every cell holds a material — sand, water, smoke or fire — or is empty, and on each tick the grid is scanned and each cell follows simple local rules. Sand falls straight down and slides diagonally to pile into natural slopes, water falls and then spreads sideways to find its level, smoke rises and drifts before dissipating, and fire climbs upward, decays and randomly emits smoke. You paint materials directly with the mouse or a finger.
Cellular automata are a foundational idea in computer science and complexity theory: complex, lifelike behaviour emerges from tiny rules applied uniformly across a grid, with no central controller. The same grid-and-rules approach is used to model granular flow in hoppers and avalanches, to create smoke and fluid effects in games, and to study emergent systems like Conway's Game of Life. Updating into a separate buffer ensures every cell "moves" simultaneously, preventing a falling grain from skipping multiple rows in one step.
What is the Magic Sand & Smoke simulation?
It is an interactive falling-sand sandbox where you paint sand, water, smoke or fire and watch them flow, pile, rise and burn according to physics-inspired rules running on a grid called a cellular automaton.
What is a cellular automaton?
A cellular automaton is a grid of cells that each update their state based only on simple local rules and their neighbours. From these tiny rules, complex global patterns emerge — the principle behind this sandbox and famous systems like Conway's Game of Life.
How do I use it?
Pick a material (sand, smoke, fire or water) from the toolbar, set the brush size, then click or touch and drag on the canvas to paint. The Clear button wipes the whole grid so you can start again.
Each grain first tries to fall straight down; if that cell is blocked it tries to slide diagonally into an empty space below. Repeated across many grains, this produces the angled piles and slopes you see in real granular materials.
Water also falls down, but when it cannot it spreads sideways into adjacent empty cells instead of only sliding diagonally. This lets it flow across surfaces and settle into a flat level, just like a real liquid.
Smoke cells move upward each tick with a little random sideways drift, because in reality hot smoke is less dense than the surrounding air. Cells also have a small chance to vanish each step and are cleared at the top, so the plume dissipates.
Fire cells rise, carry a decaying intensity value that eventually burns out, and randomly spawn smoke as they go. This produces flickering flames topped by a trailing column of smoke.
Scanning from the bottom upward, and writing into a separate buffer, ensures a grain cannot move several rows in a single frame and that all cells effectively update at once — giving stable, believable falling behaviour.
Beyond fun sandboxes, the same grid-based rules model granular flow in silos and avalanches, generate smoke and fluid effects in video games, and serve as teaching tools for emergence and complexity.
The genre was popularised by the 2005 Java applet "Hell of Sand" and later inspired the acclaimed 2020 game Noita, in which every pixel of the world is individually simulated.