|
|
Re: How to know the current framerate
[Re: Toon]
#280159
07/21/09 07:16
07/21/09 07:16
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
MUST be calculated EVERY frame to average itself out, and give real readings.
var fps=0; ... fps = 0.9*fps+0.1/time_frame;
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: How to know the current framerate
[Re: EvilSOB]
#280161
07/21/09 07:31
07/21/09 07:31
|
Joined: Nov 2003
Posts: 433 The Netherlands
Toon
OP
Senior Member
|
OP
Senior Member
Joined: Nov 2003
Posts: 433
The Netherlands
|
I tryed the code in the example below;
while(1)
{
//calculate fps
fps = 0.9*fps+0.1/time_frame;
if(fps < 35)
{
camera.clip_far = 3000;
camera.fog_start = 1000;
camera.fog_end = 2000;
}
else
{
camera.clip_far = 12000;
camera.fog_start = 9000;
camera.fog_end = 11000;
}
wait(1);
}
The problem is that my digits return 2, while [f11]-panel returns 40 (the fps_max value)
digits = 0,0,3,_a4font,1,fps;
|
|
|
Re: How to know the current framerate
[Re: Toon]
#280171
07/21/09 10:14
07/21/09 10:14
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
it uses a factor 16 in the digits on dbg panel use
digits = 0,0,3,_a4font,16,fps;
|
|
|
Re: How to know the current framerate
[Re: MrGuest]
#280172
07/21/09 10:20
07/21/09 10:20
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
Can you explain it a bit closer, why it has to be used with a exact factor of 16?
Greets Rackscha
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: How to know the current framerate
[Re: Rackscha]
#280209
07/21/09 13:27
07/21/09 13:27
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Doh! Good catch MrGuest, I missed that bit.... Sorry Rackscha my bad for sloppy plagarism of 3DGS's 'default.c' coding.
Here is a corrected version with has the factoring built-in. fps = 0.9*fps+1.6/time_frame; Just replace the calculation line in your code with this and it will work. No other changes, and leave your digits as digits = 0,0,3,_a4font,1,fps;
As for my original formula (which I stole from the debug-panel in "default.c'), I dont know WHY its done with a scale factor of 16, but it just is, and I missed that part.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: How to know the current framerate
[Re: Toon]
#280529
07/23/09 08:17
07/23/09 08:17
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
The frame cycle is measured in ticks. A tick is a 16th of a second. You have to multiply by 16 to get the value in seconds. 16 is the maximum range of the fps_min variable.
Last edited by DJBMASTER; 07/23/09 08:20.
|
|
|
|