Objective:
The goal of this project was to create a new version of the classic arcade game and make an unconventional controller to play it. I wanted to create a Pong game where the player would need to use a flashlight to control their paddle while playing against a computer player.
Full GitHub Project Repo: https://github.com/tranjames267/alt-arcade-interfaces/tree/main/altPong
The original version on P5JS: https://editor.p5js.org/tran.james267/sketches/31g-5sjRZ
Where my current game is hosted: https://openprocessing.org/sketch/1998844
Initial Tests
In order to detect light, I set up a circuit with two photocells and an Arduino UNO on a breadboard and programmed them to print out "UP" or "DOWN" in the serial monitor if they sensed an increase of light intensity from a flashlight.
A schematic of my photocell test circuit
Breadboard setup of my photocell test circuit
Coding my Pong Game
With a successful photocell test, I felt reassured that I could play Pong with a flashlight and then moved on to my game. For my first iteration of Pong, I coded the game in P5JS, where the player would move their paddle up and down using the up and down arrow keys. While my game was functional, the concept of the flashlight wasn't incorporated into the gameplay. In other words, playing Pong with a flashlight felt arbitrary. As the game was at the moment, the controls felt like they could easily be replaced with two buttons or a joystick.
In order to make the flashlight more cohesive with the game, I added a new game mechanic. Aside from moving their paddle up and down to play against the computer, players now had pay attention to the visibility of the ball and the paddles. I coded my game such that the ball and paddles would occasionally go invisible as time progressed. Players would need to use their flashlight to reveal these game elements. This meant that rather than 2 controls, there would be 4 controls (move up, move down, reveal the ball, reveal the paddles) in the game.
Building my controller circuit
While I had a working circuit using Arduino, I actually intended to use a Teensy 4.0 microcontroller. This microcontroller can be programmed to function as a keyboard. With 4 controls, I didn't want to go through the hassle of sending sensor data through serial and having to use the p5.serialcontrol application. Since P5JS had built in functions to handle keyboard input, using a Teensy would be better than an Arduino for my game purposes. It was helpful for me to refer to this pinout diagram while building my circuit.
Here is the code for the 4 photocell circuit using a Teensy on GitHub.
A schematic of the 4 photocell circuit using a Teensy
Since I wanted my lighting controls (photocells) for the ball and paddles to be separate from the main up and down controls, I used smaller breadboards as makeshift breakout boards.
Breadboard setup of the 4 photocell circuit using a Teensy (rudimentary controller)
Up and down are in the center, light paddles is left, light ball is right
Building the controller interface
While people could technically play my pong game with my rudimentary controller (aka circuit on some breadboards), I felt that the gaming experience would be elevated with a basic controller interface. While I didn't make full enclosures, I did make some paper covers for the breadboards. This way, people could enjoy playing the game without a bunch of wires in their face.
The paper cover design for the controls that would reveal the paddles and ball
A clear ornament makes the paper cover resemble a light bulb
The lightbulb paper cover for lighting the paddles and ball
The paper cover design for the up and down controls
The cutout of the up and down paper cover before folding
The up and down paper cover: holes were lined with a clear plastic film
The controller setup interface
Playtest improvements
After having a few users play my game using a flashlight and the physical controls I made, I received some feedback on how I could make the player experience better (make my game juicy). There were two major pain points. One of them was about how the paddles and balls disappeared. They would turn invisible so suddenly that users would feel a bit confused about what was happening with the game. The second pain point was that players struggled to know if they were successfully moving their paddle up and down. Unlike the physical feedback (and reassurance) from a keyboard button, photocells just sense light. Therefore, users had to shine their flashlight close to the photocells and hope that the paddle would visually move.
To address the sudden invisibility of the ball and paddles, I made them gradually fade so that users would anticipate and understand that they would eventually need to light them back up again. In order to let users know that the photocell picked up on the flashlight successfully, I programmed the game to make a noise when the paddle moves. This gives much needed feedback.
Here is the code for my Pong game with the fade and paddle feedback.