C. Program/Hardware Design
C1. Program Details
At Section B2 and B3, we have provided a little background information on the calculations and logical structure of the project. In this section, we will focus on each portion of the program.
a) Initial Page
For the initial page of the project, we display a design of our title "Shooting Star" with a unique font, which we have done using Microsoft Word, magnifying the words and then drawing it pixel by pixel on paper. Eventually we program it in C and store it in the Flash memory. We also have a fast-moving star from the left of the screen to right, disappearing and reappearing again on the left. This is more for the decorative purpose, which will serve as the page when we wait for the user to get ready for the challenge of "Shooting Star". When the user is physically and mentally ready, he/she can press Button B in the controller, and the game is ready to start!
b) Page Displaying Level
Then we move on to the second page, which shows which level the user is in. The page will stay for 70 frames before we move on to the main page of the game.
c) Number of Lives
For each game, we give the player three lives to start with. The display shows 2 lives remaining, as the player is playing with one of the lives. Every time when the player gets 1500 points, he/she would gain a life. We have also taken into account that the player might have reached more than 1500 points, and then have points deducted due to the star hitting the ground, and hence may try to manipulate the game by keeping on reaching above 1500 points and then getting points deducted. So we have built in a variable "extraLifeThreshold", which will be increased each time a player gets a bonus. So a player wouldn't be able to get twice of the bonus at one particular point level.
d) Generation of Random Stars Dropping
We utilize a random function to drop a star in one of the 10 columns. It will be generating through a natural random function provided in the C API. When one of the columns is selected, we check for the lowest star (i.e. higher on y value for the video line), to drop towards the bottom of the screen. The star will drop vertically down. It will move at different speeds, with respect to the difficulty levels of the game. The speed will increase in decreasing interval for each difficulty level increment. This part is explained earlier in section B2.
e) Dropping Star Hitting/Missing the Space Shuttle
If the star hits the space shuttle, the player loses a life, and has to restart the game at that level. If the star misses the space shuttle and the player does not manage to shoot down the star, the player would get 20 points deducted. This is to force the player to take the risk to shoot the star.
f) Points Calculation (Hitting Stationary vs Hitting Dropping Stars)
As mentioned in e), 20 points are deducted for the star that reaches the ground. If the score was reduced to 0 point, the player would lose a life. We have taken into account that at the moment when the game starts, the player has 0 point, so we only penalize the player after he/she has managed to hit at least one star and gained some points. For every stationary star being shot, the player would get 10 points added. To encourage the players to shoot the moving star, each moving star would get more points based on the formula as shown in Section B2. Basically, the points would increase with higher difficulty level.
g) Bonus For Level Clearance
Moreover, if the player manages to clear all the stars for a particular level, he/she would get bonus points, proportional to the level of difficulty, based on the formula as shown in Section B2.
h) Special Feature: Space Shuttle Disappearing & Reappearing
In this game, we allow the space shuttle to disappear from one side of the screen and reappear at the other side of the screen. It works perfectly well. This allows the player to react faster, when he/she is at one side of the screen and a star starts to drop at the other side at a very fast speed.
i) No Rapid Fire
To make the game more challenging, we also implement button release detection. Hence the player cannot use rapid fire by just holding down the shoot button. The player can't just shoot 10 bullets out at one go with a single press of the button. This will increase the playability of the game.
j) Space Shuttle Movement
The main control by the user would be the space shuttle. As we want to keep the space shuttle on the ground level, we only set left and right inputs from Sega Genesis Controller for the space shuttle's movement. We could easily allow the space shuttle to move up and shoot the star, but that would make the game much easier to go through, as the distance for shooting a star would be much smaller.
k) Bullet Shot by Space Shuttle
We allow the player to press Button B of the Sega Genesis Controller to shoot bullets at the stars. But we do not allow rapid fire as described above. The bullet is shot vertically up, and hence it requires the player to be vertically below the stars and does not have any room for shooting the stars at an angle. This would make the game much more challenging, especially at those higher difficulty levels, the speed of the dropping stars are much faster.
l) Sound Effects
To make the game more fun and more addictive, we incorporate sound effects as well. We have different sounds played whenever the player shoots a star, a star hits the space shuttle, a level is cleared, or the game is over.
m) Game Over
When the player loses a game, i.e. all three lives are lost and a star hits the space shuttle, a page showing Game Over would be displayed for 70 frames, which is slightly more than 2 seconds.
n) High Score
We utilize EEPROM to store the high scores as well as the levels reached. We store the top 5 scores, and rank them based on points. We do not rank them based on level, since we have incorporated bonus points for each level clearance, where different bonus points are added in correspondence to different levels of difficulty. This also prevents the player from just trying to avoid the dropping stars in order to move to higher levels without shooting down any star. So, we only rank by high scores. If there is a tie between two scores, we rank the latest score behind the previous score, since the player does not beat the previous players.
C2. Hardware Details
For the hardware part of the project, we use a Sega Genesis Controller as the user control input for the game. The Controller is connected with a 9-pin connector socket, which we soldered using nine wires, so that we do not need to reconnect the wires each time. The controller connection and pin layout is attached in Section F2, Appendix 2b.
We also utilize the Digital Analog Converter, which is connected to the TV using clip leads and a RCA phone jack. The TV is set to video mode, and connected to Port D. PORTD.5 is used to generate the sync function, whereas PORTD.6 is used to generate the video signal. For audio, the TV's audio input is connected to Port B.3 with a low pass filter and the Game Controller is connected to Port C of the ATMEL Mega32 STK-500. The schematic for our hardware is attached in Section F2, Appendix 2c.
C3. Things You Tried Which Did Not Work
We tried to implement some extra features, like different shapes suddenly appearing on screen, if the bullets from the space shuttle successfully hit them, the player would gain more bonus points. However, we are unable to implement this due to the limitation of the SRAM. Also due to time limitation, we are unable to go over and make huge overhaul in our coding to get more features implemented.
We also tried to showcase more graphics in each page, especially in the main page and the transition pages, but due to timing issue, there are flickering. So eventually, we simplify our graphics and use more characters of 3*5, rather than 5*7.
We also tried out different combinations of sound effects as well, and eventually implemented these more suitable sounds.