From 3b06db30e99b6f4ec6e1b15431b0a7966c105c35 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 5 Jun 2010 00:00:36 +0000 Subject: [PATCH] commented out ping code and added synch check for large comamnds list --- source/glest_game/game/game_constants.h | 2 +- source/glest_game/network/client_interface.cpp | 10 ++++++++++ source/glest_game/network/server_interface.cpp | 10 ++++++++++ source/shared_lib/sources/platform/posix/socket.cpp | 3 +++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/source/glest_game/game/game_constants.h b/source/glest_game/game/game_constants.h index eae4d395..8facaf80 100644 --- a/source/glest_game/game/game_constants.h +++ b/source/glest_game/game/game_constants.h @@ -37,7 +37,7 @@ public: static const int serverPort= 61357; static const int updateFps= 40; static const int cameraFps= 100; - static const int networkFramePeriod= 10; + static const int networkFramePeriod= 20; static const int networkExtraLatency= 200; static const int maxClientConnectHandshakeSecs= 10; diff --git a/source/glest_game/network/client_interface.cpp b/source/glest_game/network/client_interface.cpp index 0bc9e5aa..68cf844c 100755 --- a/source/glest_game/network/client_interface.cpp +++ b/source/glest_game/network/client_interface.cpp @@ -111,6 +111,16 @@ void ClientInterface::update() sendMessage(&networkMessageCommandList); } + // Possible cause of out of synch since we have more commands that need + // to be sent in this frame + if(!requestedCommands.empty()) { + char szBuf[1024]=""; + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING / ERROR, requestedCommands.size() = %d\n",__FILE__,__FUNCTION__,requestedCommands.size()); + + string sMsg = Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + " may go out of synch: client requestedCommands.size() = " + intToStr(requestedCommands.size()); + sendTextMessage(sMsg,-1); + } + //clear chat variables chatText.clear(); chatSender.clear(); diff --git a/source/glest_game/network/server_interface.cpp b/source/glest_game/network/server_interface.cpp index 7409aba4..bf0b71aa 100644 --- a/source/glest_game/network/server_interface.cpp +++ b/source/glest_game/network/server_interface.cpp @@ -424,6 +424,16 @@ void ServerInterface::updateKeyframe(int frameCount){ } } + // Possible cause of out of synch since we have more commands that need + // to be sent in this frame + if(!requestedCommands.empty()) { + char szBuf[1024]=""; + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING / ERROR, requestedCommands.size() = %d\n",__FILE__,__FUNCTION__,requestedCommands.size()); + + string sMsg = Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + " may go out of synch: server requestedCommands.size() = " + intToStr(requestedCommands.size()); + sendTextMessage(sMsg,-1); + } + if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] build command list took %d msecs, networkMessageCommandList.getCommandCount() = %d, frameCount = %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis(),networkMessageCommandList.getCommandCount(),frameCount); //broadcast commands diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index 937483ca..79600575 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -1753,7 +1753,9 @@ void BroadCastSocketThread::execute() { float Socket::getAveragePingMS(std::string host, int pingCount) { double result = -1; + return result; +/* const bool debugPingOutput = false; char szCmd[1024]=""; #ifdef WIN32 @@ -1852,6 +1854,7 @@ float Socket::getAveragePingMS(std::string host, int pingCount) { } } return result; +*/ } std::string Socket::getIpAddress() {