The time stamp for one of the files in this game is January 15th, 2006. WOW, has it really been that long? I do recall working on it through Christmas. Four years ago I was attending Full Sail University and was in my third month of C++ programming. This was the last month of nose-to-the-books C++ learning before we moved on to other areas of C++ (like using it with OpenGL, DirectX, Lua, etc.).
Durring the last month of the course there was an optional assignment to use your current knowledge (2 months of C++ basics) to create a game to show off to the class (aka rub in their faces). Since it was my goal to squeeze as much learning out of the 80k school cost as I could, I couldn't pass up the opportunity (plus I got to rub it in people's faces).
So here it is in all its glory:
That is right ladies and gentlemen, sweet console lovin'.
The instructor of the class, Arthur Johnson, made a cool C++ console module that made it really easy to render ascii art to the screen and mask it with colors. Besides that it was all made by me.
Lets talk about the code for a bit. The code in short, is the worst. I learned how to do classes during the production of it so the game has a "Pong" class, that is it. At this point I had no understanding of design patters or any inkling about how to properly use classes to make code sane.
Another thing I remember is that I didn't use linear algebra for the ball or paddle movements. This means that the directions were hard coded +/- pixels. This also means that the way I figured out how to move the ball was based of a bunch of if-checks and bools that I would toggle in specific cases. I remember coming up with all this crazy logic just to change the state of the ball's angle movement.
//used to tell which way the ball is going(left, right, up, down).
bool rightBl, leftBl, upBl, downBl;
//bools used to tell if the ball is doing a steep angle or inclined.
bool steep, inclined;
You'll notice there is fancy intro and credit effects (yeah, moving is an effect). Those were all done with for-loops and sleeps. I feel pretty embarrassed sharing this with the world, but I believe in the circumstances I did a stand up job :-). I remember at the time thinking everything I was doing was completely incorrect. I didn't care though, I wanted to MAKE A GAME!!! I had spent enough time painting the fence and waxing the floor, I wanted to kick some ass.
for (int i = -60, j = 15; i != 15; i+=1)
I also abused the hell out of the windows function PlaySound(). The craziest thing I did was the credits. Instead of playing some music and scrolling credits I thought it would be funny to announce them with my voice while music played in the background. The code basically laid out as follows: PlaySound(), for loop effect, repeat. Since I was just playing a single wave I recorded my voice with music playing in the background. Because it was play->scroll->play I had to split the credits up into multiple files. This also meant that I recorded the thing in one take.
I did this by pressing play on the music and recording. I would say my bit about the section, then pause and stop recording. Then repeat the process until I was done. It kinda worked, but it also made what I said ridiculous, because I was basically free styling (which you don't want me doing). Unfortunately I think I may have lost those files (embarrassment--). This is probably due to removing them from the folder I would give to friends and family (20+ megs of waves).
That is about all I can remember. If you want to play it for yourself all you need is Windows XP or better (I don't mean mac :-P ). I will be keeping a project link list on the sidebar from now on. Looking back at the code today I was actually surprised at its quality. I thought it would be completely unreadable and obscure (it mostly is). Originally I was going to just post the game, but for you're amusement you can also check out the source (in the same download).
Extreme Pong - Game and Source