This is an old revision of the document!
Implementing a Game with Sound, Having Fun with Your Laser-Tag System
To complete this milestone, you will implement a complete game that supports play between two teams (of any number) Unlike your other programming assignments, you are free to implement the game as you like, as long as you meet the requirements for game functionality, including sound. The coding standard still applies.
Note that the following files are provided in your ecen390 project directory. Refer to the comments above each function for more detail.
You are expected to create and implement the following file. See the provided header file (.h) for more detail.
You are provided working sound code and sound data in the sound subdirectory. While coding this milestone, you need to add calls to these sound functions so that various sounds are made during game play.
Please read the comments and the sound_runTest() function in sound.c to see how to use the sound code (it is straightforward).
Note: Make sure to add sound_tick()
to isr_function() along with all of the other _tick()
functions.
WARNING!!! WHEN SET TO ITS MAXIMUM VALUE, THE SOUND VOLUME MAY DAMAGE YOUR HEARING IF YOU PLUG EARPHONES INTO THE ZYBO BOARD. Volume can be controlled by using the function 'sound_setVolume()', found in the sound.c file. Please read sound.c for more detail on how to use this function.
These videos demonstrate when sounds should be played and also show more detailed behavior of the game.
The game functions as follows. The game is essentially a version of “last person standing”. The game ends when all of the members of either Team-A or Team-B have “died”. The winning team is the team that has at least one member remaining “alive” at the end of the game.
Note that the numbers below have been refined over several playing sessions. The current configuration seems to provide a nice balance of fun game play and low complexity.
Sound is essential to game play. It informs the player when they have been hit, when they have lost a life, and when they have expended all lives and must drop out of the game. In detail:
These videos demonstrate when sounds should be played and also show more detailed behavior of the game.
A sketch is given below as a starting point for an implementation of game.c. You will need to finish the implementation.
Feel free to copy code in runningModes.c
to jump start your implementation of game-play mode. However, you will be responsible for making sure any “copied” code still meets the coding standard.
/* The code in runningModes.c can be an example for implementing the game here. */ #include <stdio.h> #include "hitLedTimer.h" #include "interrupts.h" #include "runningModes.h" // This game supports two teams, Team-A and Team-B. // Each team operates on its own configurable frequency. // Each player has a fixed set of lives and once they // have expended all lives, operation ceases and they are told // to return to base to await the ultimate end of the game. // The gun is clip-based and each clip contains a fixed number of shots // that takes a short time to reload a new clip. // The clips are automatically loaded. // Runs until BTN3 is pressed. void game_twoTeamTag(void) { uint16_t hitCount = 0; runningModes_initAll(); // Configuration... // Implement game loop... // End game loop... interrupts_disableArmInts(); // Done with game loop, disable the interrupts. hitLedTimer_turnLedOff(); // Save power :-) runningModes_printRunTimeStatistics(); // Print the run-time statistics. }
Grades for Milestone 5 will be determined by the functionality of the game and the lack of observable bugs. Groups will get credit for each feature that is correctly implemented.
One of the best ways to find bugs in your system is to play it extensively. If the TA detects a bug during pass off, the team can attempt to fix their system and pass off later. However, don't depend upon the TA to detect bugs in your system. You must test and fully debug your system prior to bringing it to the TAs for pass off. If pass-off attempts become excessive, we will institute a penalty of some sort.
Assuming you added your code to runningModes2.c, you will use ./check_and_zip.py 390m5
to prepare your zip file for submission to Learning Suite. It will be checked for adherence to the coding standard.