Copyright 1998-2014 (c) Synthetic Reality Co

Synthetic Reality:
Company Store
Contact Us

Well of Souls
Warpath 97
Warpath Classic
MIX Game Server

Rocket Club
Galaxy Simulator

About Us

The real reason I am uploading this today is to test my new copy of ws_ftp pro... The probability that your life has been spent waiting for this program to appear is quite small. But it *is* a little mesmerizing, so perhaps you will enjoy it.

This program is FREE, not shareware. Just enjoy it.

What Is synBirds?

Basically, it's a silly little exercise. It models a large number of birds which fly in a flock. Each bird is actually making its own independent flight decisions, based upon what it sees nearby.

My inspiration was those flocks of birds you see in the distance where the individual birds are just dark spots against the blue sky. Their movement becomes that of a cloud which changes size and direction dramatically.

Here is a life-size screen shot of synBirds in action:

[There is NO ScreenShot... It's just Too Trivial]

(I am imitating my Galaxy Simulator notes here, in case you noticed the mindless duplication of format). My goal with synBirds was to:

  1. Have Fun.
  2. Try something with a large number of independent 'intelligent' objects.
  3. Write another program with an insane number of computations per second to enjoy my shiny PII 300, even when my friends are now getting 450MHz machines and trying to depress me. Intel should give me an award for slowing down computers better than anyone else!

Running the Program

Well, just unzip the executable and run it.

synBirds version 0.0

It is a dialog-based MFC app written in VC++ 4.2b

Right away it starts animating the 'birds' (Each bird is simply a rectangle of color (taken from the birds.bmp bitmap if you want to fiddle a little with the textures). Your only control is to specify how many birds you want to see. I could see myself turning this into a screen saver, perhaps. But it is probable I won't do anything else with it. I think it would be neat to make the birds react to your voice, so I might use this as a test case for that someday.

The Math

I don't have a lot to say about the math in this one. There is not a lot going on. Basically I paint a static background image (alter pond.jpg to the image of your choice, I will dynamically scale it to the screen size you select). On top of that I draw 'the birds' using a simple 3D to 2D conversion. For each frame, I compute the new bird positions using the 'flocking strategy'

Lissajous patterns and camera location/viewport:

  • Please see synVista's math notes for the description of Lissajous patterns. Basically there is a 'key bird' who is flying a lissajous pattern throughout a 3D 'cube' of space which sits in front of the viewer. The other birds are more or less following this leader.
  • Given a bird's 3D position in this 'cube', I compute its on-screen location using the formula's

Xscreen = zoom * (XBird - XCamera) / ZBird;
Yscreen = zoom * (YBird - YCamera) / XBird;

Where The 'screen' is like a piece of glass with your eye (the camera) on one side and the cube on the other side. Zoom represents the distance of your eye from the screen. XBird is the distance of the bird from the screen-side of the cube.

You've seen me do this before.... If you're working in fixed point math, be sure to do all the multiplies before you do the divide. And avoid dividing by zero...

  • The size of square I use to represent the Bird itself diminishes with the bird's distance (I simplify and just use the Bird's Z location value as the distance, and apply some arbitrary max and min sizes for esthetic appeal)

Flocking Algorithm:

  • This is the 'interesting' part of this program, if there is one. Basically I scratched my head and thought about why birds in flight look as they do. I decided (with no research) that they basically were all following each other, with the birds 'more in front' controlling the overall flock dynamics more than the birds in back.
  • So, for each bird I keep track of both its current position in space, as well as its current velocity vector (the direction it is headed, and the speed it is flying)
  • Each frame, for each bird, I update its position by moving it a little along the path of its velocity vector, and then I alter its velocity vector a little to 'follow' a bird in front of it. (In fact, I cheat here. bird 0 is the key bird which is following a lissajous pattern. The next 5 birds follow bird zero, and the remaining birds follow one of those 5 birds.
  • Initially I tried just resetting the velocity vector of a bird o point directly at the bird it was following. This had the predictable effect of getting the birds to all fly in a straight line after the key bird.
  • Finally, I hit on 'free will' Each bird flies along its current velocity vector 'for awhile' until turning to follow its leader bird. This provided very animal-like behaviour (kind of scary, really). The amount of free will I give the animal determines if it looks like birds, bees, or lightning bugs. The version I uploaded is closer to 'bee' free-will than bird free-will (I get the most bird-like effect with a fairly large free will value).

synBirds is the property of Synthetic Reality and all rights are reserved. If we can figure out a way to convince people to pay for this, you can be sure we'll give it a try. But for now it is expressly intended to provide a moment of joy for the math geeks in the audience, looking for number-crunching programs to show off their power computers!

Thanks for your feedback in advance!

Dan Samuel
Synthetic Reality Co.