A small computer game developed in the DIY or Die Trying event sponsored by UWaterloo's The Games Institute. It’s an initial 3D clone of Atari’s arcade game Pong, produced and manufactured in 1972.
I wanted to build a computer game myself, but the challenge with me was pushing myself so hard. In the summer of 2014, I tried conceptualizing a side-scrolling shooter on Word and worked on developing a demo project out of it, but it was halted at one point because of my education at University of Waterloo.
So I decided to participate in a gaming development event called DIY or Die Trying as recommended by one of the members in the UW Game Development Club. Considering that I did not knew much about game development at the time and what tools I can use, I decided to approach it in a very pragmatic way by building a simplistic Pong game with one feature. Based on the ball’s vertical position, the board would tilt up or down to give a more three-dimensional feel.
What it does
This is a one-player game where you are the red paddle on the left side. You are to get 5 goals in beating the CPU, which is controlling the blue paddle on the right, by bouncing the green ball back against the CPU player in a way where they don’t catch the ball when it passes right through them. Use the up and down arrow keys to move the red paddle up and down respectively.
How I built it
I used the Unity 5 Game Engine, where at the start, I was only familiar with how a central game object is needed before a bunch of game objects can be put together as a group because sometimes it's simpler to have child objects be positioned relative to its parent. This was also to make the game hierarchy more organized in finding troubled components easier.
So initially, I followed along a tutorial on using Unity 5 to build an initial 3D game called “Roll-a-ball,” where it was from there that I learned some of the basic mechanics of the game: modelling, scripting, camera position, collisions, animation, and movement.
Then I worked on the game itself by playing around with some basic shapes including two capsules, one sphere, a plane, and two rectangular prisms. Next, I programmed the elements in a way where they resemble a Pong game involving animation, position, and collisions. As I did, I went through some debugging to see what was happening and figure out what bugs I needed to fix.
Challenges I ran into
Some of the obstacles I faced were how the scripting works as related to the Unity editor, because the scripts themselves are not necessarily hard-programmed. Some of the reference pointers I used are connected within the editor in which Unity itself builds on the reference to them and thus I would not have to do the cumbersome object construction and initialization. Another challenge I faced was with the timing, because as soon as the ball triggers a goal to either the player or the CPU, I wanted to be at the centre of the field for some time before it moves again. At first glance, I thought it would be easy, only to find out that to make the ball wait for 1.25 seconds, I had to modify what’s called the time scale twice instead of making it always one second, in the game, go by per second in real time. There was also how to increment the goal counters for one of the two players depending on where the trigger was made, where initially I would check to see where the ball triggers the goal block. Eventually, what I had to do was to create tags for the invisible collider blocks, and then compare it with what it is the ball hits upon triggering; essentially, comparing strings. Finally, there was the movement of the ball and the paddles. I wanted to make the ball move in a way where the player doesn’t have to react so quickly to make the paddle move to where the ball should be by the time it gets to the collision area. In addition, I did not wanted to make the paddles move too fast or too slow. Since the input is the up and down arrow keys on the keyboard, I had to deal with oversensitivity a bit. In the end, what I used to make the ball move is by using the double Random.value field, plus an offset (since Random.value is between 0.0 and 1.0) with four limits on both the horizontal and vertical speed factors. I have two while loops in case either speed factor is outside the range; if it is, then I randomly choose another value. It’s from there that I calculate the initial horizontal and vertical speeds of the ball. I also used a factor in moving the paddles to make the movement of them consistent with regards to timing and making sure they don’t move too slow, since the maximum value for the Input.GetAxis method is 1.
I did ran into trouble regarding colliders and AI as well, but I ran out of time to come up with better ideas on what to program them both with.
Accomplishments that I'm proud of
Having the ability to produce a rough 3D game with a three-dimensional aspect to it.
What I learned
Some of the basic mechanics in game development using Unity 5, including parent and child game objects, trigger and collision events, timing, animation, loading, and programming scripts.
What's next for GI-Jam-2015-Pong-Windows-
There are a few things I have in mind to add for this small computer game project:
- Design and implement a more realistic AI for the computer paddle
- Make the game available in three different difficulty settings: easy, medium, and hard
- Create and program a user interface, including a pause menu
- Add a feature to adjust the speed and angle of how the ball bounces back based on where it hits the paddle and whether or not the paddle is moving up, down, or neither.
- Possibly add some powerups for a more fun experience instead of boring pong all the time
- Try experimenting with different painting styles, including matte and texture mapping
- (this might take a long time) Model the geometry into more interesting shapes instead of modified capsules, spheres and prisms.
I should do a code analysis with someone to let them see what it is I need to learn with regards to game development, because I feel there is a lot more to learning than it is to push it on.
Overall, I think this was a good start. Sure, it was kind of boring having to build a very small and dull game from scratch, but I knew I had to do at least something given I was quite limited on time and how I had to learn something new. Otherwise, I should take the time to learn more about Unity 5 (in particular, reading the manual), because I feel like building a game using the free version of it can be particularly more fun than having to hard-code everything in Java using the AWT and Swing packages.