Page 1 of 1

Introducing Frock, a flying chicken flocking simulation

Posted: Thu Feb 12, 2009 6:26 pm
by iamwilhelm
Hi all,

I caught wind of Love on Hacker news, and I decided to try it out. Noticing that you guys were missing a flocking boid simulation in your demos, I decided to write one. The love file is attached at the bottom, and the details of it are in a blog post I wrote.

http://webjazz.blogspot.com/2009/02/int ... icken.html

The source repository is here:
http://github.com/iamwilhelm/frock/tree/master

Comments and patches welcome.

Enjoy!
Frock_small.png
Frock_small.png (17.23 KiB) Viewed 6948 times
frock.love
(211.88 KiB) Downloaded 397 times

Re: Introducing Frock, a flying chicken flocking simulation

Posted: Thu Feb 12, 2009 6:31 pm
by Skofo
HAHAH! Too neat. :ultrahappy:

Re: Introducing Frock, a flying chicken flocking simulation

Posted: Thu Feb 12, 2009 6:47 pm
by iamwilhelm
Oh, I forgot to mention that clicking on the screen puts more plants in the world.

The current algorithm for calculating k-nearest neighbors is naive, so it's O(n^2). That'll be remedied as soon as I figure out how to do it.

Re: Introducing Frock, a flying chicken flocking simulation

Posted: Thu Feb 12, 2009 6:55 pm
by farvardin
some people are really talented here...
Very interesting! I love flocks of birds. I've seen recently a similar one like on the video on your website...

Re: Introducing Frock, a flying chicken flocking simulation

Posted: Fri Feb 13, 2009 1:45 pm
by osuf oboys
iamwilhelm wrote:Oh, I forgot to mention that clicking on the screen puts more plants in the world.

The current algorithm for calculating k-nearest neighbors is naive, so it's O(n^2). That'll be remedied as soon as I figure out how to do it.
You can actually find all n nearest neighbors in O(n log n) time, but it's a bit complicated. See An optimal algorithm for the All-Nearest-Neighbors problem by Pravin Vaidya (1986): http://ieeexplore.ieee.org.ludwig.lub.l ... 568202.pdf. O(n log n) k-nearest neighbor is mentioned in the same paper. If you were to implement this, or an approximation or heuristic algorithm, please do share with the rest of us :).

Re: Introducing Frock, a flying chicken flocking simulation

Posted: Fri Feb 13, 2009 2:59 pm
by rude
Neat. Somehow reminds me of that PS3-demo. Maybe Skasi can use something like this for his Galcon-like game.

Re: Introducing Frock, a flying chicken flocking simulation

Posted: Fri Feb 13, 2009 6:23 pm
by iamwilhelm
osuf oboys wrote:
iamwilhelm wrote:Oh, I forgot to mention that clicking on the screen puts more plants in the world.

The current algorithm for calculating k-nearest neighbors is naive, so it's O(n^2). That'll be remedied as soon as I figure out how to do it.
You can actually find all n nearest neighbors in O(n log n) time, but it's a bit complicated. See An optimal algorithm for the All-Nearest-Neighbors problem by Pravin Vaidya (1986): http://ieeexplore.ieee.org.ludwig.lub.l ... 568202.pdf. O(n log n) k-nearest neighbor is mentioned in the same paper. If you were to implement this, or an approximation or heuristic algorithm, please do share with the rest of us :).
Yeah, I'll let you guys know what I end up coming up with. Been getting some pointers to papers here, and there. Just have to make use to my peeps in universities to get these papers for free...

Re: Introducing Frock, a flying chicken flocking simulation

Posted: Wed Mar 04, 2009 12:50 pm
by iamwilhelm
Just an update. Am able to display debugging information now.

Decided to use a spatial hash since it was easiest to do, and Craig Reynolds gets away with it. Almost there.
Screenshot.png
Screenshot.png (187.78 KiB) Viewed 6601 times

Re: Introducing Frock, a flying chicken flocking simulation

Posted: Wed Mar 04, 2009 2:26 pm
by bartbes
Looks... complicated, but exciting as well. Makes me want to pretend I'm a spy :?