3D N-body simulator built in C++20. Implements Barnes-Hut octree and direct summation force solvers with OpenMP and Intel TBB parallelization, symplectic leapfrog integration, and real-time OpenGL rendering. Runs everything on the CPU (for now).
10,000 Bodies running at ~160 FPS
Install system dependencies (Fedora/RHEL):
sudo dnf install gcc-c++ cmake ninja-build mesa-libGL-devel libX11-devel libXrandr-devel libXi-devel libXcursor-devel libXinerama-develOr on Debian/Ubuntu:
sudo apt install build-essential cmake libgl-dev libx11-dev libxrandr-dev libxi-dev libxcursor-dev libxinerama-devClone the repo:
git clone --recurse-submodules https://github.com/pants721/lunaRun setup.sh:
cd luna
./setup.shBuild:
./build.shRun LUNA:
# GUI (requires a display)
./build/luna_gui examples/luna_text.json# Headless (no window, no OpenGL required)
./build/luna_headless examples/luna_text.jsonI haven't taken the time to formally measure performance yet, but here are my estimates for FPS at N bodies using TBB Barnes-Hut solver and TBB Leap Frog integrator. I measured these numbers on my PC, which is more performant than average, so the measurements are optimistic.
| N Bodies | FPS |
|---|---|
| <7500 | Max |
| 10,000 | 160 |
| 20,000 | 90 |
| 30,000 | 50 |
| 40,000 | 40 |
| 50,000 | 30 |
| 60,000 | 22 |
| 70,000 | 20 |
| 80,000 | 16 |
| 90,000 | 14 |
| 100,000 | 12 |