DVD Pong

physical computing, creative coding, game design
Processing, ESP32


Design Brief:

In this project we will explore the technical components of a video-based game: the physics and mechanics expressed in code, and the physical-to-digital connection from the game controller to the screen. You will have to consider goals and motivations for the players, the scoring system, the narrative, the art and atmosphere, and the physical aspects of play embodied in the ergonomic concerns. While complex, the result need not be complcated - but fun is mandatory! The outcome of the project will be an original video game and a custom controller for it.

Documentation:

Game concept:
DVD Pong is a spin on the classic Pong game, but with a fun twist. Players use the paddle to try and hit the DVD logo into the corner of the screen to win points. Every time the DVD logo goes off screen, players lose points.

Goals:
  • Use a color-changing DVD logo instead of a ball
  • Program some kind of corner detection
  • Make the controller feel fun and intuitive
Mechanics:
  • A paddle on the right side of the screen that moves up and down, controlled by the physical controller (player).
  • A DVD logo that collides with the paddle and edges of the screen and bounces in the opposite x/y direction
  • A score that increases each time the logo hits the corner of the screen

Background Story:
I began this project by working through the Pong example code and trying to figure out a way to make it more dynamic and nostalgic. I remembered the old DVD logo screensaver and how badly we wanted it to hit the corner, but the movement was out of our control. This seemed like a good opportunity to create a situation of fun control over the logo screensaver. I started with a sketch of how I imagine it would work.



When I began coding, I used the mouse as a controller and started with adjusting the pong code and adding the dvd logo. Then, I made it so that it changed colors whenever it collided with the edge of the screen and the paddle.



DVD Pong differs from traditional Pong in that points are scored by hitting the DVD logo into the corner or the screen (not on the paddle hit). I struggled with figuring out how to create zones that would make the points go up, and started by creating 4 rectangles in each corner that would increase the score if hit (similar to the logo/paddle mechanic). This didn’t work, so I then turned the corner zones into false booleans and wrote an if() statement within the point score int that checked the logo positioning and changed the boolean to true if the logo was in the zone. Within the main sketch, I defined the tolerance of those corner zones.


I struggled a bit with adding the sound to the classes, but with some help I figured it out and I was able to add some web-sourced sound effects for the logo hitting the paddle, a missed hit, and a point score within each function.



Controller:
For this project, I decided to use a tilt sensor to best map the movement of the paddle to the on-screen mechanic. The tilt sensor had an x, y, and z axis, but I ended up only connecting the x since I only needed it to tilt up and down.


I sketched out a few ideas for the controller’s packaging, including ping pong paddles with DVDs glued to them, but I decided that a tilt sensor would work best in a controller that felt more neutral to hold. I decided on a ‘remote control’ made out of cardboard and a paper cover.

Connecting the controller and game:
I used a serial connection in Processing to connect the controller. Then, I mapped the values from the sensor to the height of the screen, and set the paddle.moveTo() function to the mapped variable.

Once I had the controller working, the paddle was a bit jittery. I observed how many serial values were fluctuating from the sensor, then wrote an if() statement within my Processing code that ran the controller mapping ONLY if the absolute value of the current value-previous value was greater than or equal to a set threshold value. The current value was defined as the previous value at the end of the draw() loop, so that it continuously updated.

There was a lot of testing that went into figuring out the proper threshold. Once I found a good value (25), the movement of the paddle was much smoother and the game became a bit easier.


Key Moments:
  • Ball hitting paddle
  • Ball hitting corner and scoring a point
  • Ball going off screen and resetting
Play Tester Opinions:
“It’s difficult!” - Giah
“NOOOOO I lost!” -Anna
“I love the winning noise.” - Anna
“The controller is a little wobbly.” -Nacho

Reflections:

This was my first time designing and programming a game, and it was very fun. Figuring out how to map real controller values to mechanics and movements within the game was a challenge, but it ultimately helped my understand (and appreciate) how video games are made. I also enjoyed using object-oriented programming, as it helped me compartmentalize and solve problems while coding. I would really like to continue building games, and I would also love to create a higher fidelity controller for DVD Pong.
Mark