Initial Concept: The goal of this project was to create a fun and addicting arcade game. I intentionally made it easy to grasp so it would appeal to a large number of people, the only thing you have to do is bounce the ball on the ping pong paddle for as long as possible.
Level Design: I went for a simplistic design when it came to how I wanted the level to be set up. The gray background is supposed to make it easy for the player to track the ball, and the buttons and text are set up so they can be seen in either portrait or landscape view on someone’s phone.
3D Models: I made two low polygon 3D models for this project, the ping pong paddle and ping pong ball. The paddle features a couple of different UV maps like a color map, bump map, and normal map to make it look complete in the game. The ball is a simple sphere object I imported from one of Unity’s menus.
Putting It Into Code:
Physics and Player Controller: I used 3D rigidbody components and colliders in Unity to get everything to work. The paddle is controlled by a script that moves when it is dragged by the player, and does not use gravity like the ball. To make sure the ball stays in bounds there are boxes in the scene with colliders that stop the ball from going out of bounds, which are invisible to the player because I disabled their mesh renderers.
Ball Movement: To get the ball to move randomly I set up coroutines that alter its position when it collides with the ping pong paddle. The ball keeps bouncing because I applied a physics material with zero dynamic friction and zero static friction.
Saving Player Data: I used the PlayerPrefs system in Unity to save the high-score of players. I also utilized a service called PlayFab that allows you to store data on their server, and from there I was able to save player data on a leaderboard.
Pause Menu: To make the game pause when the player hits the pause button I made a public function that sets the time scale to zero instead of one. Also, the zoom feature works by adjusting the field of view of the camera and the volume settings work by adjusting how loud the AudioSource on the camera is.
Audio: The ball makes different noises every time it hits the paddle because it cycles through an array of random bounce noises (that I recorded.) There’s also an AudioSource on the camera which allows sounds to be heard.
Customization Features: To save the different customization features I used PlayerPrefs in Unity. There are particle effects you can choose from and also different colored balls, and for the colored balls I wrote some code that changed the material color.
Ads: For the ads I used Yodo1 Game’s SDK that pulls from a list of different ad networks. The player is incentivized to want to watch ads by unlocking custom items in the game. I implemented banner ads on the start screen and leaderboard screen as well, but not in the actual game level because I didn’t want the ads to interfere with the gameplay at all and create a bad user experience.
Go more into depth on the GitHub repository.
Making Paddle Pong an Augmented Reality Experience
I experimented around with creating an augmented reality version of this game. To do this, I used a free resource called Vuforia and deployed the application to my phone. I tried two different methods, one used an image target for the paddle to hover over and the other one used planar ground detection to detect a spot that the paddle could spawn over. Both my attempts at creating an AR version of Paddle Pong had mixed results. It was a fun challenge, and I’m happy that I learned more about augmented reality development through this fun little project.
This prototype used an image target.
This prototype used ground plane detection.