TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Neat Algorithms - Flocking

160 pointsby bochiover 12 years ago

13 comments

hythlodayover 12 years ago
The original paper[0], published in '86, in addition to being a huge step forward over contemporary graphics techniques, is extremely comprehensible and an excellent read. It also goes into some detail about collision avoidance, which is hard to see in the browser demo (boids will avoid the mouse but not in a very large area), and goal seeking, which isn't in it. It ends with a fairly eyebrow-raising testament to the increase in computer power over the last two and a half decades:<p>"This report would be incomplete without a rough estimate of the actual performance of the system. With a flock of 80 boids, using the naive O(N^2) algorithm (and so 6400 individual boid-to-boid comparisons), on a single Lisp Machine without any special hardware accelerators, the simulation ran for about 95 seconds per frame. A ten-second (300 frame) motion test took about eight hours of real time to produce."<p>[0] <a href="http://www.red3d.com/cwr/papers/1987/boids.html" rel="nofollow">http://www.red3d.com/cwr/papers/1987/boids.html</a>
评论 #4530318 未加载
评论 #4531521 未加载
mluover 12 years ago
I once programmed a swarm simulation as a project for a course I attended. You can set various parameters of the swarm and introduce a predator which can try to eat inidividuals of the swarm. You then can set a bunch of escape strategies. This was pretty much fun when I wrote it.<p>Just uploaded it to my bitbucket repository in case anyone is interested.<p><a href="https://bitbucket.org/mlux/swarm-simulation" rel="nofollow">https://bitbucket.org/mlux/swarm-simulation</a>
评论 #4530388 未加载
pacaroover 12 years ago
This is covered very well (a long with many other <i>neat</i> algorithms) in The Computational Beauty of Nature[1], one of those books I keep coming back to<p>[1] <a href="http://mitpress.mit.edu/books/FLAOH/cbnhtml/" rel="nofollow">http://mitpress.mit.edu/books/FLAOH/cbnhtml/</a>
评论 #4529816 未加载
评论 #4530518 未加载
评论 #4530119 未加载
Bjartrover 12 years ago
I made a boids implementation in WebGL a while back<p><a href="http://www.cs.rit.edu/~bpd9116/WebGLU/examples/boids/boids.html" rel="nofollow">http://www.cs.rit.edu/~bpd9116/WebGLU/examples/boids/boids.h...</a>
tsahytover 12 years ago
The visual demonstration is rather hypnotizing to watch. This algorithm is an example how seemingly intelligent behaviour roots in just a handful of simple rules. In this way it kind of reminds me of Conway's Game of Life: A few simple rules stimulating stunningly complex behaviour.
repocussionover 12 years ago
My friend actually recently released an Android game based on exactly this: <a href="https://play.google.com/store/apps/details?id=co.uk.iceroad.complexcity.floqua" rel="nofollow">https://play.google.com/store/apps/details?id=co.uk.iceroad....</a>
wsbail29over 12 years ago
Here's a CoffeeScript port of this algorithm I did awhile ago.<p><a href="https://gist.github.com/3733089" rel="nofollow">https://gist.github.com/3733089</a><p>and a demo:<p><a href="http://wsb.im/flocking/index.html" rel="nofollow">http://wsb.im/flocking/index.html</a><p>Definitely fun stuff to play around with.
评论 #4531456 未加载
runemadsenover 12 years ago
You should definitely check out Daniel Shiffmans "Nature of Code" book that is coming out soon. It's full of stuff like this.
评论 #4529703 未加载
评论 #4530190 未加载
bawllzover 12 years ago
Woah! Super cool idea. So many ways you can take this to a new level. Also, if anyone is looking to contribute to some open source, this would be a great opportunity as there is lots of epic optimization problems in this algorithm to work on.<p>For example, whats the fastest data structure/algorithm to make searching for neighbours?
评论 #4531266 未加载
haihaibyeover 12 years ago
<a href="http://proceduralgraphics.blogspot.com.au/2010/06/flock-in-cloudy-blue-sky.html?m=1" rel="nofollow">http://proceduralgraphics.blogspot.com.au/2010/06/flock-in-c...</a><p>In straight js and canvas, with bird silhouettes and Perlin sky
Havocover 12 years ago
Bat swarms and game AI aside, what are the real world applications of something like this? It strikes me as significantly less useful than say a neural net.
评论 #4530548 未加载
seivanover 12 years ago
Thank you so much! Great article, found some stuff I could definitely use for games I'm working on.
jeffehobbsover 12 years ago
oh, FLOCKing. Yes. That is neat too.
评论 #4529340 未加载