Program 5: Putting it all together — Asteroids!

 




Due: 

  • Partial due: Tuesday, November 23 11:59pm
  • Final due: 
    • 461: during final period — Thursday, December 2nd 3:30pm
    • 561: during final period — Thursday, December 2nd 8:30am

Goal: In this assignment you will apply what you've learned of basic WebGL and GLSL to build a simple game.

Submission: Submit your partial and final assignment using this Google Form, and demo your assignment during the final exam period.

BASIC GRADING:
The main components of this programming assignment are:
  • 5% Part 0: partial turn in and feedback
  • 5% Part 1: properly turned in program (new requirements!)
  • 20% Part 2: display and animate the asteroids
  • 25% Part 3: display and animate the ship
  • 25% Part 4: add collision detection and response
  • 20% Part 5: add shooting and response
  • Participation credit: Receive participation credit (outside of this assignment) for posting your resulting imagery and video, good or bad, on the class forum!

General:
Our suggested game is a 3D version of Asteroids. If you are not familiar with the game, you can play it online here or here, view some historic gameplay on arcade or console, and find more information about the game at its Wikipedia entry here. There are also many other sources online.

If you would rather implement a different game, you may do so, providing you ask for instructor's approval by Thursday November 18. To obtain that approval, submit your proposal using this form. Small teams are also acceptable, but the scope of the project must increase to match. Use the same form if you wish to propose a group project. For example, we will approve two-person teams that propose building Asteroids as described below along with all extra credits to earn 100%. 

Unlike previous programs, your game is not required to load specific assets (models, textures or lighting). You are free to hard-code paths to the assets your game requires.

You may use any 3rd party game or graphics libraries you find, including three.js and Unity, to earn full assignment credit — or you may use only WebGL. This is in contrast to previous years, which penalized use of 3rd party libraries slightly. You may not use code from any implementation of Asteroids you find online. We are aware of several such implementations and will be comparing them to your code.

This semester is 1-2 weeks shorter than previous semesters, so we have reduced the scope and requirements of this assignment in comparison to previous years, including permitting use of 3rd party libraries, and simplifying game mechanics such as ship movement and missile strikes.

Part 0: Partial feedback
You should turn in an "ugly," incomplete version of your program by the date noted above. If you simply turn in something that makes an image, you will receive full marks (5%), and receive comments on what you've done. We will not otherwise grade the assignment at this point, only comment on it.

Part 1: Properly turned in program
Remember that 5% of your assignment grade is for correctly submitting your work! For more information about how to correctly submit, see this page on the class website. Since we encourage variation in your games, make sure to include a readme file.

For this assignment only, you can also earn extra credit (461: 2%; 561: 1%) by allowing us to make your assignment public, and providing us with some extra material to aid us in that. We will pick a few of the best assignments and publish them on our course website. If you wish to allow us, please also deliver:
  • a description: your game in four sentences or less
  • a screencast: a video walking us through your game within a few minutes. We suggest using Zoom to create the video, by starting a Zoom with only yourself logged in through NCSU, presenting the tab with your game in it, and pressing record.
Assignment material is due online by the time of your final, as noted above. You must also demo your game live to teaching staff, either in person during the final period, or during one of these Google Calendar appointment slots (to appear), which you must reserve yourself. In exceptional circumstances, earlier live or recorded demonstrations may be arranged with the approval of staff. Late demos are not possible. If you do not demo your game, you will forfeit the full 5% for proper turn in. Late improvements of assignments will be accepted online December 3 (just one more day), with a late penalty of 3%.

During the final exam period, you may optionally demo your game in front of the class (without a separate demo to staff). If you do, you will enter the competition for a $20 Amazon gift card. You will win if your fellow students vote your game the best. Students in teams cannot enter the competition.

Part 2: Display and animate the asteroids
Create and render at least three asteroids. Models should be 3D, and the projection must be perspective. Fancy modeling is not necessary; cubes or spheres are enough. Asteroids begin the game moving in a random direction, and continue in that direction until shot by "wrapping around" the screen. 

Part 3: Display and animate the ship
Create and render one ship. The model should be 3D, again in perspective with a simple shape adequate, e.g. a cone. The 'a' and 'd' keys rotate left and right in the view plane, while the 's' key moves the ship in the direction the ship faces. To simplify control mechanics, you need not implement acceleration or deceleration (as in the original game, though you may for extra credit below); simply stopping motion when 's' is released is enough.

Part 4: Add collision detection and response
When the ship collides with an asteroid, the ship is destroyed. We suggest detecting collisions using circles; the collision need only be approximately accurate. 

Part 5: Add shooting and response
When the user presses the space bar, the ship releases a missile in the direction the ship faces. The missiles need only be a simple shape, e.g. a small cube. The asteroids should change direction and color when they are struck by a missile. To simplify control mechanics, you need not divide the asteroids into smaller asteroids when they are struck (as in the original game, though you may for extra credit below); instead, change the color of the asteroid each time it is struck. On the fifth strike, asteroids disappear.

EXTRA CREDIT GRADING:
Extra credit opportunities include the following, with values in format (461, 561)%. Other extra credits are possible, but must be approved by teaching staff in advance to ensure credit:
  • (1, ⅓)% — track and display score. You can choose any scoring scale you want. Typically, one scores in Asteroids by striking asteroids, and clearing levels.
  • (1, ⅓)% — add a "first-" or "third-person" view, with the camera attached to the ship.
  • (1, ⅓)% — add animated effects, which appear when the ship flies (e.g. rocket plume), when the ship is destroyed, or when a missile strikes an asteroid.
  • (2, ½)% — play music, and on game events play a sound, e.g. on collisions and clearing levels.
  • (2, ½)% — add at least one level, which increases difficulty. In Asteroids, this typically means more and faster asteroids.
  • (2, ½)% — add two power ups, e.g. brief collision protection, or teleportation to a random location. 
  • (2, ½)% — support a second player, either with different keys or the mouse.
  • (4, 1)% — add acceleration and deceleration to movement (the ship is rarely still).
  • (4, 1)% — asteroids spawn smaller asteroids when struck.
  • (20, 5)% — 3D asteroids: a cubic field of play, rotation and movement in 3D, 3D view control to enable 3D play.