diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 73daab8321..638187b1fa 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -168,6 +168,7 @@ namespace OpenSim.Region.Framework.Scenes private volatile bool shuttingdown = false; private int m_lastUpdate = Environment.TickCount; + private int m_maxPrimsPerFrame = 200; private object m_deleting_scene_object = new object(); @@ -229,6 +230,12 @@ namespace OpenSim.Region.Framework.Scenes get { return m_timedilation; } } + public int MaxPrimsPerFrame + { + get { return m_maxPrimsPerFrame; } + set { m_maxPrimsPerFrame = value; } + } + /// /// This is for llGetRegionFPS /// @@ -372,6 +379,8 @@ namespace OpenSim.Region.Framework.Scenes m_persistAfter *= 10000000; m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); + + m_maxPrimsPerFrame = startupConfig.GetInt("MaxPrimsPerFrame", 200); } catch { diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 4b4461f6e7..7f23b7ab3d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -617,6 +617,7 @@ namespace OpenSim.Region.Framework.Scenes newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); newAvatar.IsChildAgent = true; + newAvatar.MaxPrimsPerFrame = m_parentScene.MaxPrimsPerFrame; AddScenePresence(newAvatar); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 50cebfb8a1..7e1063d61c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -141,6 +141,8 @@ namespace OpenSim.Region.Framework.Scenes private Vector3 m_lastVelocity = Vector3.Zero; + private int m_maxPrimsPerFrame = 200; + // Default AV Height private float m_avHeight = 127.0f; @@ -392,6 +394,12 @@ namespace OpenSim.Region.Framework.Scenes set { m_parentPosition = value; } } + public int MaxPrimsPerFrame + { + get { return m_maxPrimsPerFrame; } + set { m_maxPrimsPerFrame = value; } + } + /// /// Absolute position of this avatar in 'region cordinates' /// @@ -747,7 +755,7 @@ namespace OpenSim.Region.Framework.Scenes } } - while (m_pendingObjects != null && m_pendingObjects.Count > 0 && m_partsUpdateQueue.Count < 60) + while (m_pendingObjects != null && m_pendingObjects.Count > 0 && m_partsUpdateQueue.Count < m_maxPrimsPerFrame) { SceneObjectGroup g = m_pendingObjects.Dequeue(); @@ -763,8 +771,6 @@ namespace OpenSim.Region.Framework.Scenes g.ScheduleFullUpdateToAvatar(this); } - int updateCount = 0; - while (m_partsUpdateQueue.Count > 0) { SceneObjectPart part = m_partsUpdateQueue.Dequeue(); @@ -798,7 +804,6 @@ namespace OpenSim.Region.Framework.Scenes update.LastFullUpdateTime = part.TimeStampFull; - updateCount++; } else if (update.LastTerseUpdateTime <= part.TimeStampTerse) { @@ -809,7 +814,6 @@ namespace OpenSim.Region.Framework.Scenes part.SendTerseUpdateToClient(ControllingClient); update.LastTerseUpdateTime = part.TimeStampTerse; - updateCount++; } } else @@ -833,11 +837,7 @@ namespace OpenSim.Region.Framework.Scenes part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID)); - updateCount++; } - - if (updateCount > 200) - break; } m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 506265d37b..7f7bcf498f 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -78,6 +78,9 @@ ; YOU HAVE BEEN WARNED!!! TrustBinaries = false + ; How many prims to send to each avatar in the scene on each Update() + ; MaxPrimsPerFrame = 200 + ; ## ; ## STORAGE ; ##