Department of Computer Science Worcester Polytechnic Institute |
---|
Objective: | In this project, you will create three species of creatures (what Reynolds calls "boids") using
behavioral animation techniques. All species will share some common traits, but each species will also have some traits
that are unique to it. You will then populate a scene with a mix of creatures from the three species, and see what happens
over time.
This project must be done individually. But if you want to do it in a pair, see below for requirements. |
---|---|
Programming: |
The aim of this project is for you to experience the cool-ness of behavioral animation.
You will create three species of creatures, the Reds, the Blues, and the Greens, that move through the environment based on their internal desires, as well as on what they sense around them. The three attributes common to all species are Cohesion, Alignment, and Separation, but these attributes only apply to creatures from the same species. So, Reds flock with Reds, etc. The Reds are attracted to the Blues, but evade the Greens. Likewise, the Blues are attracted to the Greens, but evade the Reds, and the Greens are attracted to the Reds, but evade the Blues. If one creature catches another (i.e., collides with it), the creature that is caught becomes the same color/species as the one who caught it. You are free to construct any creatures you like, though the simpler the better for this project. Each species could be the same geometrically, with only the color telling them apart. Or you can choose something more interesting. You may choose to do flying creatures (flocks), running creatures (herds), or swimming creatures (schools). Each creature should have some "sensing range", which you can think about as a distance (radius) within which it can sense other creatures and obstacles. Things that are outside this range go unnoticed. Think if this as limited visual acuity, or maybe as fog in the water. All creatures should either stay within a given environmental boundary (and remain visible to the camera) using a "force field" at the edges, or upon reaching the edge of the space, they can be instantly teleported to the opposite side of the space, so that they "wrap around," meaning that if one leaves the space to the right, then it appears to enter the space again on the left, moving in the same direction. In addition to reacting to creatures around it, each creature should avoid environmental obstacles, such as a large sphere in the center of the space. Such objects may, for example, give off a "force field" that pushes the creatures away from it if they get too close. At the start of the scene, you should populate the space with equal numbers of creatures from each species, and place them randomly about the space with random velocities. Then at each time step, update the new positions of each of the creatures based on the influences of the things around it. |
Attacking the Problem: |
One way to approach this problem is to define a Rule class that allows you to capture the essence
of each rule. Then, for each species, define a rule set. Each creature instance then has a set of rules it abides by, and
also has some randomly assigned parameters (position and orientation, to start with, but also some max speed, sensing range,
etc., as you like). Sample rules are those listed above, so Cohesion, Alignment, and Separation. Each rule would have
an "apply" method that handles the processing necessry to implement the rule behavior.
Each creature must have a "sensing" method that considers all the things around it, and calculates a new force to move the creature. Next, define an Obstacle class to represent objects in the environment that the creatures should not bump in to. The ground-plane may be one of these. |
Extras! |
Many students love this assigment, and have added some "extras" in the past. Below are some things you may choose to
add if you so desire, THOUGH THESE ARE PURELY OPTIONAL!
|
Working in Pairs: |
You may work on this project in pairs (2 people) if you add the following functionality: Create a system for implementing particle systems. There is much code you can reuse from implementing the creatures described above, including the rule system, if you code them carefully. Each particle system should have a circular (disk) Emitter class that is responsible for generating, placing into the space, and managing particles over their lifetime. Each particle should be described using the attributes we worked on in class. Particle-particle collision detection is usually not necessary with particle systems, though particles typically do interact with their environment. Yours should too, so maybe add some physics. Once you have your emitter defined, instantiate some of them in your environment where your creatures are moving, and behold the beauty! |
Documentation: | You must create adequate documentation, both internal and external, along with your project.
The best way to produce internal documentation is by including inline comments. The preferred way to do this
is to write the comments as you code. Get in the habit of writing comments as you type in
your code. A good rule of thumb is that all code that does something non-trivial should have comments
describing what you are doing. This is as much for others who might have to maintain your code, as for
you (imagine you have to go back and maintain code you have not looked at for six months -- this WILL
happen to you in the future!).
Create a README file containing all information you would like the TA to know when grading your work. I use these file and function (method) headers, in my code. Please adopt these (or some other consistent convention) for all your projects. The file header should be used for both ".h" and ".cpp/.java" files. Create external documentation for your program and submit it along with the project. The documentation does not have to be unnecessarily long, but should explain briefly what each part of your program does, and how your filenames tie in. Most importantly, tell the TA how to compile and run your program. Create a YouTube video of your work, upload it, and submit the URL along with your documentation. |
What to Turn in: |
Submit everything you need to compile and run your program (source files, data files, etc.)
BEFORE YOU SUBMIT YOUR PROJECT, put everything in one directory, compile it, and make sure it runs. When you are ready to submit, zip everything up into a single archive file. Name the file LastName_FirstName_proj3.zip. You will use the Web-based "Turnin" facility to submit your work. Information about submitting can be found here:
Use your WPI user ID to login, and you should have been emailed a password. |
Academic Honesty: |
Remember the official WPI statements on Academic Honesty. You may discuss the project with others, but you are to do your own work. |
Videos from Previous Years: |
D Term, 2013 |