This is the official repository for the code shown in How to make HUGE N-Body Simulations (N=1,000,000+)
This repository consists of three branches:
-
This is the code shown in the video and is my (mostly) faithful implementation of the original algorithm as described in the Barnes-Hut paper.
-
This modifies the original algorithm by a) storing the nodes in a cache friendly order and b) allowing multiple bodies to inhabit the same leaf node.
-
This is a crude attempt at parallelizing the improved branch to show its potential.
- Install Rust
- Clone the repository
- If you're not on Windows, follow this
- Checkout the desired branch
- Open the folder in a terminal
- Run 'cargo run --release'
- Enjoy
- Scroll to zoom
- Middle mouse button to grab view
- Right mouse button to spawn a body
- To change the mass of the body, wind the mouse around it while holding right click
- Space to pause/continue
- E to open a menu where you can enable the quadtree visualization