r/Simulated • u/IllustriousPay2276 • 1d ago
Interactive 500 drones, 3 simple rules, no central controller. Watching emergence happen in real time.
Enable HLS to view with audio, or disable this notification
I've been experimenting with swarm intelligence and the Boids algorithm, and ended up building this little interactive simulation using HTML, Canvas, and JavaScript.
The coolest part? There's no central controller telling the drones where to go.
Each drone follows just three simple rules:
- Separation — Avoid getting too close to neighbors.
- Alignment — Match the direction of nearby drones.
- Cohesion — Move toward the center of nearby drones.
And somehow, hundreds of independent drones start moving together like a living swarm. That's emergence!
I also added interactive controls to adjust the three rules in real time, attract or repel drones with the mouse, and experiment with different formations.
It normally runs at around 60 FPS on my machine, but drops to about 40 FPS when I'm screen recording. Not entirely sure why yet, probably recording overhead.
I'm thinking about turning this into a little browser game where you control swarms of drones instead of individual units.
What do you think? Any fun ideas for what I should try next?
1
u/Alexmira_ 14h ago
Use anything else other then javascript and it'll stop lagging.
1
u/IllustriousPay2276 5h ago
It actually runs at 60 FPS normally and only drops to 40 FPS when recording, so I think it's more about recording overhead than JavaScript itself. 😄
-1
6
u/flmng0 23h ago
How is this different from normal Boids?