Test my sidescroller

Started by
36 comments, last by JackRabbit 21 years, 6 months ago
Thanx for replying JackRabbit,

But i don''t see where is defined the variable "FPS" and how it changes it''s value.

PLZ siaspete can u tell us what u use to print the frame rate on the screen?
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
Advertisement
Well, i have a function to calculate the FPS value, which
i call once every frame. It look like this:


        int CalcFPS(){    static int FPS = 0;     static int frameCount = 0;    static long startTime = GetTickCount();         // Has 1 second passed ?    if( ( GetTickCount() - startTime ) > 1000 )    {	FPS = frameCount;     // Save the frame count	frameCount = 0;       // Reset framecounter	startTime = GetTickCount();  // Get new starttime    }    else    {        // Increment frame counter	frameCount++;    }	    // Return the FPS    return FPS;}  


Then in my main loop, i simply declare a variable to hold the
value returned, like this:

int FPS = CalcFPS();

And then i write that variable to the buffer, which is then
printed on the screen, like i showed you above.

Hope this makes sence!


[edited by - JackRabbit on October 5, 2002 5:41:44 AM]
Thanx man!
i though the frame rate was shown by directx itself and that FPS was a directx's variable like LPDIRTECDRAW is directx's structure
LOL

[edited by - remi on October 5, 2002 11:34:43 AM]
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
Nice! 75fps on an Athlon 1800XP (1.53GHz) 64MB Gf3, 512MB sysram, Windows XP
Only ran it in full-screen with the retrace on. And I see you do have some enemies; they just only spawn and then run to the lower right corner of the game world :-P

cool, hope to see it when it''s finishd.
-david
My system:

PIII-550 Intel
640 MB ram
GeForce3 TI-200 (64 mb)

ran with 74 fps... Somehow i wasnt able to switch to "dont wait for vertical retrace"...
*c++ = true;
Thanks for you input guys!

Glad it worked for you.

quote: Original post by Coder42
Somehow i wasnt able to switch to "dont wait for vertical retrace"


I think its the GeForce card. Alot of people(includig myself) cant switch off VSync.

quote: Original post by Muse
And I see you do have some enemies; they just only spawn and then run to the lower right corner of the game world


Heheee, damn annoying isnt it ?
I have fixed that though. Now they stay on the platforms they land on. Unless ofcourse the collision fails, and they fall through.

Btw, the collision still isnt fixed. Im not really sure how to go about the problem. So if anyone have any ideas, or an URL you think could help, let me know.

Thanks once again for posting!


[edited by - JackRabbit on October 7, 2002 1:48:57 AM]
quote:Original post by JackRabbit
Well, i have a function to calculate the FPS value, which
i call once every frame. It look like this:


            int CalcFPS(){    static int FPS = 0;     static int frameCount = 0;    static long startTime = GetTickCount();         // Has 1 second passed ?    if( ( GetTickCount() - startTime ) > 1000 )    {	FPS = frameCount;     // Save the frame count	frameCount = 0;       // Reset framecounter	startTime = GetTickCount();  // Get new starttime    }    else    {        // Increment frame counter	frameCount++;    }	    // Return the FPS    return FPS;}   Correct me if I'm wrong on this, but I think your "Has 1 second passed" code should look more like this. (It's just 2 small details, though)          // Has 1 second passed ?    if( ( GetTickCount() - startTime ) >= 1000 )  //<--Greater OR equal to    {	FPS = frameCount;     // Save the frame count	frameCount = 0;       // Reset framecounter	startTime += 1000;  //<--Forward to the next second    }    



/John

[edited by - FunkyTune on October 7, 2002 2:42:31 AM]
/John
Yes, im sure your method would work just as well.
Though im not really sure about incrementing startTime by
a constant. It looks ok, but im dont know if it would be
as accurate as getting the new time. Maybe im just paranoid

Though i doubt that the difference would be worth worying about.

PS:
Any of you Guru''s out there, feel free to step in any time and slap us both around with a large trout, if we are way wrong about this one

This topic is closed to new replies.

Advertisement