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.
I've improved some of the code and the runtime has improved significantly from the prior iteration. It's amazing what taking an unnecessary multiply or divide out of a loop can do!
The codebase can be found here: github.com/s0lly/NBody-Physics - It relies on only a few functions and objects to do all the work, so hopefully it will be quite easy to understand and follow.
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)
This engine allows the user to input thousands of objects and watch an n-body physics display occur.
I've improved some of the code and the runtime has improved significantly from the prior iteration. It's amazing what taking an unnecessary multiply or divide out of a loop can do!
The codebase can be found here: github.com/s0lly/NBody-Physics - It relies on only a few functions and objects to do all the work, so hopefully it will be quite easy to understand and follow.
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 Game Engine in C++: [2] Adding a Camera / Moving Camera and Sprites
This video shows object movement, corrected relative to rotation, alongside camera movement.
Camera rotation and zooming is still lacking - this will be the next task to complete.
I already see a top down racing game from this! Itll need some collision detection sooner rather than later, Id imagine.
I will release all code on GitHub once Ive finalised the engine - and have nice looking code to boot!
Using the Chili Framework: http://wiki.planetchili.net/index.php... - thanks Chili! 2D Game Engine in C++: [2] Adding a Camera / Moving Camera and Sprites](https://i.ytimg.com/vi/I5Xv2AzYeXY/mqdefault.jpg)




