Concept
The game is inspired by the history of Taiwanese rock, which developed not as a direct product of American cultural imperialism but as a manifestation of our people’s desire to preserve our cultural identity through these modern forms of music; many Taiwanese rock bands write their lyrics in Taiwanese Hokkien and are very involved in social movements outside of their music. These are elements of Taiwanese culture that were suppressed during the martial law era, and the vibrant pop punk/punk rock scene embodies the resilience of our people. Taiwanese rock is an amalgamation of local Taiwanese, Chinese, American, and Japanese influences that reflects our complex history as a colonial subject of many but also our present and future as a country.
The game’s title Formosa! refers to the name “Ilha Formosa,” which was given to Taiwan by Portuguese sailors in the 16th century, meaning “beautiful island.” The song that plays throughout the game is “人間條件 Human Condition” by Fire EX., a band that I consider a symbol of Taiwanese resilience due to their outspoken support of Taiwanese independence and other causes.
I intend for the game to be a light-hearted introduction to this aspect of Taiwan. In the spirit of the wacky, energetic aesthetic of the Scott Pilgrim franchise, the player controls a guitarist who is running late for a gig and has to get there as soon as possible, evading cops and picking up pirated music tapes to gain experience and recharge. My final project is a game centered around a guitar repurposed as a gamepad: each string, when strummed, triggers a specific movement for the protagonist.
How the game works
- 3 of the guitar’s frets are covered with red strips. These are buttons that players press to either start, jump or attack.
- Players will have to jump to collect power-ups in the form of vinyls and cassette tapes in order to build up an attack charge (red bar on the top right corner of the screen). The maximum charge value is three.
- When the attack charge is greater than zero, players can attack to destroy enemies (cops and cop cars). Cops take one attack to destroy while cars take two.
- When an enemy is destroyed, the score goes up. Contact with enemies will cause the score to go down.
- Each game lasts 60 seconds. The game automatically ends when the countdown timer reaches zero.
Arduino + p5.js Setup
When players press on a “button” (the red strips on the guitar neck), a circuit is closed between the metal guitar fret and its strings, triggering in-game actions such as jumping and attacking depending on which button is pressed.
The Arduino code simply takes input from the digital pins connected to the three guitar frets; the p5.js code takes this input (0 or 1 depending on whether the circuits are closed or not) and translates it into triggers for character actions.
The p5.js code has a separate function for each game state — start, instructions, main game and end screen — that is called on in an if-else statement in the main draw function.
The properties of characters and power-ups are set in their individual classes. The hit(entity) function in the Protag class set conditions that are then used to check if the Protag has come into contact with enemies or power-up collectibles in the handleCollisions() and handleAttacks() functions of the main sketch.
Problems Encountered + Solutions
Personally, I’m proud of managing to successfully set up the serial connection between p5.js and Arduino. For a good amount of time, the connection wasn’t working, and I was panicking until I realized that p5.js wasn’t responding as it should be because in all the “if” statements for each in-game action, I put the button state “1” as a string instead of an integer, as they were specified as in the readSerial() function. After simply removing the quotation marks, the serial connection was up and running successfully.
As for the hardware, I also had to figure out new solutions after initial configurations didn’t work as I expected. While i had originally planned to attach 4 wires to individual guitar strings and use a wired conductive guitar pick to create a controller in which strumming each string triggers a different in-game action, this failed to work as all the strings were connected to a metal saddle, which made all the strings one conductive body and therefore could not be utilized for individual actions. I ultimately decided to turn the guitar’s metal frets into the buttons of the controller. I covered three separate frets with copper tape for enhanced visibility and connected them to wires, doing the same for the metal saddle; when the player presses any string against the taped frets, a circuit is completed and a signal is sent from arduino to p5js to trigger 3 actions — start, jump, and attack — depending on which fret is pressed.
Showcase
Future Improvements
The game interface could definitely use a bit for polishing; if I had more time, I’d want to try making more advanced visual and sound effects for when an enemy is attacked or when the protagonist successfully collects a power-up so that players don’t have to keep checking their score and attack charge bar to keep track. It would also be interesting if I could somehow incorporate haptic feedback on the guitar controller– perhaps have the strings vibrate when an attack is used — so that the experience is more immersive and engaging.