CSSE 120 Final Python Project—Emergence

Project Requirements

Background

Many systems in real life are composed of a multitude of identical objects, each with simple behavior. However, as a whole, complicated or unexpected group behavior emerges. Consider traffic (automobile, or information packets on a computer network), a market economy, a school of fish, or an army of ants. Their behavior is called emergent behavior.

Emergence rules: Consider a group of creatures. They can be a flock of birds or a school of fish. In either case, each creature is only aware of its immediate surroundings. We can describe their behavior using three simple rules:

  1. Avoid obstacles - if a creature is crowded by its neighbors (or by a fixed object), it tries to accelerate away.
  2. Stay with the flock - accelerate toward the average location of neighboring creatures.
  3. Match velocities - accelerate to attempt to fly in the same direction as neighboring creatures.
Note the liberal use of the word "accelerate".  Don't forget that acceleration is a vector quantity.  It can change both the magnitude (including a negative change, often called "deceleration") and direction of a creature's velocity. The main task of your program is to simulate the motion of the creatures and to calculate an acceleration for each simulation step that attempts to follow the (sometimes-conflicting) rules.  In order to be realistic, each creature should have a maximum allowed acceleration magnitude.  One important part of this problem is deciding how to deal with the situation where one or more of the rules indicate a need for an acceleration whose magnitude is greater than the maximum. 

See the instructor's demo for some ideas. Here are some links to documents that you should read:
  1. Here is a website showing some nice animations and images of emergent behavior. Note that yours could be similar, but you only need to consider 2 dimensions, not 3D!
  2. Here is the original paper about a computer-generated flock of birds at a graphics conference in 1987! This document probably contains the most useful ideas about how to manage the acceleration.
  3. The Wikipedia article on emergence is a great read on the concept of emergence, with many example applications.

Requirements

The final project for the Python part of this course is to implement Emergence, satisfying these core requirements.

  1. You must have a group of creatures, which are displayed graphically.  The window should be no larger than 1024 x 768 pixels, so it can be easily displayed to the class using the projector.  zellegraphics should suffice for developing the GUI, but you are welcome to explore and use a different library like pygame if you wish.
  2. Their motion must be affected by their neighbors using the three emergence rules. (You may add additional rules as an enhancement -see below).
  3. You must use the rules to calculate a total acceleration for each creature, and its magnitude must be no larger than the creature's maximum acceleration.   You may want to do some experiments in order to determine a reasonable maximum acceleration.
  4. You must be able to interact with them in some way, either by introducing obstacles, or having them follow the mouse.
  5. You should have a way of adjusting the relative weights of the three accelerations derived from the Emergence rules.  This can be by changing the program code if you wish, but that should happen by simply changing the values of some variables that you define.
  6. Your project must use a GUI for game play. 
  7. You must define some kind of new objects, using a dictionary for each object as we did with Card objects in Session 16.
  8. All team members must contribute to their project and understand all of the code that their group submits. The instructor reserves the right to ask individuals about their understanding, and to adjust the grades of those individuals and/or the team accordingly. It is your responsibility to help your teammates understand the code that you write.

Much of your work on this project will be figuring out how to translate the emergence rules into a working design and implementation. If you are having trouble planning or getting started, get help. It is much better (and easier) to get help early and start off with a good plan than to try to hack a poor design into a semi-functional program in the final days before it is due.

Project Teams

Your project teams and repository information are available from this location. Each member of your team is advised to checkout your team repository at the start of the project. Before you edit code, documents, and other aspects of the project, you should update your local workspace, edit, update, then commit your work back to your repository. Using that cycle will minimize conflicts. Remember to provide appropriate commit messages and to do svn add if you want to add new files to your repository. Of course, don't forget to commit after you add new files.

Milestones

On Day 16, your team should determine what you expect to have done by the beginning of each subsequent class day! Each milestone will contribute to your overall project grade. Each milestone must be done before the specified class session unless specified otherwise. You should describe each milestone in terms of something that is testable, i.e., it should be something that the user of the program can see happening.  For each milestone, you must commit your work to your team's repository and include a clear commit message stating that this milestone is completed.   Your team's repository is named csse120-201020-teamXY, where X is your section number, and Y is your team number within that section.

Grading

Project grades will be based on both individual and group results. We will check off each project milestone, to make sure you are making steady progress. The final project program will be graded based on both the proper functioning of your program and an evaluation of your design, coding style, and documentation (including SVN commit messages).

Each team member will be required to complete an evaluation survey about his or her own performance and that of each of his or her teammates. We will use these surveys and our own observations to assign individual project grades. Individual grades will be based on your contributions to the project, how well you work with your teammates, and your understanding of all parts of your team's code.    If is not obvious from our work with you that you understand the code, we may ask to meet with you before assigning a grade.

Suggestions

Enhancements

Once you are done with the basic version, you may want  to add some enhancements for extra credit. You will earn a higher grade for doing more challenging ones, and the more, the better. Be creative. What's cool and challenges you?  Discuss your ideas with your instructor.