|
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible),
637
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
FPS onscreen
#81262
07/13/06 14:55
07/13/06 14:55
|
Joined: Jul 2005
Posts: 262 Earth, The Netherlands
NL_3DGS_n00b
OP
Member
|
OP
Member
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
|
How can I display the FPS speed? I have knowledge for making panels, but I have no idea if there is a variable to display the FPS speed etc...
The best games are the games you create yourself.
|
|
|
Re: FPS onscreen
[Re: NL_3DGS_n00b]
#81263
07/13/06 14:59
07/13/06 14:59
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
Using time_fac is one way (multiply it by 16), but it's an abandoned variable.
Using this simple computation is another:
fps_display = pow(time_step, -1)*16;
This takes the reciprocal of the time_step variable and multiplies it by 16. This gives the frame rate. Then, just add a panel to point to this.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: FPS onscreen
[Re: NL_3DGS_n00b]
#81264
07/13/06 15:00
07/13/06 15:00
|
Joined: Jan 2004
Posts: 2,013 The Netherlands
Excessus
Expert
|
Expert
Joined: Jan 2004
Posts: 2,013
The Netherlands
|
16 / time_step  EDIT: Too late, but I think my formula is easyer to understand. pow(time_step, -1)* 16 = (time_step ^(-1)) * 16 = (1/time_step)*16 = 16 / time_step. I don't know about speed or accuracy..
Last edited by Excessus; 07/13/06 15:04.
|
|
|
Re: FPS onscreen
[Re: NL_3DGS_n00b]
#81268
07/13/06 15:12
07/13/06 15:12
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
Whoops! I forgot to simplify the formula, but it's still the same thing.
time_step is a predefined variable available in the 6.40.5 update. For those using older versions, use "time" instead. You do, however, have to define fps_display (or whatever you want to call it), as that isn't a predefined variable.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: FPS onscreen
[Re: ulillillia]
#81269
07/13/06 15:25
07/13/06 15:25
|
Joined: Jul 2005
Posts: 262 Earth, The Netherlands
NL_3DGS_n00b
OP
Member
|
OP
Member
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
|
I placed fps_display = 16 / time; inside a while(1){ } with a wait(64); inside a function so it won't refresh to fast. Now I see it switches from 200 to 256. So I think it works?
The best games are the games you create yourself.
|
|
|
Re: FPS onscreen
[Re: Excessus]
#81271
07/13/06 15:33
07/13/06 15:33
|
Joined: Jul 2005
Posts: 262 Earth, The Netherlands
NL_3DGS_n00b
OP
Member
|
OP
Member
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
|
Thanks, I'll check it out. EDIT: This is the script I'm using now, it works fine now: Code:
function fps_show{ if(FPS.visible == off){ FPS.visible = on; while(FPS.visible == on){ fps_display = 16 / time; wait(1); } }else{ FPS.visible = off; } }
on_f = fps_show;
Last edited by NL_3DGS_n00b; 07/13/06 15:40.
The best games are the games you create yourself.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|