cs

Computer Graphics 266

Index | Lab 0 | Lab 1 | Lab 2 | Lab 3 |

Lab 4

| Lab 5

Lab 4:

Implement a behavioral system like Reynolds flocking. You can start with a set of simple behaviors that are mediated by simple weighted averages, and then make extensions with more complex behaviors and better mediation schemes. The boids can live in 2D space.



Description:

This lab demonstrates a very simple example of emergent behavior. Each boid can see only what is in front of it, and each boid's behavior is mediated by what it sees at the current time step.


Controller:

1) If the boid cannot see any boids in front of it, it maintains its velocity.

2) If the boid can see a flock ahead of it, but is not within proximity range of its nearest neighbor, it speeds up and steers toward the center of the flock.

3) If the boid is within proximity range of its nearest neighbor, it slows down and its velocity is a weighted average between flock centering and matching the velocity of its nearest neighbor.

4) If the boid is within collision range of its nearest neighbor, its velocity is a weighted average between matching the velocity of its nearest neighbor and repulsion along the collision normal.

5) Force fields emanating the walls push the boids gently away as they get too close.


Flock Splitting:

Because the boids' field of view is limited, collisions with walls sometimes cause the flock to split. However, the local flocks attempt to rejoin each other as soon as they see each other again.