Cornell Hockey
ECE 476 Final Project
Rives Borland
Ryan John
Brian Tarricone
news | intro | hardware design | software design | other considerations | code | results | next time
Software Design
Overview
The software layout is relatively simple. The main feature is the interrupt code
for handling the NTSC drawing routines. The screen (a 128x100 raster) must be
refreshed 60 times per second, leaving a small amount of dead time between
frames for making calculations and changing the positions of drawn items on the
screen.
The game itself consists of a state machine, plus a large amount of logic
detailing how the puck, players, and goalies should move, as well as handling
scoring and timing. The state machine handles what part of gameplay the players
are currently experiencing. The largest state by far is the state detailing what
happens when a hockey game is actually in session. Other states handle the
welcome screen, end-of-period screen, team selection screen, etc.
Controls
START - Toggle through menus, Pause game during game mode.
A - Toggle through some menus, Switch control between Skater and Goalie
B- Speed Burst. Speed Burst is not infinite. Skater must rest after using
Speed Burst before using speed burst again.
C - Shoot: The longer you hold the button, the harder the shot.
Up/Down/Left/Right - Move the Skater or Goalie. (Goalies can only move up or
down)
Gameplay
Like in real hockey, each game consists of three twenty minute periods (the
clock can be sped up). If at the end of 3 periods, the score remains tied, then
sudden death overtimes are played until someone scores a goal.
A goal is scored when the puck is shot past the Goalie inside the Goal. The
team with the most goals at the end of the game wins.
Before each game, each player can select from 1 of 4 teams. Once a team is
selected, each player can choose 1 of the 3 players from that team to be their
Skater. Each player has certain strengths and weakneses.
Finally, you can choose a period length. The options are 10, 5, 3, and 2 minute
periods. Note that the game clock always counts down from 20.
Goalies
Each goalie has an associated speed and save percentage. The higher the goalie
speed, the faster the goalie moves. When the goalie is in front of a puck it
stops the puck some of the time based on the Goalies Save Percentage.
There is rudimentary AI that will position the Goalie in the best position to
make saves. The user can also take control of the goalie.
Skaters
Each skater has several attributes associated with them. They are as follows
Speed- How fast the skater is
Speed Burst- The strength of the speed burst
Fatigue- Determines the length of the speed burst
Puck Skill- How good the skater is at handling the puck and winning battles for
the puck
Max Shot Power- How fast they can shoot the puck
Shot Power Increase- Determines how long the shoot button must be pressed before
maximum shot power is reached.
Skaters can move around the rink and shoot the puck. When a skater does not
have the puck they can try to steal it from the other skater by running into
them. The game then determines who will win the puck by looking at the Puck
Skill of each player. A player with a higher Puck Skill has a better chance of
winning the puck.
If the goalie is being controlled by the player, the skater will follow the
basic AI that was developed. The skater will basically chase after either the
puck, or the other teams player if they have the puck. Once the puck is stolen
or the other team scores, control is given back to the skater automatically.
State Machine
The code is organized based on the TV signal. Whenever the TV signal is at line
231, we run a finite state machine to determine what should be done.
ST_WELCOME:
Displays the Welcome Message.
ST_TMSEL:
Allows both players to select between the 4 teams
ST_PLSEL:
Allows each player to select the Skater they want to play with. There are 3
skaters on each team. Each skater has unique characteristics that determine how
well they play.
ST_LENSEL:
Allows the user to select the actual running time of each period.
ST_PAUSE:
Pauses the game during ST_PLAY
ST_GOAL:
This state updates the score, and displays and erases the Goal message.
ST_FACEOFF:
This state waits 3 seconds before "dropping" the puck to simulate a faceoff.
The Face off state occurs at the beginning of every period and after each goal
that is scored.
ST_PLAY:
This is the state where the actual game is played. The skaters, goalie and the
puck are updated on each cycle to successfully simulate a hockey game. The code
ensures that the players and puck stay within the rink at all times.
The puck obeys the laws of physics including deadened bounces off the walls and
slowing due to the friction from the ice.
The running game clock is updated every cycle as are all other variables that
pertain to the game.
ST_PEREND:
This displays the End of the Period screen.
ST_ENDGAME:
This state displays the end of the game message that tells you who won the game.
Sound
All of the songs that are included in the game were stored in Flash arrays. The
frequency of the note along with the duration are stored. The sound is
generated though PORTD.0.
We wanted our game to be as close to being in Lynah for a hockey game as
possible so we added the following songs that you would hear at a Cornell Hockey
Game.
Davy- Cornell's Fight Song- plays after every goal
Alma Mater- played at the end of the game (during real hockey games played
between 2nd and 3rd period)
Gary Glitter- Played at the beginning of the 3rd period.
The following Cheers are also included:
#7
Hey Baby
Miller Time
Macho Man
The songs were added for the enjoyment of the player and to make it feel more
like a real hockey game. Enjoy!