2D gravity simulation with 1800 particles

Subscribers:
250
Published on ● Video Link: https://www.youtube.com/watch?v=_mzq0da1dOE



Duration: 5:08
4,743 views
115


Written in C++

I first wrote this 2D gravity simulator in around 2003. Every particle exerts a gravitational force on every other particles. The slightly smaller particles shown here have a vastly smaller mass than the larger ones.

I have just updated the program to be able to take advantage of mutiple cores. In 2003 the program could only manage about 300 particles at once, because every particle gravitationally interacts with every other particle, which results in 44,850 gravity calculations needing to be done every frame. On my new PC using multiple cores it can now deal with over 2000 particles at 60fps. That involves nearly 2 million gravity calculations per frame.