I'll just say that this looks insanely good, wow.
I've just built a boid simulation in Go and WebGPU. 16k boids are no problem on my M1 Mac Pro. I did not implement any optimization yet.
Awesome work, the green terminal style is really cool. And the fact that it's just Vanilla JavaScript, HTML & CSS is a pretty cool touch. I would've produced something a tenth the style with 10x the complexity
Just some ideas/suggestions: - Better colors: maybe genes can influence colors a bit? The random colors aren't that great, they're good though for making all the boids distinct. - Zooming: Scroll the mousewheel to Zoom In/Out, drag to move around - Interactive: Click on a Boid, have it be followed around using zoom! - Time controls: Not just framerate, but a % multiplier on simulation speed. - GPU Refactor: I don't think you're doing any of this yet, so maybe optimizing for a GPU-based speedup would be cool? See if you can reach 10,000 boids! Sebastian Lague's video goes into parallelization, just not in JavaScript: https://youtu.be/bqtqltqcQhw
I quite like Boids, but recently I started playing with RVO2 ORCA (optimal reciprocal collision avoidance). I made some changes to it and moved it to a compute shader to make this: https://www.youtube.com/watch?v=BavnPOPcHlk
The entities in the video are running super fast for testing purposes, so usually they'd be going a lot slower. They can produce some really pleasing patterns as they move through each other etc.
On the downside its quite expensive vs Boids, for example the video is from a slightly older version and every agent is looking at the closest 32 neighbours + 32 obstacles to compute its own velocity. At high densities you can drop that to e.g. 4 neighbours without appreciable difference, which allows for running e.g. 32k entities at 120fps.
Reminds me of this similar thing!, creating life like behavior with only simple rules https://youtu.be/0Kx4Y9TVMGg?t=40
(the coolest examples come at about half a minute into the video)
how are genetic (algorithms) used?
I really like it, though I'm finding it dies consistently after about 30s (Vivaldi on an intel iMac with a decent GPU).
Green light is perceived as brighter than other colors because human eyes are most sensitive to it. This sensitivity is related to the wavelengths of light that our visual system responds to, with green being at the peak of our vision
I remember that word "Boids" from Blender Physic simulation menu, to mimic a flock of birds in 3D, I also remember understanding nothing to its settings, but it kind of worked well.
That's beautiful. What are "signals"?
Never heard of such thing, love it!
The original Boids is from Craig Reynolds, here:
https://www.red3d.com/cwr/boids/
It was a java applet (sigh) and unfortunately I have not been able to find a working version. That version based on his three "steering" mechanisms had very realistic movement. Other versions, including this one, which are good do not have that same kind of quality. They look like simulations whereas the Reynolds version, for whatever reason, seemed much closer to watching an actual flock.
No criticism intended, it would just be nice to understand the why the difference.
Looking briefly at the code, it seems the fitness function is simply how close the boids are?
Very cool!