At 11:21 PM 11/12/2008, Guy Watkins wrote:
>} -----Original Message-----
>} From: [EMAIL PROTECTED] [mailto:hlds_linux-
>} [EMAIL PROTECTED] On Behalf Of Gary Stanley
>} Sent: Wednesday, November 12, 2008 10:16 PM
>} To: Half-Life dedicated Linux server mailing list
>} Subject: Re: [hlds_linux] The 1000fps problem
>}
>} At 05:52 PM 11/12/2008, you wrote:
>} > > You're never going to get 1000 all the time, no matter who says what.
>} > >
>} > > from the usleep() man page:
>} > > BUGS
>} > >        Probably not accurate on many machines down to the
>} > > microsecond.  Count on precision only to -4 or maybe -5.
>} >
>} >It is not possible to achieve a forever constant 1000 in practice, no.
>} But
>} >as you have seen, it is possible to come very close.
>} >
>} >With -pingboost 2, HL1 actually uses select() for its delays. It likely
>} has
>} >some minor precision errors as well (though these have been reduced by
>} >recent improvements in the kernel), but regardless, most of the time this
>} >will be trumped by internal factors, such as the game simply taking
>} longer
>} >than 1ms to handle a tick, and external factors, such as a high overall
>} >machine load or delays in writing to the disk.
>}
>} -pingboost 2 uses alarm(), -pingboost 1 uses select()
>
>alarm() or ualarm() ?


Here's pingboost 1:

void Sys_Sleep_Select( int msec )
{
         struct timeval tv;

         tv.tv_sec       = 0;
         tv.tv_usec      = 1000 * msec;

         select( 1, NULL, NULL, NULL, &tv );

}

Here's 2:

void Sys_Sleep_Timer( int msec )
{
         struct itimerval tm;

         tm.it_value.tv_sec=msec/1000;
         tm.it_value.tv_usec=(msec%1000)*1E3;
         tm.it_interval.tv_sec  = 0;
         tm.it_interval.tv_usec = 0;

         paused=0;
         if( setitimer(ITIMER_REAL,&tm,NULL)==0)
         { // set the timer to trigger
                 pause();         // wait for the signal
         }
         paused=1;

}


Of course, that was taken from the SDK, so there's no telling what is 
what now.. the best option is probably pingboost 3, select and 
setitimer have too much jitter.

I wrote a module that uses more aggressive timing, sort of like 
UDPSoft's old booster, and it almost eliminates FPS jitter :)

Info was taken from a very old email from alfred..

From: 
[EMAIL PROTECTED]@list.valvesoftware.com
on behalf of Alfred [EMAIL PROTECTED]
Sent: 13. juli 2002 07:18
To: [EMAIL PROTECTED]@list.valvesoftware.com
Subject: Re: [hlds_linux] Pingboost modes...

All the pingboot modes attempt to reduce the latency caused by the server.
The default implementation adds around 20msec to each players ping 
(under linux).

Mode "1" reduces this by using a different wait method (a select() call).
This method reduces the latency to 10msec.

Mode "2" uses a similar but slightly different method (and alarm() type call).
Again, the result it 10msec worth of latency being added. NOTE that 
this method
has the potential to hang a server in certain (terminal) situations.
If anyone has used this mode recently (not the first test we did!)
and it hangs please speak up

Mode "3" minimises the latency to the minimum possible level by processing
a frame EVERY time a packet arrives. This causes the lowest possible latency,
but can also cause extreme CPU usages (it does a complete frame for 
every packet,
with each player sending lots of packets per second and 30 players
this adds up to insane amounts of frames). Use this mode at your own risk,
it will consume all available CPU, don't complain that cstrike uses 
too much CPU
if you use this mode :-)

In a future release this mode will be tweaked to let the admin 
balance latencies
agains CPU usage (by processing a frame every N packets).

There is also an external modules called "pingbooster" by UDPSoft
(or is it UDPSoftware?). They implement something like mode "3".
As this is an external module, and was built for an older version
of HL (1108) it may not work properly any longer, and future
releases may (accidently) break it.




_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlds_linux

Reply via email to