#include <eLagCompensation.h>
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 |
Definition at line 35 of file eLagCompensation.h.
void eLag::Report | ( | int | client, | |
REAL | lag | |||
) | [static] |
call on the server: report that a client is lagging
client | the ID of the client the lag is happening for | |
lag | the amount of lag |
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 }
call on the server: ask for lag credit to backdate received commands
client | the ID of the client the lag is happening for | |
lag | the amount of lag that is to be compensated |
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 }
REAL eLag::Credit | ( | int | client | ) | [static] |
call on the server: ask how much lag credit is left
client | the ID of the client the lag is happening for |
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 }
REAL eLag::Threshold | ( | void | ) | [static] |
call on the server: gives the amount of lag that is always tolerated without using up credit
Definition at line 419 of file eLagCompensation.cpp.
References se_lagThreshold.
Referenced by eNetGameObject::LagThreshold().
00420 { 00421 return se_lagThreshold; 00422 }
REAL eLag::Current | ( | void | ) | [static] |
call on the client: returns the amount of lag that is currently to be compensated by the game code
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 }
void eLag::Timestep | ( | REAL | dt | ) | [static] |
call on the client: advance time
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 }