Portfolio entry: particle-sim

home | portfolio | git | blog | rss feed

Source code

Project overview

particle-sim is a configurable particle life simulator that displays emergent behavior from a simple set of rules and equations. It is implemented using zig, raylib, and Dear imgui. The particles are stored within an arraylist, which is then used to build a quad-tree that is used to efficiently search for particles to apply forces to (as opposed to a nested loop). For more information on how I went about optimizing the simulation, see this post.

> Screenshots
particle-sim screenshot
The configuration window

particle-sim screenshot
A neat pattern I made

particle-sim screenshot
A simple example of the program running

Future plans

I am currently working on building to wasm. This way, I will eventually be able to display the project on this web page for easy access. Additionally, I plan to overhaul the save and load features to use .zon instead of .csv. This decision is mostly driven by the fact that zig has amazing builtin features for reading and writing from .zon, since it is used for zig build dependencies. On the topic of configuration, I also plan to add a few more configuration options. These options include:

I also want to add emergent sound to the simulation, so I will need to do some research on working with sounds in raylib and automatically generating sound from any given state of the simulation. Finally, I want to add the option to interact with the particles using the mouse. I want the mouse to essentially be treated as a super-strong particle, so that it can actually affect surrounding particles with some actual force.