Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you haven't seen the boids pseudocode page by Conrad Parker it's definitely worth checking out: http://www.vergenet.net/~conrad/boids/pseudocode.html

Here's an implementation I wrote last month for fun: http://breefield.com/lab/flock. It doesn't have much bias in terms of direction (there's no wind, or patterns to follow), so there's generally one large swarm. Click-drag to create repellers, boids follow mouse. The white center of each boid shrinks at it's velocity increases, and the inverse happens to it's red direction line. Purple specks indicate perceived center of nearby flock. The rest is just aesthetic.

It's always super interesting to see other implementations in action, so please share more in your comments, if you have them. I'd certainly love to see them.



This is super cool! I really like the visuals in your implementation, way better looking than my blocky vectors. You also get pretty great performance by using raw canvas api calls which by the looks of your code wasn't too unwieldy. You also didn't implement any wrap around which stirs things up when the flock hits the edges, which goes a long way to demonstrate the actual behaviour as they reflect off the side. Nicely done!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: