Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Falling Sand Lab

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.


🌍 What Is This?

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.


πŸš€ Features

  • 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 (uint8 grid + RGB LUT)
  • Cross-platform (Windows, macOS, Linux)

πŸ› οΈ Tech Stack

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages