Back to Projects
C++SFMLPhysicsAlgorithms2023

N-Body Gravity Simulator

A high-performance C++ physics simulation that models gravitational interactions between celestial bodies in real-time. Using advanced algorithms and spatial partitioning, the simulator can handle hundreds of particles with accurate gravitational force calculations and realistic collision physics. Built with SFML for graphics rendering and optimized from O(n²) to O(n log n) complexity using quadtree data structures.

RoleProgrammer
Duration1 week
Year2023

N-body gravitational simulation in action

Key Features
  • 01Real-time N-body gravitational force calculations
  • 02Quadtree spatial partitioning for performance optimization
  • 03Accurate collision detection and physics responses
  • 04SFML graphics rendering
  • 05Supports thousands of interacting particles
Tech Stack

Core

C++SFMLCMake

Algorithms

QuadtreeBarnes-HutCollision Detection