eLag Class Reference

class for lag compensation functions in the game code More...

#include <eLagCompensation.h>

List of all members.

Static Public Member Functions

static void Report (int client, REAL lag)
 call on the server: report that a client is lagging
static REAL TakeCredit (int client, REAL lag)
 call on the server: ask for lag credit to backdate received commands
static REAL Credit (int client)
 call on the server: ask how much lag credit is left
static REAL Threshold ()
 call on the server: gives the amount of lag that is always tolerated without using up credit
static REAL Current ()
 call on the client: returns the amount of lag that is currently to be compensated by the game code
static void Timestep (REAL dt)
 call on the client: advance time


Detailed Description

class for lag compensation functions in the game code

Definition at line 35 of file eLagCompensation.h.


Member Function Documentation

void eLag::Report ( int  client,
REAL  lag 
) [static]

call on the server: report that a client is lagging

Parameters:
client the ID of the client the lag is happening for
lag the amount of lag
Returns:
the amount of lag that is allowed to be compensated by the game code

Definition at line 356 of file eLagCompensation.cpp.

References MAXCLIENTS, nServerLag::Report(), and tVERIFY.

Referenced by gCycle::OnNotifyNewDestination().

00357 {
00358     tVERIFY( 1 <= client && client <= MAXCLIENTS );
00359 
00360     se_serverLag[client].Report( lag );
00361 }

Here is the call graph for this function:

Here is the caller graph for this function:

REAL eLag::TakeCredit ( int  client,
REAL  lag 
) [static]

call on the server: ask for lag credit to backdate received commands

Parameters:
client the ID of the client the lag is happening for
lag the amount of lag that is to be compensated
Returns:
the amount of lag that is allowed to be compensated by the game code

Definition at line 375 of file eLagCompensation.cpp.

References MAXCLIENTS, nServerLag::TakeCredit(), and tVERIFY.

Referenced by gCycle::OnNotifyNewDestination().

00376 {
00377     tVERIFY( 1 <= client && client <= MAXCLIENTS );
00378 
00379     return se_serverLag[client].TakeCredit( lag );
00380 }

Here is the call graph for this function:

Here is the caller graph for this function:

REAL eLag::Credit ( int  client  )  [static]

call on the server: ask how much lag credit is left

Parameters:
client the ID of the client the lag is happening for
Returns:
the amount of lag that is allowed to be compensated by the game code

Definition at line 394 of file eLagCompensation.cpp.

References nServerLag::CreditLeft(), MAXCLIENTS, nSERVER, REAL, se_lagCreditSingle, sn_GetNetState(), and tVERIFY.

Referenced by gCycleMovement::TimestepCore().

00395 {
00396     // don't give credit on the client
00397     if ( sn_GetNetState() != nSERVER )
00398         return 0;
00399 
00400     tVERIFY( 1 <= client && client <= MAXCLIENTS );
00401 
00402     // see how much total credit is left
00403     REAL credit = se_serverLag[client].CreditLeft();
00404 
00405     // but clamp it with the maximum single credit
00406     return credit > se_lagCreditSingle ? se_lagCreditSingle : credit;
00407 }

Here is the call graph for this function:

Here is the caller graph for this function:

REAL eLag::Threshold ( void   )  [static]

call on the server: gives the amount of lag that is always tolerated without using up credit

Returns:
the amount of lag that is always tolerated

Definition at line 419 of file eLagCompensation.cpp.

References se_lagThreshold.

Referenced by eNetGameObject::LagThreshold().

00420 {
00421     return se_lagThreshold;
00422 }

Here is the caller graph for this function:

REAL eLag::Current ( void   )  [static]

call on the client: returns the amount of lag that is currently to be compensated by the game code

Returns:
the amount of lag that needs to be compensated

Definition at line 434 of file eLagCompensation.cpp.

References se_lagOffsetClient, se_lagOffsetServer, and nClientLag::SmoothLag().

Referenced by eTimer::Time().

00435 {
00436     return se_clientLag.SmoothLag() + se_lagOffsetClient + se_lagOffsetServer;
00437 }

Here is the call graph for this function:

Here is the caller graph for this function:

void eLag::Timestep ( REAL  dt  )  [static]

call on the client: advance time

Parameters:
dt time passed since last call

Definition at line 449 of file eLagCompensation.cpp.

References nClientLag::Timestep().

Referenced by eTimer::SyncTime().

00450 {
00451     se_clientLag.Timestep( dt );
00452 }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Sat Mar 15 23:26:03 2008 for Armagetron Advanced by  doxygen 1.5.4