Forráskód Böngészése

Decreased bandwidth adjustment aggressiveness.
Added connection stats logging to TestScene server.

Lasse Öörni 14 éve
szülő
commit
d807ec230a

+ 1 - 0
Bin/Data/Scripts/TestScene.as

@@ -462,4 +462,5 @@ void HandleClientConnected(StringHash eventType, VariantMap& eventData)
 {
     Connection@ connection = eventData["Connection"].GetConnection();
     connection.scene = testScene; // Begin scene replication to the client
+    connection.logStatistics = true;
 }

+ 4 - 2
Engine/Network/Connection.cpp

@@ -273,8 +273,10 @@ void Connection::SendRemoteEvents()
     if (logStatistics_ && statsTimer_.GetMSec(false) > STATS_INTERVAL_MSEC)
     {
         statsTimer_.Reset();
-        LOGINFO("Data in " + String(connection_->BytesInPerSec() / 1000.0f) + " KB/s Data out " +
-            String(connection_->BytesOutPerSec() / 1000.0f) + "KB/s");
+        char statsBuffer[256];
+        sprintf(statsBuffer, "Packets in %d Packets out %d Data in %.3f KB/s Data out %.3f KB/s", (int)connection_->PacketsInPerSec(),
+            (int)connection_->PacketsOutPerSec(), connection_->BytesInPerSec() / 1000.0f, connection_->BytesOutPerSec() / 1000.0f);
+        LOGINFO(statsBuffer);
     }
     
     if (remoteEvents_.Empty())

+ 2 - 3
ThirdParty/kNet/src/UDPMessageConnection.cpp

@@ -267,8 +267,8 @@ void UDPMessageConnection::HandleFlowControl()
 
 	// In packets/second.
 	const float minBandwidth = 25.f;
-	const float maxBandwidth = 2000.f;
-	const float additiveIncreaseAggressiveness = 5.0f;
+	const float maxBandwidth = 5000.f;
+	const float additiveIncreaseAggressiveness = 2.5f;
 
 	const tick_t frameLength = Clock::TicksPerSec() / 100; // in ticks
 	// If no losses, additively increase or decrease the outbound send rate based on demand
@@ -300,7 +300,6 @@ void UDPMessageConnection::HandleFlowControl()
 			else if (utilization < 0.25f)
 				datagramSendRate = max(datagramSendRate - delta, minBandwidth);
 
-			//printf("Numframes %d Packets %f Util %f Sendrate %f\n", (int)numFrames, actualDatagramSendRate, utilization, datagramSendRate);
 			lowestDatagramSendRateOnPacketLoss = datagramSendRate;
 		}
 		numAcksLastFrame = 0;