No Description

Stephen Downward 4d42622ef4 Options work for collision catalyst 1 week ago
Cout-2.mp4 ad1dd70496 Example simulations 1 week ago
Cout.mp4 ad1dd70496 Example simulations 1 week ago
Makefile e3a7b92e21 Added engine for simulating collision between galaxies 1 week ago 3cfc0dd5e5 Saving/loading 1 week ago
collide.c 4d42622ef4 Options work for collision catalyst 1 week ago
main.c 48336bb589 mass bugfix 1 week ago
qdbmp.c c39da79a69 first commit 1 week ago
qdbmp.h c39da79a69 first commit 1 week ago

C Gravitational Engine

Simulates a large array of stars in a galaxy. The amount is configurable, as well as various other parameters. They start with some angular momentum. It's pretty fast, but it can probably be optimized further.

The engine features full multithreading support when calculating forces.

10 iterations(configurable) are added together for each frame. This allows the paths and velocities of the different stars to be easily seen.


  • Automatic video processing - Export X frames, turn them into a video, delete the frames. Repeat until the simulation is done, and then stick the videos together. At the moment, a long simulation can take hundreds of GB to store all of the images.

  • Allow processing over a distributed set of computers

Sample footage

I have included some simulations that were previously generated using my engine. These took minutes, rather than the hours that would have been required with the python version of the engine, which I wrote the day before.

Cout.mp4 - 1k stars. Already, a clump of stars can be seen easily, and seems to be stable.

Cout-2.mp4 - 10k stars. This is my favourite so far! It is starting to act like a proper galaxy. Near the beginning, 2 galaxies are created by chance. The smaller one gets attracted towards the larger one, and is ripped apart from the gravitaional forces! Before this, the larger galaxy exhibits some properties of a spiral galaxy for a very short time. I believe that adding more stars will make it more stable, as they will be able to come together to form a 'black hole' in the center.