Skip to content

This was a side project I did over the summer because I thought making an N-body simulation sounded pretty cool. Spoiler: It was pretty cool. (I ain't biased!)

License

Notifications You must be signed in to change notification settings

TSKoduru/NBodySimulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

NBody Simulator

A fun physics simulation where you can draw planets and watch them interact!


Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact

About The Project

It all started when I had the bright idea of making a planetary simulation. After doing a bit of research, I came across the n-body problem. The rest was history. Anyhow, this is a basic simulation of n-body physics using a KSK method (Kick, Step, Kick) to model planetary motion. I hope you have fun playing with it!

(back to top)

Built With

  • Python

(back to top)

Getting Started

There's a few libraries that you'll need to get installed before you can start messing around with playlists. To get a local copy up and running follow these simple example steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • pip
     pip install numpy
     pip install pygame

Installation

  1. Clone the repo
    git clone https://github.com/TSKoduru/NBodySimulation.git

(back to top)

Usage

All you'll need to do is run the program, which will lead to a popup containing the simulation. Click and drag to release a new planet; A white line will be drawn containing the trajectory. Planet masses are random, but are fairly similar. Each body will have a trail behind it; As you add more bodies, you'll be able to visualize them interact as their trails distort. Here's an example simulation with 5 bodies:

ExampleSim

  • KEYBINDS:
    • Press 'esc' to exit the simulation.
    • Press 'r' to reset the simulation to 0 bodies.
    • Click and drag to add a new body.

(back to top)

Roadmap

  • Add a system to combine planets; i.e, when they collide, insert a planet with their combined mass
  • Fix bug where two planets that collide head-on get launched off map (This is because as their distance goes to 0, the gravitational force on them goes to infinity.)
  • Add system to allow user to choose planet sizes

Note: I've stopped developing this proejct, so open source contributions are welcome. See the contributions section below.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Teja Koduru - [email protected]

Project Link: https://github.com/TSKoduru/NBodySimulation

(back to top)

About

This was a side project I did over the summer because I thought making an N-body simulation sounded pretty cool. Spoiler: It was pretty cool. (I ain't biased!)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages