Forum

get framerate in qc

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

get framerate in qc

Postby Nahuel » Sun Jan 27, 2013 5:00 am

Hello forum, i have a question: is there a way to get the framerate value from qc? (i am using darkplaces=
:) thanks

PS:
had to enter here by a website that uses IP's anonymous, inside 3d dowsn't work correctly :(
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Re: get framerate in qc

Postby taniwha » Sun Jan 27, 2013 5:40 am

Isn't there a frametime global? If so, the frame rate is just 1/frametime. If not, you can create your own using
Code: Select all
float frametime;
float oldtime;

...
    frametime = time - oldtime;
    oldtime = time;

Watch out for the first time as frametime will be 0). Also, due to floats being floats, the accuracy will degrade after a couple of hours (see here for details). However, if frametime (or similar) is available, then it's probably calculated from double time (rather than float) and thus accurate for longer than anyone will care to play a single level :).
Leave others their otherness.
http://quakeforge.net/
taniwha
 
Posts: 399
Joined: Thu Jan 14, 2010 7:11 am

Re: get framerate in qc

Postby Spike » Sun Jan 27, 2013 12:28 pm

which framerate?
the server's framerate can be calculated by checking frametime inside the StartFrame function.
the client's framerate can be calculated by checking the timing between PlayerPreThink. In a QuakeWorld engine, the frametime value is updated to be the amount of time between input frames rather than the time between server frames. I assume DP is similar.

There is no way to determine the actual video framerate without csqc.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: get framerate in qc

Postby frag.machine » Mon Jan 28, 2013 1:56 am

Spike wrote:There is no way to determine the actual video framerate without csqc.


I fail to see what's the scenario that justifies the use of video framerate information in QC code (even CSQC).
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Re: get framerate in qc

Postby Spike » Mon Jan 28, 2013 2:09 am

depends how broken an engine's interpolation is. :P

one reason you might want the video framerate is to cut back on explosion effects or filter distant entities or whatever if the rate drops too low.
I dunno, maybe you'd want to kick people with framerates higher than 2000 because you're jealous or something. :P

But yeah, the only really important rate for nq mods is the outgoing packet rate, which should generally match the server's frametime global in StartFrame.
Frame times elsewhere should be considered unreliable, as there is more than one engine that runs players/entities out of sequence or multiple thinks per frame and other such things.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: get framerate in qc

Postby frag.machine » Mon Jan 28, 2013 1:28 pm

Spike wrote:one reason you might want the video framerate is to cut back on explosion effects or filter distant entities or whatever if the rate drops too low.

Both cases could (and SHOULD) be handled (much better) by the engine code IMO.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest