A real-time, particle-based fluid simulation that runs entirely in your terminal. This project implements Smoothed Particle Hydrodynamics (SPH) using Go and tcell for rendering.
- Real-time physics simulation (SPH)
- Multithreaded solver
- Interactive terminal UI
- Mouse and keyboard support
- Customizable physics parameters (gravity, viscosity, density, etc.)
- Preset management
- Wall drawing and erasing
If you have Go installed, you can install the application directly:
go install github.com/null-enjoyer/terminal-fluid-simulation@latestEnsure your GOPATH bin directory is in your system PATH to run the command globally.
-
Clone the repository:
git clone https://github.com/null-enjoyer/terminal-fluid-simulation.git cd terminal-fluid-simulation -
Download dependencies:
go mod tidy
-
Build the binary:
go build -o terminal-fluid-simulation
Run the application with built-in defaults. Note that saving custom presets is disabled in this mode.
terminal-fluid-simulationTo enable saving custom presets and persistence, provide a path to a configuration file.
terminal-fluid-simulation --config settings.jsonIf the specified file (e.g., settings.json) does not exist, the application will automatically generate it with
default values.
--config: Path to the settings JSON file--help: Show help message
| Key | Action |
|---|---|
| Tab | Cycle Mouse Mode (Spawn -> Wall -> Erase) |
| Space | Spawn fluid at cursor position |
| P | Pause / Resume simulation |
| R | Reset (Remove all fluid particles) |
| C | Clear all drawn walls |
| W / S | Navigate menu up / down |
| A / D | Adjust selected menu value |
| Enter | Save current preset (only if config file loaded) |
| Arrow Keys | Move cursor (alternative to mouse) |
| Q | Quit application |
| Esc | Quit application / Cancel text input |
- Left Click: Perform the action of the current mode:
- Spawn Mode: Spawns fluid particles
- Wall Mode: Draws wall
- Erase Mode: Removes wall
When running with the --config <settings-file-path> flag, you can save adjusted parameters via the on-screen menu:
- Select "Save" option
- Type name of preset
- Press Enter
Preset will be saved to specified config file.
