University of Utah School of Computing
EAE 2420:
Introduction to Computer Science II
Homework 11
Assigned: Tuesday, Nov 25, 2014
Due: Friday, Dec 12, 2014, at 11:59pm.

Homework 11

Part I: Implement a variation of the game below

You should implement something analogous to the game below. An exact copy is fine, or you can make some different decisions regarding gameplay, color choice, etc. The game takes place in a box (mine is 200x100x200. It begins with some balls bouncing around the box, these are the targets (my targets have a radius of 5). The user can push the spacebar to add "bombs" to the game which kill targets. My bombs begin with a radius of 2, but then shrink over a 10 second period until they are deleted. My bombs begin with a velocity in the direction the player is looking and slightly upward. They follow a balistic trajectory (a downward "gravity" force is continually applied) and have their velocities reduced slightly when they bounce off the ground. The targets follow linear paths and do not gain or lose energy when they bounce off the walls. The player can move around the box (and outside it) by pressing the arrow keys. The players view is 25 above and parallel to the ground. Here is my Camera class. It has methods to move the camera right/left and forward/back as well as to call gluLookAt(). There is a single point light source (fourth component of position is 1.0f) located in the center of the ceiling.

I will update this description with additional details as questions emerge. Please check back from time to time.

Do not put off this assignment! While in many ways this assignment is easier than some previous ones, some aspects can prove especially challenging/frustrating. When things aren't working you often just see a black screen, without any useful information to aide in debugging. There is also a fair amount of difficulty in understanding the OpenGL API well enough to use it effectively.

Part II: Re-write your kd-tree

Good programmers almost always write better code the second time around. The experience from the first implementation causes us to make different decisions. Write a new kd-tree from scratch for the targets in your game. On your webpage include a discussion of what decisions you made differently from your previous implementation (at least one!). Put all the targets into the kd-tree and use the kd-tree to provide fast collision detection between bombs and targets as well as between targets. You should be able to use the same sphere query as in the Boids assignement. When bombs and targets overlap they should both be removed. When two targets overlap, they should bounce off each other. It might also be interesting to have the targets interact in other ways.

Part III: Artistic Expression

Experiment with OpenGl lighting and materials and/or modify the game play in some interesting way. This could amount to having the targets behave as Boids or some other variation that makes the game more fun.

Part IV: Written Homework

What to hand in

Create a web page for the assignment. Add some screeshots from your game or, even better, add your game as an applet. Use the CADE online handin system to handin your source code. Please zip and handin your entire project directory (including an info.txt file). If you work in a team only one of you need to submit the source code. Hand the written homework in during lab.

Grading

This homework assignment will be worth 200 points instead of the usual 100. This week, the available points will be broken down like so:
  • 80 points: Game
  • 30 points: Re-written KD Tree
  • 30 points: Artistic Expression
  • 10 points: Comments describing the class, each method as well as the interesting pieces of the code itself
  • 10 points: Elegance of programming
  • 10 points: Web page
  • 30 points: Written Homework
Sorry, no Java support detected.

Left/Right arrows turn. Up/Down move forward/backward. Space fires.