Inspiration

I was looking to get into graphics programming and also had interests in astrophysics so I decided to build this

What it does

Simulates around 1200 bodies using different positions, velocities and masses. Right now it simulates a galaxy with black hole at center and stars revolve around it

How I built it

I built it using c because it's a simple language and for graphics I used raylib as I already had used it before in a hackathon

Challenges I ran into

Not using a good numerical integrator caused the system to not conserve the total energy and it ruined the simulation. It took some time to learn about the numerical integrators and use a good one for good approximations

Accomplishments that I'm proud of

What I learned

  • How Differential Equations can be approximated using numerical methods
  • Use of Raylib. It's a good graphics library and you can build a lot of things using it ## What's next for N Body Simulator
  • Right now simulating around 1500 bodies is what this can do. Going above drops the fps to around 10-20.
  • Next, I want to do this simulations using quadtrees which can reduce the complexity considerably.

Built With

Share this project:

Updates