UI stuff and frametime
UI stuff and frametime
Well, i need to animate smoothly UI stuff in darkplaces, and i am using frametime. I know that can cause problems and Spike suggest use cltime + clframetime for that (instead frametime and time), the problem is: i dont find cltime or clframetime extensions in darkplaces defs. Is there any way to recreate these extensions using qc? maybe cltime or clframetime have a different name in darkplaces? I searched for them without success thank you very much
hi, I am nahuel, I love quake and qc.
Re: UI stuff and frametime
Code: Select all
float GETTIME_FRAMESTART = 0; // time of start of frame
float GETTIME_REALTIME = 1; // current time (may be OS specific)
float GETTIME_HIRES = 2; // like REALTIME, but may reset between QC invocations and thus can be higher precision
float GETTIME_UPTIME = 3; // time since start of the engine
//builtin definitions:
float(float tmr) gettime = #519;
" but may reset between QC invocations and thus can be higher precision" i donot understant this.
I guess gettime(GETTIME_HIRES); is not clframetime, but i can use it as is? sorry i dont understand the gettime stuff at all , (GETTIME_HIRES works very fine anyway)
ty
hi, I am nahuel, I love quake and qc.
Re: UI stuff and frametime
Code: Select all
if (runningindp)
{
static float oldtime;
cltime = gettime(GETTIME_FRAMESTART);
clframetime = oldtime?cltime - oldtime:0.1;
oldtime = cltime;
}
HIRES is time-since-frame-start (read: high res only because the float value is centered around 0), REALTIME also continuously changes for each call. uptime==framestart (read: map changes will not restore lost precision, so restart the client at least once a day).
none of theses are subject to latency or drift, so they'll stay smooth (precision-willing - doubles are fine, but floats are only okay for inter-frame deltas but when they're used for time-since-foo they'll suffer noticeable precision loss after about a day).
Re: UI stuff and frametime
Code: Select all
static float
Code: Select all
clframetime = oldtime?cltime - oldtime:0.1;
map changes will not restore lost precision, so restart the client at least once a day.
well i guess i should add a extreme-clock-timer to send a "restart" command in csqc after 20 hours (72000 seconds), maybe the best option in this EXTREME case is to use a quicksav and load it ? it restarts when player load saved games?they'll suffer noticeable precision loss after about a day
i dont know exactly why "changemap" command doesnt restore lost precisión . "map" command do it? TY in advance,
hi, I am nahuel, I love quake and qc.
Re: UI stuff and frametime
static works at both global scope and local scope, equivalent to C.
(static locals are also visible to nested functions where regular locals are not)
r = (a?b:c)
is equivalent to
if (a) r=b; else r=c;
recovering lost precision requires rebasing the float timer back to 0. double(float)s have more than enough precision, but (single)floats do not, hence why the engine is okay, but qc will have issues before that.
join some unpopular nq server some time. one that has a map uptime of 4+ days. you'll see how it can't even hold time differences of 0.1. You need much more precision than that for smooth animations.
(static locals are also visible to nested functions where regular locals are not)
r = (a?b:c)
is equivalent to
if (a) r=b; else r=c;
recovering lost precision requires rebasing the float timer back to 0. double(float)s have more than enough precision, but (single)floats do not, hence why the engine is okay, but qc will have issues before that.
join some unpopular nq server some time. one that has a map uptime of 4+ days. you'll see how it can't even hold time differences of 0.1. You need much more precision than that for smooth animations.