- 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
+16 -2
View File
@@ -58,7 +58,7 @@ namespace Barotrauma
private Vector2 prevPosition;
private float lastNetworkUpdate;
private float lastNetworkUpdate, networkUpdateTimer;
//properties ----------------------------------------------------
@@ -425,7 +425,21 @@ namespace Barotrauma
{
if (Level.Loaded == null) return;
if (subBody!=null) subBody.Update(deltaTime);
if (subBody == null) return;
subBody.Update(deltaTime);
if (this != MainSub && MainSub.DockedTo.Contains(this)) return;
//send updates more frequently if moving fast
networkUpdateTimer -= MathHelper.Clamp(Velocity.Length(), 0.1f, 5.0f) * deltaTime;
if (networkUpdateTimer < 0.0f)
{
new Networking.NetworkEvent(ID, false);
networkUpdateTimer = 1.0f;
}
}
public void ApplyForce(Vector2 force)