mirror of
https://github.com/glest/glest-source.git
synced 2025-08-26 01:23:35 +02:00
- add a silent ini setting in case the auto lag code needs to be turned off down the road: AutoClientLagCorrection=true (hard coded, add and set as false in ini if required, this onhly affects game hosts)
This commit is contained in:
@@ -1135,26 +1135,29 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//!!!
|
// This may end up continuously lagging and not disconnecting players who have
|
||||||
double LAG_CHECK_GRACE_PERIOD = 15;
|
// just the 'wrong' amount of lag (but not enough to be horrible for a disconnect)
|
||||||
double maxFrameCountLagAllowed = 10;
|
if(Config::getInstance().getBool("AutoClientLagCorrection","true") == true) {
|
||||||
double maxClientLagTimeAllowed = 8;
|
double LAG_CHECK_GRACE_PERIOD = 15;
|
||||||
|
double maxFrameCountLagAllowed = 10;
|
||||||
|
double maxClientLagTimeAllowed = 8;
|
||||||
|
|
||||||
if(this->serverInterface->getGameStartTime() > 0 &&
|
if(this->serverInterface->getGameStartTime() > 0 &&
|
||||||
difftime(time(NULL),this->serverInterface->getGameStartTime()) >= LAG_CHECK_GRACE_PERIOD) {
|
difftime(time(NULL),this->serverInterface->getGameStartTime()) >= LAG_CHECK_GRACE_PERIOD) {
|
||||||
if(this->isConnected() == true) {
|
if(this->isConnected() == true) {
|
||||||
double clientLag = this->serverInterface->getCurrentFrameCount() - this->getCurrentFrameCount();
|
double clientLag = this->serverInterface->getCurrentFrameCount() - this->getCurrentFrameCount();
|
||||||
double clientLagCount = (gameSettings.getNetworkFramePeriod() > 0 ? (clientLag / gameSettings.getNetworkFramePeriod()) : 0);
|
double clientLagCount = (gameSettings.getNetworkFramePeriod() > 0 ? (clientLag / gameSettings.getNetworkFramePeriod()) : 0);
|
||||||
double clientLagTime = difftime(time(NULL),this->getLastReceiveCommandListTime());
|
double clientLagTime = difftime(time(NULL),this->getLastReceiveCommandListTime());
|
||||||
|
|
||||||
// New lag check
|
// New lag check
|
||||||
if((maxFrameCountLagAllowed > 0 && clientLagCount > maxFrameCountLagAllowed) ||
|
if((maxFrameCountLagAllowed > 0 && clientLagCount > maxFrameCountLagAllowed) ||
|
||||||
(maxClientLagTimeAllowed > 0 && clientLagTime > maxClientLagTimeAllowed)) {
|
(maxClientLagTimeAllowed > 0 && clientLagTime > maxClientLagTimeAllowed)) {
|
||||||
|
|
||||||
waitForLaggingClient = true;
|
waitForLaggingClient = true;
|
||||||
if(waitedForLaggingClient == false) {
|
if(waitedForLaggingClient == false) {
|
||||||
waitedForLaggingClient = true;
|
waitedForLaggingClient = true;
|
||||||
printf("*TESTING*: START Waiting for lagging client playerIndex = %d [%s] clientLagCount = %f [%f]\n",playerIndex,name.c_str(),clientLagCount,clientLagTime);
|
printf("*TESTING*: START Waiting for lagging client playerIndex = %d [%s] clientLagCount = %f [%f]\n",playerIndex,name.c_str(),clientLagCount,clientLagTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user