A simple interactive water simulation game built with Python and Pygame, featuring cellular automaton physics.
- Interactive Water Spawning: Left-click and drag to spray water particles
- Gravity Physics: Water falls down realistically with momentum
- Lateral Flow: Water spreads sideways when it hits obstacles
- Obstacle Drawing: Right-click to draw solid walls and platforms
- Clear Function: Reset the simulation with a keypress
- Make sure you have Python 3.7+ installed
- The virtual environment and dependencies are already set up in the
venvfolder
If you need to reinstall dependencies:
python3 -m venv venv
./venv/bin/pip install -r requirements.txtRun the simulation using the provided script:
./run.shOr run directly:
./venv/bin/python main.py- Left Mouse Button: Spawn water (hold and drag for continuous spray)
- Right Mouse Button: Draw solid obstacles/walls
- SPACE or C: Clear all water and obstacles
- ESC: Quit the application
This simulation uses a cellular automaton approach where the screen is divided into a grid of cells. Each cell can be:
- Empty (air)
- Water (blue liquid particles)
- Solid (gray obstacles)
The water physics includes:
- Gravity: water falls downward
- Momentum: falling water maintains horizontal velocity
- Lateral spreading: water flows sideways when blocked
- Natural flow dynamics
- Grid Size: 100x80 cells
- Cell Size: 10 pixels
- Window Size: 1000x800 pixels
- Target FPS: 60
- Physics Updates: Every frame
Enjoy experimenting with fluid dynamics!