This project was inspired by, and largely came from, this tutorial by Hunar Ahmad. The main difference in my implementation is that, for reasons I cannot determine, the force values in my simulation need to be a couple orders of magnitude smaller than the values used in the tutorial. Aside from that, though, the system is pretty much the same.

This project was named N-Body due to there being N number particles all imparting forces on each other. As this document from Princeton puts it

An N-body simulation approximates the motion of particles, often specifically particles that interact with one another through some type of physical forces.

Included are some preset rules that I have found to create interesting patterns and entities.

Note: The following simulation may be resource intensive.

For best results, please try this on a desktop



Preview for the Squid preset

Forms a yellow squiggle that races about leaving a trail of black and blue.

Soot Sprite

Preview for the Soot Sprite preset

Forms a green squiggle that races about leaving a trail of black. May also form either glow flies (yellow orbs with white "wings"), or glow worms (yellow squiggles).
May take one or two position resets for the soot sprite to form.


Preview for the Kiwi preset

My personal favorite, this amazing set of parameters produces a shape resembling a kiwi bird's head. The head will move around the screen, being pulled towards green particles. This requires all of the red particles to come together. I'll admit to watching it for way longer than is reasonable.
It can deteriorate if either the "nose" gets ripped from the "head", or if it gets caught in the corner for too long.


Preview for the Tick preset

This configuration causes reds and cyans to form a tick-like entity that races around the screen.