r/Simulated • • 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?

5 Upvotes

5 comments sorted by

6

u/flmng0 23h ago

How is this different from normal Boids?

-5

u/IllustriousPay2276 23h ago

Haha, fair point! 😄

Nothing fundamentally different — it's classic Boids.

I just wanted to build an interactive playground to experiment with separation, alignment, and cohesion in real time.

What I find really interesting is how such simple rules can produce complex collective behavior.

I'm now experimenting with turning it into a puzzle game where players manipulate the environment rather than directly controlling the swarm. That's where I'm hoping to do something more interesting!

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

u/JorisJobana 14h ago

ai slop