Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to know the current framerate #280157
07/21/09 07:12
07/21/09 07:12
Joined: Nov 2003
Posts: 433
The Netherlands
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
Hello,

I was wondering how to know what the current framerate is, i need this to set the clip_far and fog distance in-game using a while loop.

I looked in the manual but i could not find it there, is this possible?

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 Offline
Expert
EvilSOB  Offline
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
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
I tryed the code in the example below;

Code:
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)

Code:
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
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
it uses a factor 16 in the digits on dbg panel

use
Code:
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 Offline
Serious User
Rackscha  Offline
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 Offline
Expert
EvilSOB  Offline
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: EvilSOB] #280338
07/22/09 09:45
07/22/09 09:45
Joined: Nov 2003
Posts: 433
The Netherlands
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
Thanks everyone laugh

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 Offline
Serious User
DJBMASTER  Offline
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.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1