2D N-Body Simulation in C++ (v5: 30,000 bodies!) @s0lly
2D N-Body Simulation in C++ (v5: 30,000 bodies!)  @s0lly
Uploaded May 2019 | Updated September 2026, 2 hours ago
This engine allows the user to input thousands of objects and watch an n-body physics display occur. This simulation has 30,000 bodies and runs at about 80-100ms (lower end without running video capture).

This iteration uses higher levels of quad-tree optimisation (at the cost of accuracy). I've sped up the video by 4x for YouTube - but you can get the source code at my GibHub if you'd like to try it out youself: github.com/s0lly/NBody-Physics

Please let me know how I could improve this!


Acknowledgements:

This was made using the Chili Framework: http://wiki.planetchili.net/index.php... - thanks Chili!

Music by Eric Skiff, song "All of Us" for the intro and "Arpanauts" for the main sequence. (Available at EricSkiff.com/music)
2D N-Body Simulation in C++ (v5: 30,000 bodies!)OpenGL Engine - Showcase 10: To OrbitFirst Games in C++: Dungeons and Flagons (v0.89) - Pause Menu / Simple Saving & LoadingAI Steering Behaviour Visualisation v7: Swarm BehaviourSimple 2D Game Engine in C++: Draft 3 - Advanced Player Movement2D Game Engine in C++: [8] 2D Normal Maps2D Game Engine in C++: [5] Alpha BlendingFirst Games in C++ - PacMan! (First Draft)Creating a Positioning System in Racing Games (as used in Krazy Karts)Raytracing in Excel - Using the GPU!AI Steering Behaviours (v8: Toggle Behaviours)Game Engine 14: Atmospheric Scattering
s0lly |

2D N-Body Simulation in C++ (v5: 30,000 bodies!)

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER