Quote:
Originally Posted by Pierre-Marie Baty
The map cycle time is stored in a CVAR, which I don't remember the name. Have you tried to look for it with the "cvarlist" console command ? Once you know this CVAR's name, you can predict the remaining time using gpGlobals->time this way: - In ServerActivate(), do something like: gflNextMapChangeTime = gpGlobals->time + CVAR_GET_FLOAT ("sv_mapcycletime"); // assuming sv_mapcycletime is the name of your CVAR
- Then each time you want to know the remaining time, do something like: flTimeRemaining = gflNextMapChangeTime - gpGlobals->time;
This should give you the remaining time in seconds. Redo the same substraction each time you want to know the remaining time.
|
The CVAR is mp_timelimit
I thought I tried exactly what your are suggesting, but I messed around with the code so many times I can't be sure anymore. Perhaps I used the engine time function instead of the gpGlobals->time value? I'll give it another try - thanks
Quote:
Joe has written a whole in-game, visual, graphical code profiler using QueryPerformanceCounters and such, you should ask him 
Unfortunately I believe QueryPerformanceStuff is Win32-specific stuff only.
|
That is why I'm wondering how it is implemented. If we can find out then perhaps a pottable version could possibly be built *edit* pun
not intended
Quote:
About the code you posted, your idea to keep track of the rollover count is great ; however I think I'll stick with simpler stuff for now, until I understand exactly how this clock thingy works But thanks anyway !
|
Uh? This from the same guy who figured out how to process a BSP tree and compute all walkable surfaces!

If you need more help with this one just ask, I'll be happy to help out.
The clock() thing is very simple without rollover. It just returns the number of clock ticks (~1000 per second) since the calling process started. To time something, you just get the clock() count for the start time, and later get the clock() end time. Then you compute the difference of the start time with the end time giving you the number of elapsed clock ticks. To get this in seconds, just divide by 1000 (better to use CLK_TCK).
What I did was create a timer class so I could set up multiple independant timers. I do something like vclTimer.fvoStart(10) to start counting up to 10 seconds, and I can check if the timer has timedout or not with a simple boolen function, example if ( vclTimer.fbTimedout() ) { // press the fire button else keep waiting }
From this timing function, you can create a generic system for doing timed events that get triggered after a certain period of time elapses. Doing that will simplify realtime programming by a huge factor.