This shows you the differences between two versions of the page.
milestone_5 [2022/03/18 16:21] scott [Source Code] |
milestone_5 [2023/03/27 10:30] (current) scott [Code Submission] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Milestone 5 ====== | ====== Milestone 5 ====== | ||
- | Implementing a Game with Sound, Having Fun With Your Laser-Tag System | + | Implementing a Game with Sound, Having Fun with Your Laser-Tag System |
===== Overview ===== | ===== Overview ===== | ||
- | To complete this final 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. | + | 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. |
---- | ---- | ||
Line 12: | Line 12: | ||
==== Source Code ==== | ==== Source Code ==== | ||
+ | Note that the following files are provided in your ecen390 project directory. Refer to the comments above each function for more detail. | ||
- | [[https://github.com/byu-cpe/ecen330_student/blob/master/lasertag/runningModes.h|runningModes.h]] | + | * lasertag/main.c |
+ | * lasertag/game.h | ||
+ | * lasertag/sound/sound.h | ||
+ | * lasertag/sound/sound.c | ||
+ | * lasertag/support/runningModes.h | ||
+ | * lasertag/support/runningModes.c | ||
- | [[https://github.com/byu-cpe/ecen330_student/blob/master/lasertag/runningModes.c|runningModes.c]] | + | You are expected to create and implement the following file. See the provided header file (.h) for more detail. |
- | The file ''runningModes2.c'' is provided as a place for you to write your game-play code. 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. | + | * lasertag/game.c |
- | [[https://github.com/byu-cpe/ecen330_student/blob/master/lasertag/runningModes2.c|runningModes2.c]] | + | ---- |
- | ==== Sound Code and Sound Data ==== | + | ==== Making Sound ==== |
- | You are provided working sound code and sound data. All sound data are contained in the sounds subdirectory of the lasertag directory. While coding this milestone, you need to add calls to the sound functions so that sounds are correctly activated during game play. | + | 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 function sound_runTest() function in [[https://github.com/byu-cpe/ecen330_student/blob/master/lasertag/sound.c#L281|sound.c]] to see how to use the sound code (it is straightforward). | + | 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 ''_tick()'' functions.// | + | //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. THE INSTRUCTOR STRONGLY RECOMMENDS USING THE ATTACHED SPEAKER WITH VOLUME SET TO ITS LOWEST SETTING WHEN IMPLEMENTING YOUR GAME. Volume can be controlled using the 'sound_setVolume()' that can found in the sound.c file. Please read sound.c for more detail on how to use this function. | + | 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. |
- | ==== Videos ==== | + | === Videos === |
These videos demonstrate when sounds should be played and also show more detailed behavior of the game. | These videos demonstrate when sounds should be played and also show more detailed behavior of the game. | ||
Line 75: | Line 81: | ||
- A voice will inform a player when they must drop from the game and "return to base." This voice sound will be infinitely repeated, alternated with 1 second of silence. | - A voice will inform a player when they must drop from the game and "return to base." This voice sound will be infinitely repeated, alternated with 1 second of silence. | ||
- | These videos demonstrate when sounds should be played and also show more detailed behavior of the game. | + | ---- |
- | - [[https://youtu.be/klppe7oTng4|Sounds related to the gun, how the clip works, reloading, etc.]] | + | |
- | - [[https://youtu.be/IDhDzBggeeo|Sounds made when hit by an opponent.]] | + | ===== Implementation Details ===== |
- | - [[https://youtu.be/TV2oLZurPTU|Sounds that occur at the end of the game.]] | + | |
+ | ==== Game Code Sketch ==== | ||
+ | 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. | ||
+ | |||
+ | <file C game.c> | ||
+ | /* | ||
+ | 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. | ||
+ | } | ||
+ | </file> | ||
---- | ---- | ||
Line 96: | Line 141: | ||
- Incorrect game play. | - Incorrect game play. | ||
- | 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. | + | 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. |
---- | ---- | ||
Line 102: | Line 147: | ||
===== Code Submission ===== | ===== Code Submission ===== | ||
- | 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 [[http://byu-cpe.github.io/ecen330/other/coding-standard/|coding standard]]. | + | 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 [[http://byu-cpe.github.io/ecen330/other/coding-standard/|coding standard]]. |