B. High Level Design

B1. Rationale and Sources of Project Idea

Our idea of creating a Shooting Star video game is inspired by most of the addictive shooting games. We like to play these games at arcade and also on computer; hence, we think, why not, we make our own game. We choose this concept of Shooting Star, because we want the game to have no ending state. In this game, if the player is very perfect at dodging all those dropping stars at a very fast speed, it is very possible for the player to stay alive and keep on playing the game infinitely. There are 10 columns, and at each particular time, only one star drops from one of those columns. However, for level 6 and beyond, the speed is so fast that only very capable players can go through. Fundamentally, this Shooting Star is analogous to a person's life, especially a student's life, who always strives for the best. Hence, having this game with a permanent high score list would motivate the players to keep on pursuing their personal best and set the record in the high score. This game is somehow similar to Galaga, which is a classic arcade game in the 80's, but we have modified it in our way, and make our game much more attractive, especially where we can leave the screen from one side and appear at the other side, which is similar to the feature in PacMan.

B2. Background Math

For our project, we pretty much use basic Mathematics only. Most of the calculations are addition, subtraction and a couple of multiplications. We do make sure that all the castings are done perfectly and ensure that all the calculations are correct.

We maintain a global variable "score", and whenever a star is shot, whether be a stationary star or a moving star, we would calculate the appropriate score. A stationary star worths 10 points. For a moving star, the point is calculated based on the following formula:-

New Score = Old Score + 10 + (Difficulty Level * 10)

After clearing each level, the player would get a bonus point. It is calculated based on the following formula:-

Bonus Point = 100 * (Difficulty Level)

Also, we increase the speed of the dropping star in a nice function. We set a variable t1 to control how often / how many frames we should drop a star. Each frame is 1/30 second. So, for Level 1, the easiest level, we drop the star every 33 frames by setting t1 = 33. This speed is suitable for people of all ages to attempt, and hence provides every player the satisfaction of clearing a level. For Level 2, we set t1 equal to 23 frames, a reduction of 10 frames. Then we further reduce the speed to 15 frames for Level 3 (reduction of 8 frames), 9 frames for Level 4 (reduction of 6 frames). At Level 4, it would be every 9/30 seconds for the star to drop one notch. If the star is at the 5th row, which is the lowest row, it would take 8 steps to reach the bottom of the screen. Then the star would disappear upon performing the 9th drop, and the player loses 20 points for failing to shoot the star. So, at this stage, it would be about 72/30 seconds or 2.4 seconds for the player to react and shoot the star. This is the level where the player would need to play more cautiously. Gradually the game gets more challenging. At Level 5, the dropping speed is 5 frames, and at Level 6, it is 3 frames, which is essentially 24/30 second or 0.8 second for the star to drop from the 5th row to the bottom of the screen. For the top row, it would have 12 drops, hence 36/30 second or 1.2 second. The game goes on to every 2 frames for Level 7 and every 1 frame for Level 8. We tried out the game at all levels up to Level 30, and it worked perfectly.

B3. Logical Structure

The game starts by showing the initial page, with the title "Shooting Star" that is designed using bitmap. Below the title, we have a star moving continuously across the screen from left to right, animating the page, while waiting for the player to press Button B on Sega Genesis Controller. When the player presses Button B, the screen is erased from left to right, displaying the page on which level the game is in. The game starts from Level 1. This page will last for 70 frames. Then it is erased from left to right to the main frame of the game. The feature of screen clearing caught the attention of many students in the class, who were curious how to make that effect. From there, the player starts playing Level 1. There would be point addition for every star being shot, and point deduction for every star that reaches the ground. For the star that hits the space shuttle, 1 life will be deducted. The player starts with 3 lives. When a life is deducted, the player has to replay the entire level again. We also check the score of the player; every time when he/she gets 1500 points, he/she will gain a life. When the player goes through a level, he/she will get bonus with sound effect, where the interface will show the number of level the player is in. After 70 frames, the player starts to play the next round. This goes on infinitely until the player loses all lives. When that happens, we will show the space shuttle disappear with sound effect, and then a page showing "Game Over" will last 70 frames. Then the screen shows the High Score page, where the user will see whether his/her score is placed within the top 5 scorers. If the player presses B Button, it will go back to restart the game at Level 1.

The Logical Structure of a State Machine is attached at Section F2, Appendix 2a.

For this Shooting Star game, we put more efforts into the software components. For hardware, we utilize one Atmel Mega32 MCU with a Sega Genesis controller. We solder the wires connecting the controller with a connector socket to ensure that we can connect into the controller easily each time we go to the lab. We use a black and white TV that works with NTSC signal to display the game and the TV audio to play the sound. The MCU is used to do all the calculations, drawings of frames, etc. The Sega Controller is the user control input, which sends push pulses to the MCU. As the TV is very time critical, we have to be extra careful in the timing and synchronization of the signals. We are often limited by the number of characters able to be drawn on a single frame. On a few occasions, we need to draw a screen over a few frames in order to avoid any flickering image.

For this game, we use more than 2000 lines of codes, and hence, we have to try our best to optimize in terms of global variables, as we only have limited space allocated by SRAM. With some modification of our code, and also limitation of extra features we could have developed, we are able to come up with a very playable and addictive game of Shooting Star.

B5. Standards Requirement

We are using a black and white television that is available in the lab to display the game. It follows NTSC video standards as well as RS170. There are 525 lines per frame and 30 frames per second. Similar to Lab 4, we do not implement interlacing, since our program do not require very extensive resolution. Moreover, interlacing increases our processing time and outputs duplicated lines for every new line created. The voltage levels follow the rate required by NTSC to generate the black and white signals, as well as the sync signals, such as the horizontal sync pulses and vertical sync pulses. We use standard RCA cable to connect to the TV video and audio inputs.