A 3D gravitational N-body simulation built with Rust and the Bevy game engine. Simulates gravitational interactions between celestial bodies with real-time visualization and interactive controls.
Stardrift is an experimental side project for personal enjoyment and learning. Development happens in spare time without specific goals or timeline.
This project also serves as an exploration of AI capabilities in software development. Its development involves use of AI assistance.
Note: This is not intended for scientific or research purposes. The project remains experimental and subject to significant changes.
- N-body gravitational physics with Barnes-Hut octree optimization (O(N log N))
- Multiple numerical integrators including symplectic and Runge-Kutta methods
- Real-time 3D visualization with bloom effects, trails, and barycenter tracking
- Interactive camera with pan, orbit, zoom, and touch support
- Cross-platform: Windows, macOS, Linux, and WebAssembly
Download from the releases page:
| Platform | Formats |
|---|---|
| Linux | .tar.gz (x86_64, ARM64) |
| Windows | .zip (x86_64, ARM64) |
| macOS | .dmg, .tar.gz (Intel, Apple Silicon) |
| Web | WebAssembly package |
All packages include SHA256 checksums and build provenance attestations for verification.
# Prerequisites: Rust (https://rustup.rs/) and Git
git clone https://github.com/emilyst/stardrift.git
cd stardrift
# Development build
cargo run -p stardriftFor WebAssembly builds, see the Usage Guide.
# Basic run
stardrift
# Customize body count and seed
stardrift --bodies 150 --seed 42
# Try different color scheme
stardrift --color-scheme viridis
# See all options
stardrift --help| Key/Action | Function |
|---|---|
| Left-drag | Orbit camera |
| Right-drag | Pan camera |
| Mouse Wheel | Zoom in/out |
| Space | Pause/Resume |
| N | New simulation |
| O | Toggle octree visualization |
| C | Toggle barycenter gizmo |
| T | Toggle trails |
| D | Toggle diagnostics HUD |
| S | Take screenshot |
| Escape | Quit |
Touch controls are supported on mobile/tablet devices.
| Document | Description |
|---|---|
| Usage Guide | Controls, CLI options |
| Configuration | Configuration options |
| Integrators | Numerical integration methods |
| Color Schemes | Available color palettes |
| Architecture | Project structure and design |
| Release Process | Version management and builds |
This project is dedicated to the public domain under the CC0 1.0 Universal license. See the LICENSE file for details.
- Built with Bevy game engine
- Camera controls by bevy_panorbit_camera