From 77ab7ce084d32c45273d79e9ec4f52c43e3a1d97 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Mon, 25 Apr 2011 15:11:29 -0700
Subject: Fixed the transmission of throttles from root agent to child agents.
Child throttles are based on the number of child agents known to the root and
at least 1/4 of the throttle given to the root.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 33 +++++++++++-------------
1 file changed, 15 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 00a1487..ef0eb89 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2632,18 +2632,17 @@ namespace OpenSim.Region.Framework.Scenes
cadu.GroupAccess = 0;
cadu.Position = AbsolutePosition;
cadu.regionHandle = m_rootRegionHandle;
+
+ // Throttles
float multiplier = 1;
- int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
- if (innacurateNeighbors != 0)
- {
- multiplier = 1f / (float)innacurateNeighbors;
- }
- if (multiplier <= 0f)
- {
+ int childRegions = m_knownChildRegions.Count;
+ if (childRegions != 0)
+ multiplier = 1f / childRegions;
+
+ // Minimum throttle for a child region is 1/4 of the root region throttle
+ if (multiplier <= 0.25f)
multiplier = 0.25f;
- }
- //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
cadu.Velocity = Velocity;
@@ -3039,16 +3038,14 @@ namespace OpenSim.Region.Framework.Scenes
// Throttles
float multiplier = 1;
- int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
- if (innacurateNeighbors != 0)
- {
- multiplier = 1f / innacurateNeighbors;
- }
- if (multiplier <= 0f)
- {
+ int childRegions = m_knownChildRegions.Count;
+ if (childRegions != 0)
+ multiplier = 1f / childRegions;
+
+ // Minimum throttle for a child region is 1/4 of the root region throttle
+ if (multiplier <= 0.25f)
multiplier = 0.25f;
- }
- //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
+
cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier);
cAgent.HeadRotation = m_headrotation;
--
cgit v1.1
From 16f6f55f2d203f9ef40fba85860bb9dbd416bd0f Mon Sep 17 00:00:00 2001
From: dahlia
Date: Tue, 26 Apr 2011 16:22:44 -0700
Subject: network traffic reduction - decrease update frequency for moving
avatars when velocity is unchanged
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 34 +++++++++++++++++-------
1 file changed, 24 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index ef0eb89..e4413a9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2340,12 +2340,14 @@ 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)
{
+
// If the client is inactive, it's getting its updates from another
// server.
if (remoteClient.IsActive)
@@ -2358,8 +2360,8 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity);
remoteClient.SendPrimUpdate(
- this,
- PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
+ this,
+ PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
| PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
@@ -2367,16 +2369,31 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+
+ // vars to support reduced update frequency when velocity is unchanged
+ private Vector3 lastVelocitySentToAllClients = Vector3.Zero;
+ private int lastTerseUpdateToAllClientsTick = Util.EnvironmentTickCount();
+
///
/// Send a location/velocity/accelleration update to all agents in scene
///
public void SendTerseUpdateToAllClients()
{
- m_perfMonMS = Util.EnvironmentTickCount();
-
- m_scene.ForEachClient(SendTerseUpdateToClient);
+ int currentTick = Util.EnvironmentTickCount();
- m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
+ // decrease update frequency when avatar is moving but velocity is not changing
+ if (m_velocity.Length() < 0.01f
+ || Vector3.Distance(lastVelocitySentToAllClients, m_velocity) > 0.01f
+ || currentTick - lastTerseUpdateToAllClientsTick > 1500)
+ {
+ m_perfMonMS = currentTick;
+ lastVelocitySentToAllClients = m_velocity;
+ lastTerseUpdateToAllClientsTick = currentTick;
+
+ m_scene.ForEachClient(SendTerseUpdateToClient);
+
+ m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
+ }
}
public void SendCoarseLocations(List coarseLocations, List avatarUUIDs)
@@ -3268,10 +3285,7 @@ namespace OpenSim.Region.Framework.Scenes
m_updateflag = true;
- // The magic constant 0.95f seems to make walking feel less jerky,
- // probably because it hackishly accounts for the overall latency of
- // these Velocity updates -- Diva
- Velocity = force * .95F;
+ Velocity = force;
m_forceToApply = null;
}
--
cgit v1.1
From 9892e115ccdcc8567087041917fb5c7694aa8836 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 28 Apr 2011 20:19:54 -0700
Subject: Fatpack message on agent transfers: 1 message only (UpdateAgent)
containing the agent and all attachments. Preserves backwards compatibility
-- older sims get passed attachments one by one. Meaning that I finally
introduced versioning in the simulation service.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 124 +++++------------------
1 file changed, 27 insertions(+), 97 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e4413a9..507fc50 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3078,54 +3078,6 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.Appearance = new AvatarAppearance(m_appearance);
-/*
- try
- {
- // We might not pass the Wearables in all cases...
- // They're only needed so that persistent changes to the appearance
- // are preserved in the new region where the user is moving to.
- // But in Hypergrid we might not let this happen.
- int i = 0;
- UUID[] wears = new UUID[m_appearance.Wearables.Length * 2];
- foreach (AvatarWearable aw in m_appearance.Wearables)
- {
- if (aw != null)
- {
- wears[i++] = aw.ItemID;
- wears[i++] = aw.AssetID;
- }
- else
- {
- wears[i++] = UUID.Zero;
- wears[i++] = UUID.Zero;
- }
- }
- cAgent.Wearables = wears;
-
- cAgent.VisualParams = m_appearance.VisualParams;
-
- if (m_appearance.Texture != null)
- cAgent.AgentTextures = m_appearance.Texture.GetBytes();
- }
- catch (Exception e)
- {
- m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
- }
-
- //Attachments
- List attPoints = m_appearance.GetAttachedPoints();
- if (attPoints != null)
- {
- //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
- int i = 0;
- AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count];
- foreach (int point in attPoints)
- {
- attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
- }
- cAgent.Attachments = attachs;
- }
-*/
lock (scriptedcontrols)
{
ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
@@ -3145,9 +3097,21 @@ namespace OpenSim.Region.Framework.Scenes
}
catch { }
- // cAgent.GroupID = ??
- // Groups???
-
+ // Attachment objects
+ if (m_attachments != null && m_attachments.Count > 0)
+ {
+ cAgent.AttachmentObjects = new List();
+ cAgent.AttachmentObjectStates = new List();
+ IScriptModule se = m_scene.RequestModuleInterface();
+ foreach (SceneObjectGroup sog in m_attachments)
+ {
+ // We need to make a copy and pass that copy
+ // because of transfers withn the same sim
+ ISceneObject clone = sog.CloneForNewScene();
+ cAgent.AttachmentObjects.Add(clone);
+ cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot());
+ }
+ }
}
public void CopyFrom(AgentData cAgent)
@@ -3188,50 +3152,6 @@ namespace OpenSim.Region.Framework.Scenes
AddToPhysicalScene(isFlying);
}
-/*
- uint i = 0;
- try
- {
- if (cAgent.Wearables == null)
- cAgent.Wearables = new UUID[0];
- AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2];
- for (uint n = 0; n < cAgent.Wearables.Length; n += 2)
- {
- UUID itemId = cAgent.Wearables[n];
- UUID assetId = cAgent.Wearables[n + 1];
- wears[i++] = new AvatarWearable(itemId, assetId);
- }
- // m_appearance.Wearables = wears;
- Primitive.TextureEntry textures = null;
- if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
- textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
-
- byte[] visuals = null;
-
- if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
- visuals = (byte[])cAgent.VisualParams.Clone();
-
- m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
- }
- catch (Exception e)
- {
- m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
- }
-
- // Attachments
- try
- {
- if (cAgent.Attachments != null)
- {
- m_appearance.ClearAttachments();
- foreach (AvatarAttachment att in cAgent.Attachments)
- {
- m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
- }
- }
- }
- catch { }
-*/
try
{
lock (scriptedcontrols)
@@ -3261,8 +3181,18 @@ namespace OpenSim.Region.Framework.Scenes
}
catch { }
- //cAgent.GroupID = ??
- //Groups???
+ if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
+ {
+ m_attachments = new List();
+ int i = 0;
+ foreach (ISceneObject so in cAgent.AttachmentObjects)
+ {
+ ((SceneObjectGroup)so).LocalId = 0;
+ ((SceneObjectGroup)so).RootPart.UpdateFlag = 0;
+ so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
+ m_scene.IncomingCreateObject(so);
+ }
+ }
}
public bool CopyAgent(out IAgentData agent)
--
cgit v1.1
From 73caa4e94abc920269c2eba8423be49192ef184b Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 29 Apr 2011 08:42:51 -0700
Subject: Minor correction to yesterday's changes. Make normal prim crossing
(no attach) work well again.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 +++
1 file changed, 3 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 507fc50..fe4a7d1 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3108,6 +3108,9 @@ namespace OpenSim.Region.Framework.Scenes
// We need to make a copy and pass that copy
// because of transfers withn the same sim
ISceneObject clone = sog.CloneForNewScene();
+ // Attachment module assumes that GroupPosition holds the offsets...!
+ ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
+ ((SceneObjectGroup)clone).RootPart.IsAttachment = false;
cAgent.AttachmentObjects.Add(clone);
cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot());
}
--
cgit v1.1
From 0d49611f6db017da16b6099c440b6c1e2b2218b9 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 29 Apr 2011 15:52:06 -0700
Subject: Remove the scripts of the attachments in the departing region and
recreate them if fail.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 ++
1 file changed, 2 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index fe4a7d1..9b9d9da 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3113,6 +3113,8 @@ namespace OpenSim.Region.Framework.Scenes
((SceneObjectGroup)clone).RootPart.IsAttachment = false;
cAgent.AttachmentObjects.Add(clone);
cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot());
+ // Let's remove the scripts of the original object here
+ sog.RemoveScriptInstances(true);
}
}
}
--
cgit v1.1
From 4d5d6222f7edd7cd9c659571f280076c863a0fb1 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 29 Apr 2011 17:09:48 -0700
Subject: Delaying starting the scripts on TPs and crossings until the agent is
root.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 41 ++++++++++++++++++------
1 file changed, 32 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9b9d9da..1aac09d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -840,6 +840,9 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
+ bool wasChild = m_isChildAgent;
+ m_isChildAgent = false;
+
IGroupsModule gm = m_scene.RequestModuleInterface();
if (gm != null)
m_grouptitle = gm.GetGroupTitle(m_uuid);
@@ -929,14 +932,21 @@ namespace OpenSim.Region.Framework.Scenes
// Animator.SendAnimPack();
m_scene.SwapRootAgentCount(false);
-
- //CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
- //if (userInfo != null)
- // userInfo.FetchInventory();
- //else
- // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
-
- m_isChildAgent = false;
+
+ // The initial login scene presence is already root when it gets here
+ // and it has already rezzed the attachments and started their scripts.
+ // We do the following only for non-login agents, because their scripts
+ // haven't started yet.
+ if (wasChild)
+ {
+ m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments...");
+ // Resume scripts
+ Attachments.ForEach(delegate(SceneObjectGroup sog)
+ {
+ sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
+ sog.ResumeScripts();
+ });
+ }
// send the animations of the other presences to me
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
@@ -948,6 +958,20 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.EventManager.TriggerOnMakeRootAgent(this);
}
+ public int GetStateSource()
+ {
+ AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID);
+
+ if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
+ {
+ // This will get your attention
+ //m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
+
+ return 5; // StateSource.Teleporting
+ }
+ return 2; // StateSource.PrimCrossing
+ }
+
///
/// This turns a root agent into a child agent
/// when an agent departs this region for a neighbor, this gets called.
@@ -1139,7 +1163,6 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = pos;
}
- m_isChildAgent = false;
bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
MakeRootAgent(AbsolutePosition, m_flying);
--
cgit v1.1
From 00e94b0ba8e22b1bfdcbebc7c3d5c879d22b52a4 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 30 Apr 2011 16:53:11 -0700
Subject: Check for RegionID instead of RegionHandle. Other minor tweaks
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1aac09d..5b86735 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -937,7 +937,7 @@ namespace OpenSim.Region.Framework.Scenes
// and it has already rezzed the attachments and started their scripts.
// We do the following only for non-login agents, because their scripts
// haven't started yet.
- if (wasChild)
+ if (wasChild && Attachments != null && Attachments.Count > 0)
{
m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments...");
// Resume scripts
--
cgit v1.1