Hello and welcome to the Formations Flocking Demo!  

Contents
	About the Formations Flocking Demo
        How the Formations Work
	Installation Instructions
	Uninstall Instructions
	About the Source Code
	Contacting RiverSoftAVG


-------------------------------------------------------------------------
About the Formations Flocking Demo
-------------------------------------------------------------------------

The Formations Flocking demo extends the flocking demo to add formations
(squares, wedges, etc).  The demo itself allows you to play with the parameters
controlling the formation flocking.  The formation flocking code is based
on the four rules of flocking*: separation, alignment, cohesion, and avoidance.
The Formation Flocking code modifies the standard cohesion and separation rules.
The cohesion rule now moves the boid towards its position in the formation.
The separation rule has been modified so that it doesn't apply when the boid
is in its place in formation.  In addition, the separation strength has been
turned way down to avoid the boids from pushing away from the formation.
Finally, when a boid gets into position, it stops.

Each flock is drawn in a different color.

The demo allows you to:

	View a 2D simulation of one flock or two flocks.  The second flock
	is added just to have enemies to avoid.  They do not move.
	Run or step through a simulation
	Set the formation: wedge, square, etc
	Direct the formation to follow the movement of the mouse.  The formation
	will rotate to face the mouse and then move towards the mouse.
	Set the number of boids (members) of each flock (2-100)
	Toggle on/off any flocking rule
	Set the relative strength of the rule on each member of the flock

      This software is freeware.  You are authorized to duplicate and modify
      this software.  No guarantees or warranties.  

This demo borrows concepts and algorithms from Steven Woodcock's
article, "Flocking: A Simple Technique for Simulating Group Behavior,"
which is found in the book, Game Programming Gems (a great book by the way).

* The four rules of flocking are: separation, alignment, cohesion, and 
avoidance.  Separation means that each member, or boid, of a flock tries 
to keep a minimum distance from every other boid in the flock.  Alignment 
means that each boid tries to go in the same direction as the rest of the 
flock.  Cohesion means that each boid tries to get as close as possible to 
the rest of the flock (huddle together).  Finally, Avoidance means each 
boid tries to not get too close, or avoid, boids in other flocks.  From 
these four simple rules of flocking emerges apparently life-like behavior 
for a flock.


-------------------------------------------------------------------------
How the Formations Work
-------------------------------------------------------------------------

Formations work by overriding the cohesion rule for the boids.  The standard
flocking cohesion rule (at least how it is implemented in the TBoid class)
works by giving the boid the "desire" to go towards the center of the
flock (which is calculated each turn).  However, with a formation flock,
when you specify a formation, the TFormationFlock class assigns a position
and orientation offset from the flock's center for each boid.  The
TFormationBoid class' Cohesion Rule attempts to go towards its assigned
position in the flock.

For example, if the formation is set to SQUARE, the TFormationFlock class
calculates the orthogonal vector to its (the group's) orientation.  This
orthogonal vector is used to spread the assigned positions of the members
of the flocks in a square.  If a flock was facing due north, the flock
class would calculate the east-west vector, the number of rows and columns
needed, and assign positions:

                   /\
                   || Flock's Orientation

           B01 B02 B03 B04 B05
           B06 B07 B08 B09 B10
           B11 B12 B13 B14 B15

As long as the flock's orientation is not changed, the boid's offset position
and orientation are *not* changed.  These values are always *relative* to the
flock's position and orientation.

Note that with a TFormationFlock, a desired position have been added.
This allows the flock to wheel the formation to face the desired position
(from its current position) and then advance towards the desired position.
By this device, the flock can advance while keeping formation.  Also note
that the speed of the flock is *less* than a boid's speed.  This allows
boids to keep their position more easily and also to "run and catch up" with
the rest of the formation.  It also has the added benefit of making a lot
of real-world sense since a group moving in formation is slower than just
one individual.


-------------------------------------------------------------------------
Installation Instructions
-------------------------------------------------------------------------

1.	Unzip the file to its own directory.

2.	To install the components:
	a.	Start Delphi
	b.	Close all files.  Select File->Open...
	c.	Find the Flocking.dpk file
	d.	Click Compile and then Install
3.	To look at the source, open the FormationDemo.dpr file


Enjoy!

If there are any problems, don't hesitate to contact me at support@RiverSoftAVG.com


-------------------------------------------------------------------------
Uninstall Instructions
-------------------------------------------------------------------------

1.	To uninstall the components:
	a. Open Delphi
	b. Select Component->Install Packages...
	c. Find the "RiverSoftAVG Flocking Components" package
	d. Select it and click Remove
2.	Delete the files.


-------------------------------------------------------------------------
About the Source Code
-------------------------------------------------------------------------

There are four .pas files in the project.

	Vector.pas provides a simple vector class for such things as 
	orientation, velocity, and position
	FormationMain.pas is the main application for the demo
	Flock.pas is the flocking code classes
	FormationFlock.pas overrides the Flocking classes to add formations


There are three main classes to the flocking code: TFlockWorld, 
TFormationFlock/TFlock, and TFormationBoid/TBoid.

The TFlockWorld class represents the world within which the flocks live.  
As such, it tracks every flock in the world as well as define the characteristics
of the world (mostly boundaries).

The TFormationFlock class extends the TFlock class, which represents the 
flock and is made up of a collection of TFormationBoid objects.  The 
TFormationFlock class changes the TFlock class behavior by adding
formations.  When you change the formation, the class modifies every
TFormationBoid's position offset and orientation offset.

The TFormationBoid class represents a single entity in the formation flock 
and is the guts of the code.  Each boid has a position, velocity, and speed.
The TFormationBoid class extends the TBoid class to add Offset and 
OrientationOffset properties; these properties tell the boid its position
and direction within the flock.  Every step of the simulation, the 
TFormationFlock class calls the Update method of the boid.  In this method, 
the boid moves based on the flocking rules.  The TFormationBoid class modifies
the flocking rules as explained above.

 
-------------------------------------------------------------------------
Contacting RiverSoftAVG
-------------------------------------------------------------------------

For technical support send email to:

  support@RiverSoftAVG.com

-------------------------------------------------------------------------

 Unless otherwise noted, all materials provided in this release
 are Copyright  2001, Thomas G. Grubb.

-------------------------------------------------------------------------
