Programming Assignment 3: 3-D Vivarium
Due Tuesday, November 10 at 11:59pm

The purpose of the assignment is to introduce you to 1) the use of OpenGL display lists and OpenGL transforms for hierarchical modeling, and 2) collision detection and clipping. 

You will program a 3-D vivarium: a simulated 3-D world with polyhedral creatures moving around. 

·       To build your vivarium, you will first need to construct two different creatures using polyhedral (solid) parts.  For the basic parts of your creatures, feel free to use routines provided with the previous assignment.  You are also free to create your own basic parts, but they must be polyhedral (solid). The creatures you design should have moving linkages of the basic parts: legs, arms, wings, antennae, fins, tentacles, etc. These linkages should move back and forth in a periodic motion, as the creatures move about the vivarium.  

·       In the vivarium program, creatures and their parts are to be stored and manipulated as OpenGL display list objects. 

·       Use OpenGL transforms to control the motion of each creature and its parts.

·       Creatures should face in the direction they are moving. For instance, a dog should be facing the direction in which it walks.

·       Creatures in the vivarium should react to where other creatures are and move accordingly. Your creatures can have a prey/predator relationship, a courtship/mating relationship, etc. For example you could have a bug being chased by a spider, or a fish eluding a shark, or a cat chasing a dog, etc. This means that the path your creatures take should be based on where other creatures are. You will need to compute inter-creature distances and compute collisions, based on their current configuration. To make things faster, you are welcome to use bounding spheres or bounding boxes. 

·       Your creatures live within the 3D "tank" of fixed width, height, and depth. At no point should your creatures go outside the 3D tank. If a creature comes to the edge of the tank, it should turn and change direction to stay within the tank. 

·       Make it possible for a user to add chunks of food to the vivarium. Be sure to draw the food on the screen, and make it disappear once it has been eaten. Food is eaten by the first creature that touches it.

Program Template

Here is a simple example program that allows you to change the 3D viewpoint by clicking the left mouse button + dragging. It shows a spinning teapot in a 3D tank. You can modify this program to produce your own vivarium.

Hints

  1. You will likely want to change the 3-D view of the tank during simulations. 
  2. You will likely need to define callbacks for glutIdleFunc, or maybe glutTimerFunc.

Extra Credit I (required for CS680)

For extra credit on this assignment add more creatures to the vivarium and make it possible for creatures to engage in group-behaviors, for instance flocking together. This can be achieved by implementing the Boids animation algorithms of Craig Reynolds.  

Extra Credit II (undergrads may only do one Extra Credit, either I or II)

Implement stereo viewing of the vivarium using red/blue anaglyphic glasses.  If you are interested in obtaining a pair of these glasses, please ask. 

For more information about anaglyphic rendering of stereo in OpenGL, visit this web page. 

Also see the Wikipedia page.

And enjoy some anaglyphic videos!

Demo

Part of your grade for this programming assignment will be based on your giving a short demo (10 minutes) in the CS instruction laboratory. You will be expected to talk about how your program works, and we will see how well your program performs on some test examples. You will be asked to sign up for a demo slot in class. 

Source Code Submission

Your program's source files are to be submitted electronically. Use the gsubmit program on the CS cluster.

The code you submit should conform to the program assignment guidelines.

Grading (Out of 100 points)

CS480 

Use OpenGL transforms and display lists to produce two creatures with moving parts

20 points

Creatures face in direction they are moving

10 points

Collision detection and creatures react to each other

20 points

Creatures stay inside window as described above

15 points

Food can be added, creatures find and eat the food as described above

15 points

Programming style

20 points

Group behavior modeling, etc. OR stereo viewing (choose one extra credit option only)

10 points extra

CS680 

Use OpenGL transforms and display lists to produce two creatures with moving parts

15 points

Creatures face in direction they are moving

10 points

Collision detection and creatures react to each other

15 points

Creatures stay inside window as described above

10 points

Food can be added, creatures find and eat the food as described above

10 points

Programming style

20 points

Group behavior modeling, etc.

20 points 

Stereo viewing

10 points extra

Late Assignment Policy

Late programming projects and problem sets will be levied a late penalty of 12% per day (up to three days). In other words, lateness will be penalized at 0.5% per hour late. After three days (72 hours) no credit will be given.

Collaboration/Academic Honesty

The code you submit must be your own. If you find/use information about specific algorithms from the Web, etc., be sure to cite the source(s) clearly in your sourcecode.

Please be aware that the code submitted for this course is automatically analyzed using a code plagiarism detection program. Code flagged as suspicious by the program will be examined by the teaching staff and action will be taken in cases of plagiarism. BU Academic Conduct Code.

All instances of academic dishonesty will be reported to the Academic Conduct Committee.



Stan Sclaroff 

Last edited:  October 19, 2015