Thousander Club Update: October 9th

For this week’s Thousander Club update:

Game Hours: 203.75 / 1000
Game Ideas: 432 / 1000

Target: 777

I hit 200 hours as of Wednesday morning, which puts me at over 20% of the way towards 1,000 hours!

In the article But Can You Make Pong?, it listed a set of components and features to make a Pong clone. I don’t have a win condition, so the game goes on forever or until you hit ESC or Q to exit the game. I don’t do any fancy work with the graphics or sound. I only used keyboard input, and it is hardcoded to the up and down arrow keys as well as the A and Z keys (although I did provide a configuration file that should be easy to edit to make it work for other keys). The physics are also simple, which means that the ball simply reflects as it hits an object. If it hits a paddle, it reverses the x-component of its direction vector. If it hits a wall, it reverses the y-component. It makes for some interesting bugs if the ball hits the top or bottom of a paddle, though. The scores are prominently at the top, and since the game simply starts and doesn’t end, there is not much of a UI to speak of. There is no computer AI, so you must play both paddles.

Still, even without all of these cool features, Pong is finished. I can add some of these features, or I can move on to a second project. There is the temptation to polish up a Pong clone, to “do it right”, but I think I can always take what I learned, apply it to a second project, and come up with newer features there. I’ll likely write more about this next project this week, but it might just be Asteroids or Space Invaders.

As suggested last week, I am also going to see if I can get this Pong clone submitted as a good example project for people learning how to work with the Kyra Sprite Engine. I will spend some time this week cleaning up the code just for this purpose.

5 comments to Thousander Club Update: October 9th

  • A simple pong AI that actually works is just a couple of lines of code… Basically

    if(paddle.y+paddle.heightball.y)
    paddle.y-=paddle.velocity;

    You should be able to replace your player 2 input code, which I imagine looks similar except it’s “if(key==’A’)…” with that AI code and it should work. Don’t blame me if it does something retarded :).

    There are a lot of tricks you can add to make it more interesting to play against. Have it hesitate, overshoot or undershoot, etc.

  • Argh… formatting got messed up… try this…

    if(paddle.y+paddle.height < ball.y)
    paddle.y+=paddle.velocity;
    else if(paddle.y > ball.y)
    paddle.y-=paddle.velocity;

  • Heh, I suppose getting a simple AI isn’t so hard. Maybe I will add it after all.

  • I think a win condition would be important though, to calling it finished. If it doesn’t have a win condition, can we really call it a game?

    Keith

  • Yeah, I guess we wouldn’t want it to resemble SimCity too much…B-)