A modern C++ physics engine library and simulation sandbox focused on learning, experimentation, and long-term evolution toward an industry-grade solution.
phynity/
├── src/ Engine library (the physics engine itself)
│ ├── core/ Math, physics, jobs, serialization, diagnostics
│ ├── platform/ Threading and OS abstractions
│ └── render/ Optional visualization (ImGui/GLFW/OpenGL)
├── sandbox/ Interactive sandbox application with debug UI
├── tests/ Unit and validation tests
├── cmake/ Build helpers and install config
└── tools/ Dev scripts (format, build, run, etc.)
The engine (src/) is a standalone library. The sandbox (sandbox/) is a
separate executable that consumes the library for manual testing and demos.
- Use modern C++ (C++20+) and modern CMake
- Explore physics simulation and numerical methods
- Learn concurrency and parallel programming
- Maintain clean architecture and production-quality practices
- Support interactive experimentation and visualization
- Game-specific features
- Asset pipelines
- Full real-time rendering engine
This project uses CMake and vcpkg (manifest mode).
cmake --preset debug
cmake --build --preset debugAfter building, install the library:
cmake --install build/release --prefix /path/to/installThen in your own CMake project:
find_package(phynity 0.1 REQUIRED)
target_link_libraries(my_app PRIVATE phynity::phynity)#include <core/math/vectors/vec3.hpp>
#include <core/physics/particles/particle_system.hpp>
#include <platform/threading.hpp>This project uses clang-format 18 for code style consistency across all platforms.
First-time setup (enable pre-commit hook):
git config core.hooksPath .githooksThe pre-commit hook automatically formats staged C++ files before each commit, ensuring consistent formatting. To bypass temporarily: git commit --no-verify
Manual formatting:
# Format all code
./tools/format.sh # Linux/macOS
.\tools\format.bat # Windows
# Check formatting without modifying
./tools/format.sh --check
.\tools\format.bat --checkInstalling clang-format 18:
# Linux (Ubuntu/Debian)
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install clang-format-18
# Windows (via LLVM installer)
# Download from: https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.8
# Or use winget: winget install LLVM.LLVM
# macOS
brew install llvm@18This project uses clang-tidy for local static analysis and in CI.
# Run the same style of static analysis used by CI
./tools/static_analysis.sh # Linux/macOS
.\tools\static_analysis.bat # Windows
# Choose a different preset if needed
./tools/static_analysis.sh debug
.\tools\static_analysis.bat debugThe script configures the selected CMake preset, ensures compile_commands.json exists, and runs clang-tidy over src, sandbox and tests (*.cpp, *.hpp, *.h) using the repository's .clang-tidy settings.
The sandbox application provides an interactive windowed environment for visualizing and debugging physics simulations.
- Dear ImGui — immediate-mode debug UI
- GLFW — cross-platform window management and input
- OpenGL 3.3 — wireframe rendering
All installed via vcpkg. To build without the render module (e.g., for CI or
headless environments), set -DPHYNITY_BUILD_RENDER=OFF.
# Interactive windowed mode (default)
./build/release/phynity_sandbox
# Headless console mode (runs all scenarios and prints diagnostics)
./build/release/phynity_sandbox --headless| Key | Action |
|---|---|
| F1 | Toggle help overlay |
| F2 | Toggle ImGui demo window |
| F3 | Toggle debug HUD |
| Space | Play / Pause simulation |
| Left Arrow | Step backward (when paused) |
| Right Arrow | Step forward (when paused) |
[ / ] |
Decrease / Increase speed |
| Left Drag | Orbit camera |
| Right Drag | Pan camera |
| Scroll | Zoom camera |
| Home | Reset camera |
| Left Click | Select body (opens inspector) |