Gravity Simulator - Version 1.3

Download (293KB) Contains current and previous versions of the exe and a Windows screensaver version.

New Features:

  • Improved fragmentation
  • Black holes
  • Much more on-screen information
  • Tweaked simulation parameters
  • Automatic time acceleration and field detail level adjustments
  • Still no meaningful GUI
  • Combat Mode: fly a ship and blow stuff up
Previously New Features:
  • Gridded gravity fields and influence fields, drawn using a rectangle tree for faster full-screen field rendering performance.
  • Discrete multi-level field rendering.
  • Gravity Field Lines rendering.


Watch planets get ripped apart by collisions and tidal forces! The X key toggles this option. Due to the consideration of tidal forces, dust orbiting near a large body can be prevented from clumping into larger planets, meaning you don't get the same multi-planet stable systems you got before.


  • Newtonian gravity calculations
  • Fixed timestep for reproducible simulations
  • Collisions
  • Orbital trails
  • Co-orbital relative position rendering
  • Rudimentary stable orbit detection
  • Gravitational field visualizations


  • Automatic speed adjustment will change the acceleration factor as necessary to keep the framerate between 10 and 20 fps.  If you have gravity visualizations on, it will adjust the level of detail as well.
  • Bullets cause small planets to blow up.
  • Drawing gravity and influence fields is processor intensive. A multi-processor system is recommended if you want to get anything else done while drawing fields.
  • Clicking on a small, fast-moving planet in order to draw relative co-orbital position may take several tries. Keep at it, or use CONTROL+MINUS to slow down the frame rate
  • The difference between =/- and CONTROL =/- is that the former adjusts how many simulation loops are run per rendered frame, whereas the latter controls the clock delay between sim/render cycles. Lowering the clock delay (faster FPS) will not have an effect if the sim/render time is already longer than the clock delay. My system can briefly manage 100+ FPS under ideal circumstances.
  • How to slow down your computer: maximize the program and turn on the influence field with no planet selected. At 1280x1024 resolution, a 1000-planet sim will require more than one billion gravity calculations to draw one frame.
  • Pixel-based gravity field rendering time is largely determined by number of pixels, although number of planets has an effect, so larger windows are slower. Grid-based gravity field rendering time is determined by number of planets (larger than dust) and render depth. The easiest way to understand the gridded rendering adjustments is to turn wireframe mode on.
  • Changing gridded gravity field and field line ranks is only visible when a planet is selected.
  • Stability score is calculated as stable planets per second.
  • The title bar shows the following information: Sim number; Stable planets/planets alive/planets at start; Stability score; Number of trails rendered (if enabled); Frame rate; and eccentricity x100 of five planets.

Click here to see more screenshots.


 Control  Function
 Left Click  Start a new simulation
 Left Click & Drag  Reposition entire simulation
 Right Click (on a planet)  Select a planet
 Right Click (away from a planet)  Un-select a planet
 Middle Click  Toggle planet trail rendering
 = / -  Speed up / slow down the sim
 Shift + =/-  Jump between slowest/normal/fastest sim speeds
 Control + =/-  Increase/decrease delay between frames (attempted frame rate), from 1 to 1000 (don't hold your breath) FPS
 Shift+Control+=/-  Jump between 1 / 31 / 1000 (cough) FPS
 0 (Zero) Toggle automatic speed adjustment
 [  Increase gridded influence field color variation sensitivity (draws smoother colors, slower)
 ]  Decrease gridded influence field color variation sensitivity (draws choppier colors, faster)
 { (Shift+[ )  Decrease gridded gravity field and field line ranks
 } (Shift+] )  Increase gridded gravity field and field line ranks
 , (Comma)  Decrease minimum gridded render depth (faster)
 . (Period)  Increase minimum gridded render depth (slower)
 < (Shift+Comma)  Decrease maximum gridded render depth (faster)
 > (Shift+Period)  Increase maximum gridded render depth (slower)
 S  Select a numbered simulation. The sim # is used as a seed to randomly generate all parameters
 H  Show high scores, i.e. 10 longest-running sims
 I  Show gravitational influence gradient field
 G  Show area of majority gravitational attraction
 L  Show gravitational field lines for selected planet
 F  Switch between per-pixel (slow) and "gridded" (faster) gravity field rendering
 C  Allows you to right-click on a second co-orbital planet to show its orbit relative to an already-selected planet
 R  Alternates the reference frame between stationary and rotating while drawing relative orbits
 X  Toggle fracture mode (tidal forces and collisions ripping planets apart) on/off
 D Toggle per-frame updates (controls whether you see trails in time acceleration)
 Arrow Keys  Accelerate, decelerate, or turn the selected planet
 A Toggle Combat Mode. Click in the window to place a ship
 Arrow Keys (Combat Mode) Turn/Thrust ship
 Ctrl+Arrow Keys (Combat Mode) Align ship prograde/retrograde/right 90 degrees/left 90 degrees
(Combat Mode)
 Fire a bullet
 Esc  Closes the program


This software is provided 'as-is', with no warranty or guarantee of any kind.


This software is freeware.

David Belland,
Jul 17, 2009, 3:33 PM