Advertisement

fps counter and time limited rendering

Started by September 19, 2002 06:22 PM
11 comments, last by dario_s 22 years, 5 months ago
Ok... I need a good tutorial on this. I need to understand the theory and also how to code it. Anyone know of a good link to this? Or perhaps someone has the time to explain it for me? PS. No silly answers like fps = frames per second etc..
FPS = first person shooter



























Seriously though, look in the articles section here on GDNet. There''s an excellent tut about timing.
Advertisement
quote:
Original post by Anonymous Poster
FPS = first person shooter



Here - look at definition 2.3

quote:
Original post by dario_s
Ok... I need a good tutorial on this



Frame begin: push time (in ms)
Frame end: pop time
Calculate difference
If TotalTimeOfPushPops >= 1000, count number of frames

There you have it - no need for a tutorial...

Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
yeah atm im doing it like this, too. buuuuut... by this way i do not got the exact fps count ( just integer values ). but me wants a exact floating point once heard that there is a way to get the current fps state direct of the hardware? anyone nows how i do this? (*amtolazytolookitupformyself*) =D
I remember seeing topic like this here... about a year ago.

Frame Per Second = how many frame rendered per one second
which is = 1/(Time to render per one frame)

The way to do this properly is to calculate the average frame per second. You cannot just use (1/time) to do that, the result will be odd. (I''ve tried that).

You didn''t say that you use C++, I assumed that you do.
(I didn''t do windows programming for a long time, I forgot the function name)


Your_render_func() {
static int time;
static int count=1;

int start,stop;
start = GetTimeHere();
/*Do Render Stuff Here*/
stop = GetTimeHere();
time += stop-start;
count++;
if(count == 10) {
//Calculate FPS
float fps = 10/time;
count = 0;
}
}

It will calculate you average FPS (in past 10 frames)

The best way is to get a small program with a source that has FPS counter in, and look how they did it.
and I don''t think you can get FPS out of hardware. Hardware has no way to know that you''ve finished the frame or not.
Advertisement
What your friend was refering to was perhaps the built-in fps counter in DirectX?


Now, for the important stuff...

I know all about basic fps counting, I have a fully working fps code right now. But I wanna know more about ticks and all the other stuff.

I dont just wanna copy peoples code. Im doing this to learn and understand.
When my program works in less than 40-50 fps, the animation looks very very bad (not smooth). maybe you know why, I don't understand it because according to the theory the human eye should 'see' any animation with more than 24 fps as smooth animation, so that it should not be able to separate between two proceeding frames.
???

[edited by - kish on September 20, 2002 11:05:47 PM]
Are you using double buffering?

What do you really mean by, not smooth?
maybe it can happened if the time U use to render a frame is very different. For ex.

Frame 1 = 1 ms.
Frame 2 = 100 ms.
Frame 3 = 2 ms.
Frame 4 = 2 ms.

You''ll get a good average FPS count for that, but your eyes will see something not really smooth between frame 2 and 3.
varokasp, I use dubble buffering.
I guess you r right and there are specific frames that are slowly rendered, but the average fps is high because most of the frame are rendered fast.
What could make one frame to be slower then the others ?

This topic is closed to new replies.

Advertisement