[Orxonox-commit 514] r3066 - branches/netp3/src/network

scheusso at orxonox.net scheusso at orxonox.net
Mon May 25 18:05:11 CEST 2009


Author: scheusso
Date: 2009-05-25 18:05:11 +0200 (Mon, 25 May 2009)
New Revision: 3066

Modified:
   branches/netp3/src/network/Client.cc
   branches/netp3/src/network/Host.h
   branches/netp3/src/network/Server.cc
Log:
trying to reduce network delays/lags


Modified: branches/netp3/src/network/Client.cc
===================================================================
--- branches/netp3/src/network/Client.cc	2009-05-25 16:03:56 UTC (rev 3065)
+++ branches/netp3/src/network/Client.cc	2009-05-25 16:05:11 UTC (rev 3066)
@@ -157,23 +157,24 @@
         }
         FunctionCallManager::sendCalls();
       }
-      ENetEvent *event;
+    }
+    
+    ENetEvent *event;
     // stop if the packet queue is empty
-      while(!(client_connection.queueEmpty())){
-        event = client_connection.getEvent();
-        COUT(5) << "tick packet size " << event->packet->dataLength << std::endl;
-        packet::Packet *packet = packet::Packet::createPacket(event->packet, event->peer);
+    while(!(client_connection.queueEmpty())){
+      event = client_connection.getEvent();
+      COUT(5) << "tick packet size " << event->packet->dataLength << std::endl;
+      packet::Packet *packet = packet::Packet::createPacket(event->packet, event->peer);
       // note: packet commits suicide here except for the GameState. That is then deleted by a GamestateHandler
-        bool b = packet->process();
-        assert(b);
-      }
-      if(gamestate.processGamestates())
-      {
-        if(!isSynched_)
-          isSynched_=true;
-      }
-      gamestate.cleanup();
+      bool b = packet->process();
+      assert(b);
     }
+    if(gamestate.processGamestates())
+    {
+      if(!isSynched_)
+        isSynched_=true;
+    }
+    gamestate.cleanup();
 
     return;
   }

Modified: branches/netp3/src/network/Host.h
===================================================================
--- branches/netp3/src/network/Host.h	2009-05-25 16:03:56 UTC (rev 3065)
+++ branches/netp3/src/network/Host.h	2009-05-25 16:05:11 UTC (rev 3066)
@@ -36,7 +36,7 @@
 namespace orxonox {
 
   const int CLIENTID_SERVER = 0;
-  const unsigned int NETWORK_FREQUENCY = 25;
+  const unsigned int NETWORK_FREQUENCY = 30;
   const float NETWORK_PERIOD = 1.0f/NETWORK_FREQUENCY;
 
 /**

Modified: branches/netp3/src/network/Server.cc
===================================================================
--- branches/netp3/src/network/Server.cc	2009-05-25 16:03:56 UTC (rev 3065)
+++ branches/netp3/src/network/Server.cc	2009-05-25 16:05:11 UTC (rev 3066)
@@ -154,11 +154,11 @@
   */
   void Server::update(const Clock& time) {
     processQueue();
+    gamestates_->processGamestates();
     //this steers our network frequency
     timeSinceLastUpdate_+=time.getDeltaTime();
     if(timeSinceLastUpdate_>=NETWORK_PERIOD){
       timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD;
-      gamestates_->processGamestates();
       updateGamestate();
       FunctionCallManager::sendCalls();
     }




More information about the Orxonox-commit mailing list