SkillAgentSearch skills...

OrbitSim

An N-body orbit simulator, optimised with the Barnes-Hut treecode algorithm.

Install / Use

/learn @ron0studios/OrbitSim
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

OrbitSim

An N-body multithreaded orbit simulator, optimised with the Barnes-Hut treecode algorithm.

Building

cmake -B build
cmake --build build
./build/src/OrbitSim

in action


image

A spiral galaxy rendered with 100k particles at 10fps on a laptop. notice the bar in the middle, similar to the milky way.

image

The GUI

https://github.com/ron0studios/OrbitSim/assets/47331292/332809cd-ecd0-485e-b7a7-b80431de3c14

3 smaller (10k) galaxies colliding

image

an elliptical galaxy generated from the result of the previous galaxy merge

https://github.com/ron0studios/OrbitSim/assets/47331292/e0dd1de7-8974-4398-ad0a-a6325d75f1fe

100k particles spread across 10^8 metres zoom-out

image

those 100k particles eventually cluster and form something similar to the cosmic web

image

QuadTree visualisation with 10k asteroid ring (no central planet)

details


  • capable of loading up to and over 100k particles without a GPU
  • fairly accurate (can create stable orbits)
  • capable of creating spirals (almost) and barred galaxies
  • particles are rendered as pixel values instead of polygons for efficiency
  • multithreading support for updating forces
  • A very efficient implementation of the barnes-hut treecode algorithm
    • the tree is generated with iteratively (recursion is slower and more memory intensive)
    • the tree is stored linearly in an array (faster access, less pointer access)
    • the tree nodes only save one pointer and 2-3 doubles for better performance
View on GitHub
GitHub Stars6
CategoryDevelopment
Updated2mo ago
Forks0

Languages

C++

Security Score

85/100

Audited on Jan 14, 2026

No findings