A Little Game of Tennis

I may not be able to play a good game of tennis, but I feel I completed my goal; create a “feature complete” game of pong. What this actually means is a game consisting of two players (paddles), a ball that speeds up to increase difficulty and some sort of menu to explain the rules and start play. On top of this I was able to include a system to easily dictate the score of the game mid play and push a match towards completion. My final goal was to make “clean” code, or at least something slightly readable.

I found the project to be challenging (especially initially)yet totally within reach once I started lying out how organize my code. The most difficult thing I had to explore was how structs can be inserted into functions. Initially I was taking the info in the structs and making it the parameters of my functions. Realizing I could simply pass the whole struct was both great and a ton of work as I needed to redo almost all of my code which took a whole day in itself. Once I got a handle on that and got the game basically working I had an idea to make it more like tennis. I made the paddles shrink and grow as players score, thus reflecting the moral of a tennis player throughout the match. This idea excited me and was fun and quick to implement.

One of the problems I ran into was my random direction launch for the ball was…awfully un-random. This required a good hour of help from my TA to try and get my ball to be a little bit more random. In the end the ball is alright, but still seems to dominate one side or the other. Every time I launched the ball I wanted the game to wait for a couple of seconds so the players could get ready again. This required the use of a classmate’s advice and a sleep function based in the windows.h library.

I had a lot of fun with this project and feel like I did a good job making something that feels done. If I had to do it all again I would probably have decided to add some more features from the get go like a scoreboard with name input. I think I did well but could have let my ambitions go a little higher. Honestly I had no idea what it would take for me to get this working so the fact that I put the actual “game” together so fast surprised me. All in all I learned a lot form building pong and feel much more prepared to take on bigger projects due to building it.