• Advertisement
Sign in to follow this  

Check out my first game

This topic is 4381 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just got to a point where my first ever game is somewhat playable. I know most of you guys could put this game together in no time but it took a alot of effort for me. Anyways the game is a pong clone which alows the player and computer to use 2 paddles each. It also has support for multiple balls. Its not quite complete yet, I still have to add in score, lives, and increasing dificulty but Id say the hard part is over. You can download the .exe and the source code from one of my old websites: mech.buildtolearn.net/Pong.zip . I commented most of my code so everyone can understand it. I made it in devc++, but I hope it will compile on any compiler. Everyone tell me what you think of my code. I think it runs kinda slower than it should, but mabey its just my computer. Any suggestions for the code or the game is welcome

Share this post


Link to post
Share on other sites
Advertisement
Congrates on finishing your game! It feels good to finish a project, more then ever your first project. I tried to run the .exe but it gave me some error (sdlgfx.dll was not found), I guess I need to have the SDL lib on my computer to play your game. Oh one last thing, cool menu art, and I would look at your code but I don't know SDL, only Win32.

Share this post


Link to post
Share on other sites
If you used sdl, you just need to put the .dll file its looking for in the folder the executable is in and other people who don't have sdl should have no problem running the program.

congrats on your acheivement :)

Share this post


Link to post
Share on other sites
Put the sdlgfx.dll in there too. I wasn't able to play it due to this, and I don't feel like going and getting it. I'll play it once you include it with the game.

Share this post


Link to post
Share on other sites
Here is a link to get the sdlgfx.dll.

I find that when the ball hits the side of the paddle, it gets stuck inside the paddle and is catapulted in the wrong direction shortly thereafter. This happens in my work-in-progress pong clone as well.

Also, it would be nice if you can make the paddles different colors. The menu system needs to be fixed. Take a look at aedGUI.

Keep up the good work!

Share this post


Link to post
Share on other sites
Nice work, I like it.

I don't think it's a good idea to have all your classes and class function definitions in the same include file though.

Share this post


Link to post
Share on other sites
4 way pong! Very cool. I wasn't sure what you meant when you said 'support for 2 paddles'. I'd love to see what multiple balls would be like. Lots of fun to play. I did notice that the ball gets stuck sometimes, but that's no big deal. Can't wait for the next version!

Share this post


Link to post
Share on other sites
Great but your ai is too good. Or maybe im just horrible at this game. This was way better then my first game. Good job.

Share this post


Link to post
Share on other sites
game was really interesting, i love the two paddle concept. good thinking there! i'd suggest putting lives in there somehow though, running a timer and trying to beat a score of how long you survived, and maybe a little delay before the ball starts moving after you miss... my paddle was on the other side of the screen and by the time i realized i missed, the ball was almost off the screen again. implementing sounds can really help with this.

[edit]
i agree with CodeTitan, your help screen doesn't show, and the other guy, you're AI looks like it just looks at the ball's x and y coordinates and moves to that location, not really fair ya know?

Share this post


Link to post
Share on other sites
Thanks everyone. As I said the game isnt complete and I havent added in the help feature yet. I was going to move on to another project but since I got so many positve replys Im going to start on version 2.0. I'll add in all the bells and whistles and then put it up as the image of the day!

Share this post


Link to post
Share on other sites
here i go again, i really should do everything first THEN comment, but anyways... you include windows.h and then use few functions that it supports which would make your program easier to code, add functionality, and reduce redunancy (reinventing the wheel). also, i don't know if you're familiar with structures and enumerators but they make more sense than classes in much of your implentation. using directions makes sense for most games, but when you're just bouncing a ball, you can just invert the velocity along the corresponding axis (traveling down and right across the screen you're ball has a velocity (x,y) of (10, 5), when it bounces off say the top and bottom paddles you can write something like y = -y). incidentally that's the way you should be changing your paddle directions, create a constant in the header and set it to 10, then that way if you ever want to change the speed at which the paddles go you don't have to go and find every 10 and change it, possibly missing one. and to fix the pause bug, it's happening because you're checking for a spacebar press EVERY game loop, i guess it's rendering at a speed of at least 20 fps, which means that if i hold it down for any longer than 1/20th of a second it counts as pressing it again. i'm not familiar with sdl, so i would recommend using the default msg handler because it is notoriously slower, in games we want to be able to get those key presses as fast as possible, but sometimes, like in this case, you want that delay the msg handler provides.

ok... there WAS good stuff too in your code (don't want to discourage you, i'm not perfect i know) :) like i said, and others, GREAT way to reinvent pong! and great use of iterators (in my opinion), i'm horrible with them and only use the ones i have to when dealing with the STL. good job with encapsulating enerything, but purists would say you need to seperate your definitions and implementations, i don't really think it matters all that much and it produces less files.

Share this post


Link to post
Share on other sites
Nice one! Firstly, it worked perfectly this time(which is always good). Secondly, the AI is too good!!! Its impossible to loose. You're going to have to put some randomness in there for the final version. Thridly, I like the dual-paddle idea. It was done very well, and did add to gameplay(sometimes, beginners (*cough* me *cough*) just add a new feature to call it 'not *just* a clone!', but there was... well... a reason why that feature wasn't in the original game :) )

Again, nice work!

Share this post


Link to post
Share on other sites
I've noticed the paddles of my opponent are basically equal to the x and y positions of the ball. This means that it's impossible for me to ever score even one point. Their paddle stays EXACTLY dead center on the ball.

Otherwise, neat approach, you have a way to go before it's done, but I think it's a great start for a first game.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement