Pixel pour is a Python program that simulates falling grains of sand for educational purposes.
- Real-time sand simulation with gravity and collision detection using NumPy
- Smooth particle rendering using PyGame
- Cross-platform support on Windows, macOS and Linux
- Interactive sand placement with mouse input
- Real-time display of FPS and total grain count
Before you begin, ensure you have met the following requirements:
- Python 3.12+
- Poetry (for dependency management)
Clone the repository:
git clone https://github.com/sldgr/pixel_pour.git
cd pixel_pour
Install Poetry if you haven't:
pip install poetry
Install the project dependencies:
poetry install
Run the simulation with:
poetry run python -m pixel_pour.main
You can adjust simulation parameters in pixelpour/utils/config.py
:
WIDTH
andHEIGHT
: Set the simulation window sizeFPS
: Target frame rateSAND_DROP_RATE
: Control how quickly new sand is addedGRAVITY
: Adjust the strength of gravityMAX_FALL_SPEED
: Set the terminal velocity for sand grains
Contributions are welcome! To contribute to <project_name>, follow these steps:
- Fork this repository.
- Create a branch:
git checkout -b <branch_name>
. - Make your changes and commit them:
git commit -m '<commit_message>'
- Push to the original branch:
git push origin <project_name>/<location>
- Create the pull request.
Alternatively see the GitHub documentation on creating a pull request.
If you want to contact me you can reach me at cole.d.harding@gmail.com.
This project is open source and available under the MIT License.