A C version of a 3D version of a particle life simulation. (Still *very* much a WIP)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Gaeel Bradshaw-Rodriguez c9af29e991 PARTICLES! 5 months ago
cglm @ 2bf576c2cd Adds cglm to project 6 months ago
glfw @ 0a49ef0a00 Adds GLFW@3.3.2 6 months ago
res PARTICLES! 5 months ago
src PARTICLES! 5 months ago
stb @ f54acd4e13 Adds stb 6 months ago
.gitignore Empty C project 6 months ago
.gitmodules Adds cglm to project 6 months ago
CMakeLists.txt Fix mixed indentations (use spaces everywhere) 6 months ago
readme.md Fix typo in readme.md 6 months ago



A C version of a 3D version of a particle life simulation. (Still very much a WIP)

I made a 3D particle life system based on Jeffrey Ventrella’s “Clusters” idea. And I built it with Unity3D.
Unity3D is a lovely program to use to make games, simulations, and graphical toys, it’s responsible for a large part of my professional and hobby activity. It has lowered the barrier to entry for realtime graphics and game programming to unprecedented levels.
The original implementation of this project took me around two and a half hours, including talking to the people who tuned in to watch, and some time spent staring at some of the results.
You can watch a replay of me doing so here: Replay on YouTube
Or alternately, watch a clip where I marvel at one of the organisms that the program generated: “A real treat” on YouTube

All that said though, Unity3D is a big program, and the default data model is very hierarchical, which is great in some circumstances, but is poorly optimised for running simulations on big collections of identically-structured elements. Unity has recently introduced a bunch of tools enabling users to use a “Data-Oriented Tech Stack”, including an “Entity Component Systems” model. This allows Unity3D to generate code that compiles down to simple for loops over tightly packed data. There’s also the “burst compiler” that further optimises this model by parallelising these tasks and spreading them over multiple threads.
I started learning how to use this, but it wasn’t fun. Trying to properly structure data and use a weird API is not what I enjoy about Unity3D, and in this case, the entire program is just a big for loop that munches on some simple data, and then map that to a bunch of quads with a shader slapped on.

A big for loop on simple data...
You know, the kind of thing C is good at.
A bunch of quads with a shader slapped on...
You know, the kind of thing OpenGL is good at.

So here I am, spending hours and days, re-learning C and OpenGL, and it’s a nice and fun way to spend my time in confinement...
It’s sunny outside, my cat is being an asshole, the town is quiet, and I’m learning C and OpenGL again ❤️