Maddie Fisher-Bernhut, Donato Liotino, Ola Soszynski
Our main inspiration for this experiment was arcade shooting games, where the player earns points by shooting various targets. However, we mostly wanted to work with some new sensors in Arduino. Specifically, we were very inspired to figure out the gyroscope accelerometer, and the Bluetooth connectors. Other things we wanted to work with were vibration motors in regards to some game concepts we had in mind.
Originally, we planned on having the game be competitive, with two players versing each other to earn more points, or to defeat the other. We wanted a fun, wireless shooting game, and were inspired by similar games, often seen in arcades. This would encourage friendly competition between players, and generally create an enjoyable experience. The experience would be inspired by sci-fi movies and shows, such as Doctor Who, and fantasy, such as Harry Potter. The two players would fight each other, trying to defeat the oppositions’ creature, also themed or inspired by their theme.
For inspiration, we looked at how competition assists one’s performance, as well as if any games like this had been made in p5 before. This led us to https://www.bigfishgames.com/online-games/8942/shooting-range/index.html, for games similarly made, and a basic game on DOS named Shooting Gallery (https://youtu.be/incPLdf712M). https://www.theglobeandmail.com/life/health-and-fitness/why-a-bit-of-healthy-competition-is-good-for-everyone/article8749934/, and
https://www.psychologicalscience.org/news/minds-business/the-upside-of-rivalry-higher-motivation-better-performance.html helped us read into how competition helps, regardless of the fact we did not end up making a competitive game.
Goals of the Experiment:
1. Use and learn Bluetooth for Arduino
- With the NRF Bluetooth for Arduino, we found a tutorial, but decided against actually implementing wireless communication in the final product due to complications, bulkiness and not fully comprehending how the code and circuit operated. (https://howtomechatronics.com/tutorials/arduino/arduino-wireless-communication-nrf24l01-tutorial/)
2. Use and learn the gyroscope accelerometer
- In setting up, configuring and understanding the gyroscope, we found some links that helped us understand how we could use the gyroscope as we needed, and how to hook it up and operate it, such as https://playground.arduino.cc/Main/MPU-6050 by Arduino, as well as https://www.robotshop.com/community/tutorials/show/arduino-5-minute-tutorials-lesson-7-accelerometers-gyros-imus. Using these, we were able to figure out the wiring and coding required to track the player.
- In the final product, the gyroscopes measurements work as the x and y coordinates of the mouse, due to us requiring to have the Arduino operate as a mouse rather than an Arduino input.
- For the future, we could look into implement a better gyroscope, such as an orientation sensor (BNO055)
3. Use vibration motor to detect invisible targets
- To initially figure out how the motor worked, we used a tutorial (https://www.precisionmicrodrives.com/content/how-to-drive-a-vibration-motor-with-arduino-and-genuino/)
- After using the tutorial, the code is mostly made by testing out different values and intensity according to distance, originally tested through a light sensor and then implemented into the game code.
- Sadly, we were unable to implement this aspect, due to clashing libraries in the code disallowing the Arduino to operate as anything more than from movement.
4. Create different movement paths for targets as one progresses
- Coded in using sine and cosine waves
- While we wanted to implement a highly difficult mode, perhaps with a basic AI which avoided the player, we did not have enough time or understanding to do so.
- The presented version shifts the randomly moving target once hit.
5. Have working gifs
- To figure out how to implement gifs into p5. Namely, we used the example code in the web editor (https://editor.p5js.org/kjhollen/sketches/S1bVzeF8Z) and also https://stackoverflow.com/questions/49650025/p5-js-animated-gif-doesnt-work to troubleshoot and better understand.
- This was not implemented due to lack of time.
6. Be able to see and track player on the screen using colour detection
- We wanted to implement Maddie’s code from experiment one, which involved colour tracking, to track the crosshairs of the players. However, this code runs much slower and faces many avoidable complications when trying to track two colours at once. Due to this we later cut the number of players down to one.
- Later on, we realized the program runs far smoother using the gyroscope rather than the colour detection. So, we used the gyroscope for tracking, with the trigger being implemented through colour detection.
- Another issue faced with the colour detection was that the LED was too small to properly activate the code, so we needed to diffuse the light and make a larger trackable object. Due to this, we used a ping-pong ball. Due to availability, we were only able to access orange ping-pong balls, which caused difficulties with the colour detection, which would trigger the game when too close. This could be fixed by using a white ping-pong ball instead. Our short-term fix was to distance the gun, in a relatively dark location.
7. Have the game shoot by moving the gun in a specific way
- We realized that by using movement to fire the gun, the targeting would be offset. So, we changed plans, having it trigger fire but pressing a button that would light the LED for the colour detection to activate, “firing” the gun and seeing if it hit the target. Furthermore, as a failsafe, we could program the button to be what tests for collision, if the colour detection decides to not work.
8. Customize the controller
- We worked with spray paint for the first time. It isn’t the cleanest or nicest looking but it turned out exactly as we wanted with our current skills.
- The addition of the ping-pong ball also assists with the aesthetic of the prop gun for the game, as we needed to keep school guidelines in mind as we worked.
9. Create a working shooter game