/frock

A flocking simulation written in Lua Love

Primary LanguageLua

== What is Frock?

Frock is a flock simulator.  Was first a port, then a simulation, maybe later 
a game.  But the immediate goals are for it to support a large number >100 of 
flying boids

== Installing

You need to install Lua5.1 and the Love 0.5.0 2D Game Framework, along with 
any dependencies that package needs.

http://love2d.org/download

== Running

Clone the repo from the git repository.

  git clone git://github.com/iamwilhelm/frock.git  

Then inside of the frock root directory run:

  love .

Don't forget the period!

== Author 

Wilhelm Chung 
blog: http://webjazz.blogspot.com
github: http://github.com/iamwilhelm

== Swarming Chickens (boids)

Introduction Blog post:
http://webjazz.blogspot.com/2009/02/introducing-frock-flocking-chicken.html

You'll see chickens flocking around eating the shrubbery.  It demonstrates 
the flocking algorithm, and that each chicken follows only three rules

1. Out of your neighbors, head towards what you perceive to be the center 
   of the flock
2. Avoid colliding with your neighbors.  The closer you are, the more you'll 
   want to move away
3. Of all your neighbors, head in the same direction they're going.

Add the three vector forces up for these three motivations, and you have 
flocking behavior.  There are two additional forces in the simulation to make 
it more interesting to watch.  

1. Move towards the center of the screen
2. Move towards plants that you perceive to be around you.

Notice that the flocks split and regroup and weave around on the screen, 
and there is no global coordination.  Each chicken can only see what's around 
it, but you get this emergent property of flocking.

== History and credits

I've always loved swarms and boids ever since I learned about them.  I've 
made my own flocking boids in Netlogo, but they were never fast enough.  
The demo for Lua's particle system impressed me, with its speed.  And Love 
seemed easy enough to get started with.  I wanted to see if I can create a 
simulation for boids.  So after hacking away at about 5 or 6 hours total, I 
had the first version working.

This was originally a port of Wally Glutton's (http://stungeye.com) Hungry 
Boids app from Ruby Shoes into Lua Love
http://the-shoebox.org/apps/45

Boids were first introduced by Craig Reynolds:
http://www.red3d.com/cwr/boids/

Boid Algorithm Tutorial: 
http://www.vergenet.net/~conrad/boids/pseudocode.html 

Farm animals were ripped off of Harvest Moon by N-finity
http://tsgk.captainn.net/index.php?p=userinfo&t=1

Succulent Plants by James Gately
http://www.istockphoto.com/user_view.php?id=2715153

Green Plants by Andy Lin
http://www.istockphoto.com/user_view.php?id=3021132