Try my pong clone. [UPDATED 10/13/05, 8:37]

Recommended Posts

dudedbz1    100
Hi all! I finally finished my pong clone in SDL. Its kind of in idea version, so most likely in the second version I make I'll be having SDL_ttf stuff with the fps, scores, stuff like that. Later on I'll make it for 2 players too. Though I want you to try it cuz its fully playable. Here: clicky! Its ony geocities though, so if you know of a better place to upload tell me! [Edited by - dudedbz1 on October 13, 2005 7:33:51 PM]

Share on other sites
supercoder74    154
It lookes like the file is virused or something. It wont load in Winace.

Share on other sites
Simian Man    1022
WinZip won't open it for me. It says it "does not appear to be a valid archive"

Share on other sites
dudedbz1    100
"Virused"? Uhhh, why would I make a virus for a pong clone. Anyways, I used winrar, so i dont know why that would happen... Do you have XP? If you do, try opening it with the built in zipped folders. Or download winrar. For some reason the trial never ends(no cracks, I donloaded it directly from their site).

Share on other sites
dudedbz1    100
Hmmmm... I used winrar. I'll zip it with window's zipped folders then and upload it again. Try it after like 10 mins or so... It DOES do it... I tried with window's zipped folders thingy. But winrar opens it easily and runs it directly. Hmmm... I dont know what to say.

Edit: Ok, all done. Try it now. It seems that when I selected new winrar .rar file and renamed it to .zip BEFORE it was created had the same effect as if I renamed it later, so winrar thought it was a .rar and opened it, and the others messed up.

Share on other sites
Hey I haven't played it yet, but I am downloading it now. It will be done in like....lets say....1 second. Ok it done now. lol. I still haven't played it, but I can upload for my site and keep it up their for 2 weeks. What you say? If you want me to, then just tell me here and I will and then I will reply with the link for you to use so people don't download from Geocities.

Share on other sites
supercoder74    154
Quote:
 Original post by dudedbz1"Virused"? Uhhh, why would I make a virus for a pong clone. Anyways, I used winrar, so i dont know why that would happen... Do you have XP? If you do, try opening it with the built in zipped folders. Or download winrar. For some reason the trial never ends(no cracks, I donloaded it directly from their site).

I didnt really mean a virus, thats just what I use for any invalid/error file.

Share on other sites
dudedbz1    100
Yeah, i know what the program means by defected/virus. Anyways, Chad, that'd be great! I dont need more than 2 weeks anyways, as I just want a few comments. So if you can do it (big)thanks. I'm looking forward to replies people, since I fixed the .zip.

Share on other sites
quagmire    194
Finally a game of Pong! I have been dying to play this. Congrats. Good game really. Just, ahhh! The AI is too good. I can't score, it is still fun. I also like the layout. Most of the clones are like west and east, this is north and south. Something different than I have seen, I like it.

dudedbz1    100
Wow, thanks!

Share on other sites
win_crook    171
If you want some free webspace go to 100webspace.com. You get 100mb of space, PHP, CGI and good support.

Share on other sites
I keep getting a 404 :(.

Share on other sites
Rob Loach    1504
Since you've been having troules with your hosting, I decided to let you use some of mine:

dudedbz1's Pong - Rob Loach Mirror

Very well done, I like your use of the message box to say the score. I didn't know that was easily possible using SDL. Any notes about your next project?

Share on other sites
mago    115
Good work! The gameplay gets a little boring after a while, though... Have you considered making the whole game run faster? At the current speed, given that the speed of the paddles is the same as the y-axis speed of the ball is the same, it is really easy to stay under the ball all the time..

Share on other sites
matthughson    588
Great work! I can tell you're gonna do really well with this game development thing!

Couple suggestions for version 2.0:

- Ball rebound direction based on where on the paddle it hits (a la break out)
- Faster gamplay
- Ingame windows instead of regular message boxes

Looks really great though!
Matt Hughson

Share on other sites

Well you have your self some hosting now I guess. Keep up the good work.

Share on other sites
dudedbz1    100
Thanks. I am working on 2.0 as we speak. It'll be for up to 4 players. Here's a screenshot: .
Now there are two balls(<---- hahaha) to look out for, and one moves faster than the other. The AI is somewhat stupid, but not all the time. I took out the scoring system and FPS regulator because I didnt like how I implemented them. I'm not going to the FPS for a while, cuz for now it doesnt really matter(unless you run it on a monster machine ;)). I HAVE to learn SDL_ttf because I can use it nicely. I'm just working on a class to handle all of it cuz I dont like to do it manually. Then I can make a nice scoring system. I made a pause, but not a menu with it(just toggle pause on/off with p or pause). Later I can make a main menu, too. Since its for four players I should make some kind of box that goes in the corners so the paddles dont hit themselves. And they could act as goals, too. Check back here fo info.

P.S. Thanks for hosting my game, Rob.

Edit: The message box is as easy to put into SDL as in windows.
MessageBox(GetActiveWindow(), // or null           "My text.",           "My title.",           MB_OK);

Edit2: I made all my Images be accessible through a vector of pointers to the variables in main. I did this so I dont pass in like 8 arguments to each function.

//beforevoid DrawGame(P1_Paddle,              P2_Paddle,              ...              ...);//aftervoid DrawGame(vector<Image*>&);

Edit2: Heres main():
int main(int, char**){	if (FUNCTION_FAILED(Init()))        return 1;            Image P1_Paddle;    Image P2_Paddle;        Image P3_Paddle;    Image P4_Paddle;        Image Ball;    Image Ball2;        Image Bg;        Image Pause;        vector<Image*> AllGraphics;        AllGraphics.push_back(&P1_Paddle);    AllGraphics.push_back(&P2_Paddle);    AllGraphics.push_back(&P3_Paddle);    AllGraphics.push_back(&P4_Paddle);        AllGraphics.push_back(&Ball);    AllGraphics.push_back(&Ball2);        AllGraphics.push_back(&Bg);        AllGraphics.push_back(&Pause);        if (FUNCTION_FAILED(InitResources(AllGraphics)))        return 1;            while (UpdateGame(P1_Paddle,                       P2_Paddle,                       P3_Paddle,                      P4_Paddle,                      Ball,                       Ball2,                       Bg))        DrawGame(AllGraphics);        CleanUp();        return 0;}

Now I just need to update the Update() function to also use this:
vector<Image*>&

[Edited by - dudedbz1 on October 13, 2005 7:55:55 PM]

Share on other sites
C plus noob    100
i suggest gameplay be alot faster, AI be less predictable. otherwise.... not bad

Share on other sites
dudedbz1    100
I will make the gameplay faster, once I do a scoring system. But how can I make the AI less predictable? I'm not good at AI programming. If anyone can help me, please do so.

Heres my current AI part for the bottom paddle:
if (AI)        {        	if (Ball.Gety() > ((BG.GetChar()->h / 4) * 3) && Ball.BallDown)                {                if (Ball.Getx() < (P1_Paddle.Getx() + (P1_Paddle.GetChar()->w / 2) - (Ball.GetChar()->w / 2)))                    P1_Paddle.Setx(P1_Paddle.Getx() - 4);                if (Ball.Getx() > (P1_Paddle.Getx() + (P1_Paddle.GetChar()->w / 2) - (Ball.GetChar()->w / 2)))                    P1_Paddle.Setx(P1_Paddle.Getx() + 4);            }            else            {                if (Ball2.Getx() < (P1_Paddle.Getx() + (P1_Paddle.GetChar()->w / 2) - (Ball2.GetChar()->w / 2)))                    P1_Paddle.Setx(P1_Paddle.Getx() - 4);                if (Ball2.Getx() > (P1_Paddle.Getx() + (P1_Paddle.GetChar()->w / 2) - (Ball2.GetChar()->w / 2)))                    P1_Paddle.Setx(P1_Paddle.Getx() + 4);            }        }        else        {            if (Keys[SDLK_LEFT])                P1_Paddle.Setx(P1_Paddle.Getx() - 4);                            if (Keys[SDLK_RIGHT])                P1_Paddle.Setx(P1_Paddle.Getx() + 4);        }

All the others are like this, except that for the hieght ones they will most likely be y-axis, not x-axis like in this case.

Share on other sites
Falling Sky    100
One thing I did for my first pong and chess AI's is I made it make a mistake a random percent of the time. Like in terms of pong it could miscalculate where it thinks the ball is going to go. I didnt read your code exactly but what I did was just put in a random number that subtracted or was added to the coords of where the ball was going to go so the opponents paddle is slightly off, just to give it a lil more randomness instead of being perfect. Im sure this is a horrible method but im just tryin to help!

Share on other sites
What does the updated version have in it?

Share on other sites
dudedbz1    100
The updated version has 1-4 players, and a pause. You can toggle AI on/off for all players with F<player number>.