An interactive particle physics sandbox simulator built with JavaScript.
-
Multiple Elements ๐งช: Experiment with various materials including:
- ๐๏ธ Sand: Falls and creates realistic piles
- ๐ง Water: Flows and spreads horizontally
- ๐ข๏ธ Oil: Floats on water and is flammable
- ๐ฅ Fire: Rises and ignites flammable materials
- ๐ฅ Gunpowder: Explodes when ignited
- ๐งช Acid: Dissolves other materials
- ๐งฑ Concrete: Creates solid barriers
- ๐ Lava: Flows slowly and solidifies into stone
- ๐ฑ Seeds: Grow into plants over time
- โ๏ธ Ice: Melts when heated
-
Interactive Controls ๐ฎ:
- Adjustable brush size
- Pause/resume simulation
- Clear canvas
- Mouse wheel support for brush sizing
-
Dynamic Physics โ๏ธ:
- Gravity and fluid dynamics
- Material interactions (fire ignites oil, acid erodes concrete, etc.)
- Temperature effects (ice melting, lava solidifying)
-
Responsive Design ๐ฑ:
- Automatically adapts to different screen sizes
- Modern UI with glass-morphism effects
- Performance metrics display (FPS counter)
- Select an element from the sidebar
- Click and drag on the canvas to place elements
- Use the mouse wheel to adjust brush size
- Experiment with different combinations:
- ๐ง+๐ฅ Pour water onto fire
- ๐งช+๐งฑ Drop acid onto concrete
- ๐ฑ+๐ง Place seeds in water
- ๐ฅ+๐ข๏ธ Ignite oil or gunpowder with fire
SandSim uses a cellular automaton approach to simulate particle physics:
- Each cell in the grid can contain one particle
- Particles have properties like velocity, temperature, and reactivity
- The simulation updates in discrete steps, with each particle following simple rules
- Rendering is optimized for smooth performance on modern browsers
This project is built with vanilla JavaScript and HTML Canvas for rendering. The structure follows a modular approach with:
- Core systems (Grid, Canvas, SimulationLoop)
- Particle types with specific behaviors
- Tool interfaces for user interaction
Inspired by Jason's Falling Sand and other cellular automaton simulations.
MIT