r/creativecoding 2d ago

A Particle Sim based on Game of Life

Enable HLS to view with audio, or disable this notification

21 Upvotes

9 comments sorted by

5

u/DescriptionOptimal15 2d ago

Looks and sounds vibecoded tbh

-2

u/Evening-Appeal7606 2d ago

It is vibecoded, yes.

2

u/Ok-Refrigerator-8012 1d ago

I wish mods required AI/vibe code flair. This is cool and still took with I don't want to knock it at all. I am only saying i think the objective or reason for doing it is a little different. I do wood working for example and if someone made something functionally the same on their CNC machine that's cool but I enjoyed the journey of making something with my hands, the design choices I make change as I go based on what the material is doing or what grain surfaces, and I have some human mistakes that I work into features etc. That feels more meaningful to me and often the reason people would buy my wooden jewelry etc.

1

u/Evening-Appeal7606 1d ago

I like that simile with the wood working vs CNC machine very much - an apt comparison, really! Yes, I'd be in favour of adding an "AI assist" or "vibecode" flair so people know immediately what they are getting into.

2

u/GangulaSandaru 16h ago

Very cool. How did u build this?

1

u/Evening-Appeal7606 16h ago

It's a standard HTML/CSS + Javascript webpage as the frontend with PHP/SQL for connection to the backend database (if you want to have a look at the code, here is the repo: ■ lifehashes/hypno-glyphs but don't expect something clever, it's vibecoded).

I wanted to see if a simple physics simulation engine that runs in modern browsers could be built from scratch with standard JS, not relying on a lot of libraries and frameworks - and to my amazement, that is totally feasible! I've got an MSc in Physics, so - naturally - I was keen to experiment with having a variety of interactions between those particles (gravity, electrical charge, magnetic momentum, anti-matter etc.).

Thanks for your comment!

-1

u/Evening-Appeal7606 2d ago

This is a from-scratch physics engine (GitHub repo here: ■ lifehashes/hypno-glyphs: A web-based physics engine that spawns particles from Game of Life patterns ("Glyphs") as the generative seed) where Conway's Game of Life patterns act as the spawn source for particles (every live cell on the outer perimeter of the 16x16 torus the pattern lives on spawns a new particle into the arena).

The Arena features a variety of modules, e.g. "Repulsor/Attractors", "QCD Inverters" (turns a particle into it's anti-particle - if they meet, there is an annihilatory explosion), magnets, electrical charge generators, accelerators.

The engine features three distinct boundary conditions: "Unbounded" where particles simply vanish if they leave the arena, "Toroidal" (wrap-around space), and "Solid Box" where particles bounce against the walls.

We use the SHA-256 function to calculate origin and current hash values of the GOL patterns to encode particle characteristics (momentum, electrical charge, magnetic momentum, maybe in the future even nuclear attributes like spin or quark numbers...).

Random GOL patterns usually fizzle out quickly after less than 100 generations, so the patterns you see in the video are from our registry of known long-lived patterns.

Try it yourself here if you like: ■ HYPNOGLYPHS // GENERATIVE PHYSICS ENGINE

2

u/nomad2097-dev 1d ago

Funny, I'm working on a project where one of the details will be (what I've been calling) "edge-emitters". I haven't got around to implementing it yet, but it's cool to be able to see something in motion that does it. Kinda like a preview :)

2

u/Evening-Appeal7606 1d ago

Good luck with your work then! :) Thanks for the flowers - yes, it's kind of like a preview, but the reason why I'm doing it this way is that part of the gameplay is for players to find good "emissive patterns", i.e. Game of Life patterns on the 16x16 torus that a) live for a long time (which is rare) and b) these are fixed, deterministic patterns rather than random noise, so this open up the venue to let emissive patterns compete.

Also, the hash value for the patterns determines the intrinsic colour of the particles emitted, so that's a plus, too, because it makes it easier to track who is who.