client slowdown/wait/speedup messages in verbose mode only

This commit is contained in:
Titus Tscharntke 2013-06-16 18:21:33 +00:00
parent 075293de09
commit d13242287c
2 changed files with 6 additions and 6 deletions

View File

@ -1836,9 +1836,9 @@ void Game::update() {
// calc time waiting for message in milliseconds to frames // calc time waiting for message in milliseconds to frames
int64 timeClientWaitedForLastMessage=clientInterface->getTimeClientWaitedForLastMessage(); int64 timeClientWaitedForLastMessage=clientInterface->getTimeClientWaitedForLastMessage();
if(timeClientWaitedForLastMessage>0){ if(timeClientWaitedForLastMessage>0){
printf("world.getFrameCount():%d index %d Client waited:%d ms\n",world.getFrameCount(),index,(int)timeClientWaitedForLastMessage); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("world.getFrameCount():%d index %d Client waited:%d ms\n",world.getFrameCount(),index,(int)timeClientWaitedForLastMessage);
framesNeededToWaitForServerMessage[index]=timeClientWaitedForLastMessage*GameConstants::updateFps/1000; framesNeededToWaitForServerMessage[index]=timeClientWaitedForLastMessage*GameConstants::updateFps/1000;
printf("ClienttimeClientWaitedForLastMessage:%d ms which is %d frames \n",(int)timeClientWaitedForLastMessage,framesNeededToWaitForServerMessage[index]); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("ClienttimeClientWaitedForLastMessage:%d ms which is %d frames \n",(int)timeClientWaitedForLastMessage,framesNeededToWaitForServerMessage[index]);
} }
else { else {
framesNeededToWaitForServerMessage[index]=0; framesNeededToWaitForServerMessage[index]=0;
@ -1878,13 +1878,13 @@ void Game::update() {
framesToCatchUpAsClient=minimum-allowedMaxFallback; framesToCatchUpAsClient=minimum-allowedMaxFallback;
framesToSlowDownAsClient=0; framesToSlowDownAsClient=0;
cleanupStats=true; cleanupStats=true;
printf("Worldframe %d : Client will speed up: %d frames\n",world.getFrameCount(),framesToCatchUpAsClient); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Worldframe %d : Client will speed up: %d frames\n",world.getFrameCount(),framesToCatchUpAsClient);
} }
else if(countOfMessagesReceivedTooLate>3){ else if(countOfMessagesReceivedTooLate>3){
framesToSlowDownAsClient=sumOfTooLateFrames/countOfMessagesReceivedTooLate; framesToSlowDownAsClient=sumOfTooLateFrames/countOfMessagesReceivedTooLate;
framesToCatchUpAsClient=0; framesToCatchUpAsClient=0;
cleanupStats=true; cleanupStats=true;
printf("Worldframe %d : Client will slow down: %d frames\n",world.getFrameCount(),framesToSlowDownAsClient); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Worldframe %d : Client will slow down: %d frames\n",world.getFrameCount(),framesToSlowDownAsClient);
} }
if(cleanupStats==true) { if(cleanupStats==true) {

View File

@ -1366,7 +1366,7 @@ bool ClientInterface::getNetworkCommand(int frameCount, int currentCachedPending
//} //}
if(waitForData == false) { if(waitForData == false) {
printf("Client waiting for packet for frame: %d, copyCachedLastPendingFrameCount = %lld\n",frameCount,(long long int)copyCachedLastPendingFrameCount); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Client waiting for packet for frame: %d, copyCachedLastPendingFrameCount = %lld\n",frameCount,(long long int)copyCachedLastPendingFrameCount);
chrono.start(); chrono.start();
} }
if(copyCachedLastPendingFrameCount > frameCount) { if(copyCachedLastPendingFrameCount > frameCount) {
@ -1385,7 +1385,7 @@ bool ClientInterface::getNetworkCommand(int frameCount, int currentCachedPending
} }
} }
if(waitForData == true) { if(waitForData == true) {
printf("Client waiting for packet FINISHED for frame: %d, copyCachedLastPendingFrameCount = %lld waitCount = %llu\n",frameCount,(long long int)copyCachedLastPendingFrameCount,(long long unsigned int)waitCount); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Client waiting for packet FINISHED for frame: %d, copyCachedLastPendingFrameCount = %lld waitCount = %llu\n",frameCount,(long long int)copyCachedLastPendingFrameCount,(long long unsigned int)waitCount);
} }
return result; return result;