Fybertech Forums

Projects and Development => Programmerin' => Topic started by: FyberOptic on August 31, 2008, 08:14:22 pm

Title: Fypong
Post by: FyberOptic on August 31, 2008, 08:14:22 pm
I've been messing with this Clanlib (http://www.clanlib.org/) game development library for C++, which makes it easier to actually make a game, instead of fooling around with underlying code for sounds and images and sprites all day.  So far I like it pretty well, and recommend it to anyone else with knowledge of C++ to give it a shot.

So while experimenting with its features, I kind of worked them into a little test app.  It cycles colors, draws a semi-transparent background, renders the play objects onto a secondary canvas and rotates it in the corner, etc.  Then I thought it was almost demo material enough to upload for folks to check out, so I added in a ball, collision detection, generated some sounds and such, and it ended up being a fun little diddy to mess with. 

Download Fypong v0.1 (http://www.fybertech.com/misc/fypong01.zip)

GAMEPLAY: ARROW KEYS MOVE PADDLE.  BOUNCE BALL.  IT'S PONG.


p.s.  I was getting an fps of around 600, so I'm curious to know what other folks get with it, to use as a reference of the performance of the code and the Clanlib library and all that.  I'd also be curious of any serious stuttering or gameplay problems, which could be attributed to things on different PCs.

Title: Re: Fypong v0.1
Post by: Boris on August 31, 2008, 08:56:13 pm
For memories sake:

I get about 445 frames with vsync off, though the limiting factor seems to be Vista or my video card.

Also, my vid card properties were set to 'allow program to decide vsync' and vsync still kicked in so either it happens by default or something.
Title: Re: Fypong v0.1
Post by: FyberOptic on September 01, 2008, 12:20:00 am
I'll post my screenshot I took earlier here so that folks can make sure theirs looks right:

(http://www.fybertech.com/images/fypong01.png)
Title: Re: Fypong v0.1
Post by: MDude on September 01, 2008, 09:14:24 pm
And for comparison, here's what I'm getting:

(http://img.photobucket.com/albums/v83/MDude/Fypong.png)
Title: Re: Fypong
Post by: FyberOptic on September 01, 2008, 10:59:33 pm
I think you're getting that because something about your computer, video card, or the clanlib code, is causing the canvas object (which creates a second opengl context) to actually use the first one for rendering for some reason.  Either way I want to get to the bottom of it.

But I've disabled the canvas for this newest version anyway..!

Download Fypong v0.2 (http://www.fybertech.com/misc/fypong02.zip)

I'll probably change the name eventually since I have a game idea, but it's fine for now.  Basically I came to the conclusion that I wanted to do a combination of Pong and Space Invaders.  So I created a couple frames of an alien animation, figured out the collision detection of clanlib, and wrote in the confusing code to make it properly bounce off of them (for now). 

This version also has improved controls.  The arrow keys accelerate the paddle so that you can tap the buttons for finer control.  You can also use the mouse now!  Let me know of any issues and such iffin you try it out.  Mind you that nothing ever really happens in this; you just bounce it off of aliens, they turn red with each hit, and eventually they float off the bottom of the screen.


(http://www.fybertech.com/images/fypong02.png)
Title: Re: Fypong
Post by: FyberOptic on September 02, 2008, 10:37:54 pm
A bigger update, sort of.  Now when the ball bumps into the aliens from the side, they get knocked crooked.  From there, they continue downwards on this crooked path.  The code for this was tricky, since it involves detecting where exactly the collision happened, combined with rotation of the enemies on top of that.  So if you see anything crazy happen, it might be worth mentioning here.

The aliums shoot now too, and will shoot crookedly when applicable.  The shots are just absorbed into the paddle for now, so it doesn't hurt anything to get hit by them. 

There's other misc fixes and updates, some of which improved the framerate a bit, but by the time I added in all the extra collision detection, it probably brought it back down..!  Also, the ball actually starts at a random speed now, since I had forgotten to initialize the random seed before.  ^^;;


Download Fypong v0.3 (http://www.fybertech.com/misc/fypong03.zip)


(http://www.fybertech.com/images/fypong03.png)