Final Project Documentation- Bird Sound Game

For my final project, I have created an audio focused game that is played by a user listening for a bird sound’s in various scenarios. A user then can press a key if they think they heard the bird and based on; if they were right or wrong. The user would then gain points or loose attempts. If you use up more than three attempts you lose the game. The game really requires a user to use their listening skills and tests the user’s ability to focus. Below I have attached a picture of the games start screen. The link to the game and all of its code is:

https://alpha.editor.p5js.org/shahriarsadi98/sketches/BkHJGovhz

A link to the google drive to access much of the games audio files and visuals:

https://drive.google.com/drive/folders/1hJmN0dj4OaV0l20YK7rFIx935Wz5Lb6X?usp=sharing

I created the game solely in p5js, I chose to use p5js over processing in Java is because of the libraries in p5js, the most important of which was scene manager. Scene manager allowed me to create a start menu, and instruction menu, a game function, winner and looser screens. Using scene manager I was easily able to switch to those scene’s and not have one scenes code effect others. Below I have attached an image of some snippets of the scene manager code. I also had various menus with buttons which would lead to new scenes and having scene manager really made the process easier.

Another crucial aspect of the game was a timer, I need the timer in order to keep track of what time the user clicked on the key and if it matched up with the correct time the bird sound played. The timer had to be activated exactly when the user was in the game function menu. I did not want how long the user was on the start menu to affect the game. So I created a variable called offset to mitigate that issue and subtract it from a variable I had called game seconds. Below I have attached an image of some of my code for the timer.

An issue that I ran into while making the game was that the audio would run in a never-ending start loop, that sounded screechy. I mitigated this by creating a preload function and the audio played smoothly. Scene manager made it easy so the audio files only played when they were in their given menus. I created a point system and attempt system under my key pressed function and setting if statements to check when the key was pressed and to act accordingly. I have attached below, screenshots of both the attempts and score code snippets.

My game also has this visualizer which I coded to move with how loud the sound is in game. To give the user a visual in to maybe help the user in a way and overall I think it looks cool and helps with the overall game aesthetic. One addition I wanted to add to that portion was color changing based on if the user gets an answer right or wrong. I tried to get it to change color, but everything I tried simply did not work. Hopefully, in the future, I can fix this.

For the future of this game, I would like to do two things, one have the game be more automated and random. Right now the game follows a sequence if the audio clips and random and unpredictable in when the bird will come. It will make the game more challenging and fun. I already have an idea on how to achieve that. Which would be to upload all bird noises and scenarios into p5js and then creating an algorithm to play the sounds randomly and then a if statement to see if a specific bird sound is played and the user clicks a button then give a point. Another addition I would like to add is a high score system and then a twitter bot that would tweet out anytime the high score is beat. I believe both of those are possible and something I will be working on over the summer.  I hope you enjoyed my final and having me as a student. I really enjoyed your class and learned a lot. I hope to one day have a class with you again thank you very much for a wonderful semester.

If you would like to see the slides I have attached them below here as well.

Bird Audio Game Final Presentation