Update: v0.7


This update features the ability to spawn pre-made conglomerate bodies (such as a planet). I also enabled the ability to download older versions of the simulator on the downloads page. The changelog is listed below.

v0.7 Changes

  • Compute Shaders. Using compute shaders, the simulation is now capable of handling over 5000 particles in the scene. Performance is best when no particles are in direct contact, and many times more can be handled if this is the case. The compute shaders currently use a brute force O(n^2) time complexity algorithm (what is this?). This brute force approach is the most accurate, but also the most resource intensive. However, even with this naïve approach, the main FPS-bottleneck is actually particle contact interactions, not the gravity calculations.
  • Updated UI. The user interface now features total particle count and mass readouts, as well as separate sections for adjusting settings related to spawning particles via the Click 'N' Drag and Spawn Field methods.
  • Object Types. By using the new drop-down menu, it is now possible to select pre-made conglomerations of particles to spawn. These only work with the Click 'N' Drag method. Be careful, some object types only work properly within certain mass values.
  • Custom Spawn Fields. It is now possible to customize the number of particles, the range of masses, and the range of speeds of those particles within a spawn field prior to spawning. Note: particles are assigned a random value from -SPEED to SPEED in both their X and Y velocity vector components. This results in an actual velocity magnitude of ±SPEED√(2) (more on vector magnitude).
  • Speed of Light. With the defining of a speed of light comes a plethora of potential strange near-speed of light interactions and behaviors. Currently, however, the only effect is the existence of the Schwarzschild Radius. This means that once a particle exceeds a certain mass, it will be spawned as a black hole. Note: you can also force the spawning of a black hole via the aforementioned object types drop-down menu.
  • Barnes-Hut Algorithm. This algorithm treats groups of far-away particles as a single body, reducing the time complexity of computations from a brute force O(n^2) to O(nlogn) (more on time complexities). This algorithm is not used by default in the simulator at this time.
  • Toggleable Computation. Press J to toggle the compute shaders (on by default), and H to toggle between Barnes-Hut (on by default) or brute force (off by default). There are two categories of computation, GPU and CPU. The compute shaders utilize the GPU, while the other two use the CPU. These two categories are mutually exclusive (i.e. you cannot use compute shaders and the Barnes-Hut algorithm). I may change this at a later date.

Files

Gravity Simulator v0.7.zip 18 MB
May 01, 2021

Get n-Body Gravity Simulator

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.