A real-time fluid simulation written in Haskell, using Smoothed Particle Hydrodynamics (SPH) for physics modeling. You can interact with the fluid by clicking and dragging the mouseโadjust simulation parameters on the fly for a customizable experience.
Maxim Izyumov
|
Albert Khechoyan
|
Irina Perekrestova
|
|
Computations Optimization
|
Complex Environments
|
Fluid-based Puzzle
|
Clone repository
git clone https://github.com/IzyumovMaxim/FluidSimulation
Execute program
cd FluidSimulation
stack build
stack exec -- sph-fluid -- +RTS -N8 -s -RTS
fluid-simulation/
โโโ src/
โ โโโ assets/
โ โโโ i.png -- Swampy image๐
โ โโโ Physics.hs -- SPH calculations
โ โโโ Types.hs -- Data types
โ โโโ Level.hs -- Game level with fluid-based puzzle
โ โโโ Render.hs -- Gloss visualization
โ โโโ Main.hs -- Entry point
โโโ app.cabal -- Build config
โโโ stack.yaml -- Stack config
Explore different simulation scenarios and our game mode!
-
Game mode control keys:
- 1 - Square fluid simulation
- 2 - Hourglass fluid simulation
- 3 - Ball fluid simulation
- 4 - Windmill simulation
- 5 - Puzzle Level (Where's My Water)
-
Fluid Simulation Controls:
- R - Reset simulation
- Arrow keys - Adjust gravity
- T/G - Mass up/down
- U/J - Stiffness up/down
- I/K - Viscosity up/down
- P/; - Surface tension up/down
- Q/q - Smoothing radius (affects performance)
- W/w - Add/remove particles
- Hold Shift for larger adjustments
- Click and drag to interact with particles
-
Puzzle Game Controls:
- Click - Dig dirt blocks
- R - Reset level
- Goal: Collect all stars and get water to Swampy!
Stage I
- Basic 2D visualisation and modelling;
- One scene with some shape containing the fluid;
- Easily configurable model (via coefficients and kernel functions).
Stage II
- Improved physics (added surface tension);
- Several fluid simulation scenes: sware, circle, hourglass, windmill;
- Added one level of game mode: "Where Is My Water?", as a simple fluid-based puzzle;
- Optimizations enabled:
- Parallel computation (8 cores)
- Vectorized operations
- Optimized spatial grid




