- 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:
@@ -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)
|
||||
|
||||
@@ -26,12 +26,12 @@ namespace Barotrauma
|
||||
|
||||
public TransitionCinematic(List<Submarine> submarines, Camera cam, float duration)
|
||||
{
|
||||
if (!submarines.Any(s => s != null)) return;
|
||||
|
||||
Vector2 targetPos = new Vector2(
|
||||
submarines.Sum(s => s.Position.X),
|
||||
submarines.Sum(s => s.Position.Y)) / submarines.Count;
|
||||
|
||||
if (!submarines.Any()) return;
|
||||
|
||||
if (submarines.First().AtEndPosition)
|
||||
{
|
||||
targetPos = Level.Loaded.EndPosition + Vector2.UnitY * 500.0f;
|
||||
|
||||
Reference in New Issue
Block a user