I have found many interesting things to simulate:

  • Gravity – Objects enter a solar system and orbit a central and considerably more massive object (e.g. a star). Some of the objects travel too fast or are too far from the central mass and therefore leave the system. Other objects travel too slowly or are too near to the central mass and therefore collide with it. In both cases the small mass is destroyed and relaunched at a random velocity from a random point within the bounds of the system. The simulation draws tracks to show the motion of the masses and after a few minutes the system settles so clear orbits are visible. All objects are treated as point masses and the appropriate inverse square law is applied.
  • Boids – Applies three simple rules to generate behaviour which mimics the flight of real birds.
  • Check Point – A simple AI that travels toward the target avoiding obstacles and then loops around the target.
  • Particles – The original simulator, that calculates the interactions of simple charged particles.

All the simulations have been programmed in C++ and use SFML. In the future I hope to create a 3D gravity simulator as an entry point to learning how to use the Ogre3D library, and to provide a useful base for more complex simulations with large planetary bodies. It would also be interesting to calculate planetary environmental conditions and allow the user to walk on planets, observing sunrises and sunsets and the movement of other planetary bodies. Binary star systems and moons would also be very interesting.

Up-to-date Loci implementation available in Loci Compiler Tools repository; there’s also an old C++ implementation here. Here’s a screenshot of the gravity simulator:

Gravity Simulator Screenshot

Gravity Simulator Screenshot