A real-time interactive particle simulation inspired by the classic Falling Sand games β now supercharged with Numba-accelerated physics, multi-type sand, water interaction, and melting snow. Built with Python, NumPy, and PyQtGraph for smooth 60 FPS performance.
Watch sand sink in water.
See snow melt on contact.
Draw with 4 sand colors, metal, water, or erase.
Optimized with@njitβ runs fast even on large grids.
This is a cellular automaton that simulates how different materials behave under gravity and interaction:
- Sand falls straight down, spreads sideways, and sinks in water.
- Water flows horizontally and downward.
- Snow floats gently, then melts into water when touching it.
- Metal is static β perfect for building containers.
- 4 sand types: classic, orange, red, brown β for artistic expression.
All logic runs in compiled Numba kernels β no Python overhead during simulation steps.
- Real-time drawing with mouse (brush + line tool)
- Sand-water interaction (sand displaces water!)
- Snow melts on contact with water
- Adjustable simulation speed (slider from slow to ultra-fast)
- Random "rain" of colored sand & snow for ambient effects
- Efficient memory layout (
uint8grid + RGB LUT) - Cross-platform (Windows, macOS, Linux)
| Component | Technology |
|---|---|
| Core Logic | NumPy + Numba (@njit) |
| Physics Engine | Custom cellular automaton |
| GUI & Rendering | PyQtGraph (OpenGL-backed) |
| UI Framework | PyQt6 / PySide6 |
| Language | Python 3.9+ |
Numba JIT-compilation makes the inner loop ~50x faster than pure Python.