Pong!

Second week into the course and the focus has turned to games! For the last couple of days we have been working with building a working version of the classic game Pong, using the library SDL to create a visual window.

Pong is a very old game (Original arcade version released 1972) and also one of the most famous retro games. The game is a simple abstraction of tennis, split with two paddles, controlled by players, on each end of the screen and a ball that starts in the middle. The goal is simply to not let the ball past your paddle while trying to trick it past your opponent for the sake of scoring points.

So for this we had to sent up a visual playing field and add the three objects of paddles and ball. Next up functions were needed to make the paddles able to move vertically, without being able to leave the screen. Finally the ball needed to move and bounce against the sides of the scene as well as the paddles, and reset at any moment it reached the end of either player’s playing field, as well as give score.

Coding all of this took a fair amount of time, but in and of itself it was not that tricky. The rules needed are quite straight forward and clear as to what the program needs to do, making it easy to figure out what needs to be in the code. The real challenge came from mastering pointers and the change of language that came about when having to work with a new library. Over all it was a fun assignment, but would have been better had we been using classes.

/Stefan Ekdahl

About Stefan Ekdahl

2014  Programming