From 0f87a99e54d0665824d055ce1dcf5f4240dec0bc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 29 Jul 2014 18:09:11 +0100 Subject: Add debug mechanism for only sending 1 in N AgentUpdate packets to child agents. Allows experiments in manually reducing updates under heavy load. Activated by "debug scene set client-upd-per" console command. In a simple test, can send as few as every 4th update before observed movement starts becoming disturbingly rubber-banded. --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 482e803..ab1d22c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -247,6 +247,11 @@ namespace OpenSim.Region.Framework.Scenes /// public float ClientVelocityUpdateTolerance { get; set; } + /// + /// If greater than 1, we only send terse updates to child agents on every n updates. + /// + public int ChildTerseUpdatePeriod { get; set; } + protected float m_defaultDrawDistance = 255.0f; public float DefaultDrawDistance { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 18a0491..73a5c25 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -859,6 +859,11 @@ namespace OpenSim.Region.Framework.Scenes get { return Util.GetViewerName(m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode)); } } + /// + /// Count of how many terse updates we have sent out. It doesn't matter if this overflows. + /// + private int m_terseUpdateCount; + #endregion #region Constructor(s) @@ -3222,17 +3227,24 @@ namespace OpenSim.Region.Framework.Scenes #region Update Client(s) - /// /// Sends a location update to the client connected to this scenePresence /// /// public void SendTerseUpdateToClient(IClientAPI remoteClient) { + m_terseUpdateCount++; + // If the client is inactive, it's getting its updates from another // server. if (remoteClient.IsActive) { + if (Scene.ChildTerseUpdatePeriod > 1 + && remoteClient.SceneAgent.IsChildAgent + && m_terseUpdateCount % Scene.ChildTerseUpdatePeriod != 0 + && !Velocity.ApproxEquals(Vector3.Zero, 0.001f)) + return; + //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); remoteClient.SendEntityUpdate( -- cgit v1.1