- submarines send position updates more frequently when they're moving faster

- small AICharacter syncing optimizations
- respawning can be disabled in server setting
- netstats show the total amount of bytes sent for each networkevent type
This commit is contained in:
Regalis
2016-07-20 17:20:27 +03:00
parent b81417ad16
commit 911846acff
8 changed files with 127 additions and 63 deletions

View File

@@ -55,6 +55,10 @@ namespace Barotrauma.Networking
abstract class NetworkMember
{
#if DEBUG
public Dictionary<string, long> messageCount = new Dictionary<string, long>();
#endif
protected NetPeer netPeer;
protected string name;
@@ -163,6 +167,24 @@ namespace Barotrauma.Networking
tempMessage.Position = 0;
msgBytes.Add(tempMessage.ReadBytes(tempMessage.LengthBytes));
#if DEBUG
string msgType = networkEvent.Type.ToString();
if (networkEvent.Type == NetworkEventType.EntityUpdate)
{
msgType += " (" + Entity.FindEntityByID(networkEvent.ID) + ")";
}
long sentBytes = 0;
if (!messageCount.TryGetValue(msgType, out sentBytes))
{
messageCount.Add(msgType, tempMessage.LengthBytes);
}
else
{
messageCount[msgType] += tempMessage.LengthBytes;
}
#endif
}
if (msgBytes.Count == 0) return null;
@@ -181,6 +203,7 @@ namespace Barotrauma.Networking
message.Write(msgData);
}
return message;
}