ECE 462 Individual Programming Assignment
Space Invaders Game
In this assignment, you need to write a simplified version of the Space Invaders game. You can use either Java or C++w/Qt. However, if this is your second IPA, you must use the other programming language from what you used in your first IPA.
You are not allowed to copy code from any web site. [Review class policy]
Space Invaders was developed in 1987 and is still one of the most well-known classic arcade games. "Following its release, the game caused a temporary shortage of 100-yen coins in Japan, and by 2007 had earned its developer US$ 500 million in revenue. Guinness World Records ranks it the top arcade game." [1]
Game Components (for this assignment)
The Space Invader game has a menu and one component on its main window -- the playfield, and everything should be drawn into the playfield. The necessary contents of the menu and playfield are listed as follows:
- Menu items: Menu items named "Reset", "Clear High Score","Exit" can respectively restart the game, reset high score to zero and exit the program at any time.
- Title screen: A title screen is displayed before the game is started. You can design the title screen freely, but you must include instructions such as "Press any key to start". You may also want to put the how-to-play information within the title screen.
- Characters: There are at least 50 aliens and one cannon on the playfield.
- The four defense bunkers in the original game are not required in this assignment (but they are part of the bonus tasks, see Bonus for details).
- Messages: On the top of the playfield, there are two labels indicating the current score and the high score. The high score should be kept in a persistent storage (i.e. a file). At the very bottom of the playfield, the number of rest lives is displayed as a corresponding number of cannons on the left.
Game Rules
- Basic gameplay: The player controls the cannon at the bottom of the screen, which can move only horizontally. The aliens moves both horizontally and vertically (approaching the cannon). The cannon can be controlled to shoot laser to destroy the aliens, while the aliens will randomly shoot towards the cannon. If an alien is shot by the cannon, it is destroyed; if the cannon is shot, one life is lost. However, the position of the aliens will not be reset if the cannon is lost. The initial number of lives is three.
- Alien behavior: The aliens are aligned in a rectangular formation, floating slowly in horizontal direction. As the formation reaches one side, the aliens approach the bottom by a certain amount and start floating in the opposite horizontal direction. The aliens moves faster and faster as they come closer to the bottom. Any column of the alien may shoot a laser towards the cannon at a random time.
- Scores: Each eliminated alien is worth 10 pts.
- Completing a level: When all aliens are eliminated, the level is completed and a congratulation screen is displayed within the playfield. If the player's score is higher than the stored high score, the new high score is stored. No signature (i.e. record holder name) is needed for the high score. After the player hits any key, the game is reset to the title screen.
- Game over: When all lives have been lost, or the aliens have reached a certain vertical position (successfully invaded the planet), the game ends and a game over screen is shown in the playfield. If the player's score is higher than the stored high score, the new high score is stored. After the player hits any key, the game is reset to the title screen.
You may add any functionality as you want to improve the game experience, but you MUST first implement all the rules listed above as a minimal set of requirements. If you are not clear about any of the rules, please visit http://www.freespaceinvaders.org/ to learn from the game (it is not required to put the red "mystery ship", which occasionally appears at the top).
Grading Criteria
Program Functionality (4pt)
- (0.3pt) Main window: A main window appears after the program is launched. The window contains menu items and a playfield. No other components on the window are allowed (any function related to these extra components will not be graded).
- (0.5pt) Menu items: "Reset" menu item restarts the game. "Clear High Score" erases the high score record. "Exit" cause the program to quit. They are functional at any time.
- (0.3pt) Title screen: When the main window is shown, a title screen is automatically displayed within the playfield. The title screen should contain the name (preferably the logo) of the game, and an instruction telling player how to start and operate the game.
- (0.5pt) Basic rendering: One cannon and at least 50 aliens in a rectangular formation are rendered in the playfield component.
- (0.2pt) Text: The current player's score and highest scores are displayed at the top of the playfield. In the lower-left corner a number of cannons is drawn, displaying the number of lives left.
- (0.4pt) Control: the cannon can be controlled by both keyboard and mouse. It can move in horizontal directions. For keyboard control, the left and right arrow keys moves the cannon and spacebar key shoots the laser; for mouse control, the cannon is moved to the horizontal mouse position and a left button click triggers a shot.
- (0.6pt) Shots: player can control the cannon to shoot laser beams, while the aliens also shoot against the cannon at random times and positions. If an alien is shot, it is destroyed and 10 pts are added to the player's score. If the cannon is shot, one life is lost and a new cannon immediately appears at the same location.
- (0.2pt) Behavior of aliens: The aliens form a rectangular formation and zigzag toward the bottom of the screen. They gradually accelerate while approaching the bottom. See the original game as example.
- (0.2pt) Game status: Game score, high score and lives left are updated and rendered correctly. The high score is kept in a persistent way so that it won't be lost as the program exits. Game status is initialized whenever a new game is started.
- (0.2pt) Gameover: When all aliens are eliminated, a congratulation screen is displayed. If all lives are lost, or the aliens exceed certain vertical position, a gameover screen is displayed. In either case, the player can dismiss the screen by hitting a key and the game goes back to the title screen.
- (0.6pt) Demo mode (a.k.a attract mode): When a title screen is idle for 5 seconds (no keyboard input), the game enters demo mode, in which the cannon is controlled by computer. The computer-controlled cannon should be able to move and shoot occasionally. No AI is needed for the computer player. Whenever a key is pressed in demo mode, the game returns to the title screen.
Program Readability (1pt)
Code Standards (0.4pt)
- (0.2pt) The code is formatted uniformly (use the function in your IDE). Classes, objects and members are named nominatively. This is a C++ coding standard for your reference.
- (0.2pt) There should be explanatory comments to help readers understand your code. Give a brief description about the class at the beginning of each class file.
Documentation (0.6pt)
- (0.4pt) Explain what the classes and objects are involved in this program and their functions and give necessary UML diagrams (they are graded). You should particularly focus on inheritance and polymorphism (if there is any), explaining how and why you use them.
- (0.2pt) Explain your implementation for animation, double buffering, and other rendering issues. Specify the classes and objects you used in relation to these issues.
In addition to the above checkpoints, please list everything you have implemented in your documentation. If something is implemented in the source code but not mentioned in your documentation, it is not graded and you will not receive any point.
Your documentations can be in one of two formats (1) PDF or (2) README. A Word file is not accepted because there are too many versions of Word programs and the formatting can be different. README is an ASCII file and the name must be README. This is a widely accepted convention by millions of people. The file name is not readme, readme.txt, Readme, or anything else. It must be README. If you writes README file and what to include UML diagrams, you can submit the UML diagrams as separated PDF files. Any other formats, such as pictures, Visio files, NetBeans diagrams etc., are not accepted. You can use "Print to File" or PDFCreator to export your diagrams as PDF files.
If you submit a PDF documentation, please embed the UML diagrams into the documentation.
Avoid plagiarism: Whenever you cite text, pictures, ideas, etc., be sure you include the source in your reference. This includes information from the Internet.
Bonus (2pt)
- (0.5pt) Use of sound: if you use any sound in this assignment, you may get bonus points. Please note that you have accomplished this bonus task in your documentation.
- (0.5pt) "Mystery Ship": every certain amount of time, a red "mystery ship" emerges at the top of the screen and move from left to right. If the mystery ship is shot by the cannon, 200 pts are added to the player's score.
- (0.5pt) Bunkers: add four defense bunkers between the aliens and the cannon. Each bunker can endure several shots from either side, providing shelter for the cannon.
- (0.5pt) You can make an original improvement to the game to make it more interesting. Describe your improvement in the documentation. The bonus points are given based on originality and technical complexity of your improvement.
|