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

8 Upvotes

8 comments sorted by

8

u/flmng0 5d ago

How is this different from normal Boids?

-5

u/IllustriousPay2276 5d 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_ 5d ago

Use anything else other then javascript and it'll stop lagging.

-1

u/IllustriousPay2276 4d 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/Alexmira_ 4d ago

If it lags with just the record overhead it means it very poorly optimized. Something like this should be very light to run.

1

u/Celestial__Bear 2d ago

AI account, AI project, AI description, AI comments. Oh my god.

1

u/IllustriousPay2276 2d ago

And somehow, all these comments formed a swarm without a central controller. That's emergence! 😂

-1

u/JorisJobana 5d ago

ai slop