Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, AndrewAMD), 14,749 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Something interesting... #289921
09/16/09 10:42
09/16/09 10:42
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline OP
Member

Joined: Apr 2009
Posts: 248
Philippines
Could anybody try this code:

Code:
#include<acknex.h>
#include<default.c>

var testing = 0;

PANEL* backgrnd =
{
	layer = -998;
	digits(400, 500, "Frame Rate: %3.5f", *, 1, testing);
	digits(400, 530, "Time Step: %3.5f", *, 1, time_step);
	flags = SHOW;
}

void main()
{
	fps_max = 60;
	video_set(1024, 768, 32, 2);
	sky_color.red = 0;
	sky_color.green = 0;
	sky_color.blue = 0;
	testing = (float)(16/time_step);
	level_load("");
}



I can get an output of
Frame Rate: 123.18750
Time Step: 0.26660

But where did the engine get a value of 123.18750 if 16/0.26660 = 60.015

If anybody knows why, maybe I need an explanation...
I've tried to cast everything to float but still the output is the same?

Why?



Can't is not an option™
Re: Something interesting... [Re: seecah] #289935
09/16/09 11:50
09/16/09 11:50
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Change your code to this and try it again.
Then, if you cant see whats happened, or why, post and ask.
I wont be far away...
Code:
var testing = 0;
var test_time = 0;

PANEL* backgrnd =
{
	layer = -998;
	digits(400, 500, "Frame Rate: %3.5f", *, 1, testing);
	digits(400, 530, "Time Step: %3.5f", *, 1, test_time);
	flags = SHOW;
}

void main()
{
	fps_max = 60;
	video_set(1024, 768, 32, 2);
	sky_color.red = 0;
	sky_color.green = 0;
	sky_color.blue = 0;
	testing = (float)(16/time_step);
	test_time = time_step;
	level_load("");
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Something interesting... [Re: EvilSOB] #289938
09/16/09 12:11
09/16/09 12:11
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline OP
Member

Joined: Apr 2009
Posts: 248
Philippines
Hi EvilSOB,

Thanks for the response.. you are always there when I posts a problem...

Just now I found out that I have receive that strange value because when the engine executes testing = (float)(16/time_step); it is not yet the updated frame rate being used..

I've tried to modify the code and put a wait function before the manipulation

Code:
fps_max = 75;
	video_set(1024, 768, 32, 2);
	sky_color.red = 0;
	sky_color.green = 0;
	sky_color.blue = 0;
	wait(5);
	testing = (float)(16/time_step);
	level_load("");



or simply put the testing = (float)(16/time_step); inside a while loop and it will works fine..

Thanks



Can't is not an option™
Re: Something interesting... [Re: seecah] #289941
09/16/09 12:24
09/16/09 12:24
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Im not always there when you post a problem...
Im just ALWAYS THERE !

I'd suggest to go with the loop option.
If you only calculate the FPS once, and it "happens" to be
either a "quiet" ro "busy" frame, it will give you a skewed value.

Anyhow, here is an untested bastardisation of the smoothed FPS calculator used by the 'default.c' debug-panel.
fps = 0.9 * fps + 0.1 / time_frame;
BTW, it gets updated once a frame, so put it in a while-loop with a wait(1) and it should calculate correctly.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Something interesting... [Re: EvilSOB] #290059
09/17/09 04:19
09/17/09 04:19
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482
Isn't there a 'time_smooth' variable that can be used for that?
Just set
Code:
time_smooth=0.9;



Re: Something interesting... [Re: bart_the_13th] #290065
09/17/09 05:09
09/17/09 05:09
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Probably, but remember I didnt WRITE this code, just improved the variable name.
And its simple enough as is, and works well enough, so why make
things more complex by trying to crowbar time_smooth in there?


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

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

Gamestudio download | 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