aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorDan Lake2010-06-08 16:30:51 -0700
committerJohn Hurliman2010-06-08 16:44:18 -0700
commitca2abc43ad440a99f17b43d32de89e77fdeef00e (patch)
treeac8787b8db9c38d4875cc4123245006084e35609 /OpenSim/Region/Framework/Scenes/Scene.cs
parentMerge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-ca2abc43ad440a99f17b43d32de89e77fdeef00e.zip
opensim-SC_OLD-ca2abc43ad440a99f17b43d32de89e77fdeef00e.tar.gz
opensim-SC_OLD-ca2abc43ad440a99f17b43d32de89e77fdeef00e.tar.bz2
opensim-SC_OLD-ca2abc43ad440a99f17b43d32de89e77fdeef00e.tar.xz
Refactor SendCoarseLocations for better performance. Instead of computing list of all locations fresh for every scene presence on every frame, we will instead compute the list once every 50 frames and send to all connected presences at that time. Also, we only add 60 items to the list when there are more than 60 presences in the scene. For 1000 users, this change yields a 99.8% reduction in list processing and a 98% reduction in network bandwidth for coarse locations.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs24
1 files changed, 13 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4e90d09..9a3b0c9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -348,6 +348,7 @@ namespace OpenSim.Region.Framework.Scenes
348 private int m_update_backup = 200; 348 private int m_update_backup = 200;
349 private int m_update_terrain = 50; 349 private int m_update_terrain = 50;
350 private int m_update_land = 1; 350 private int m_update_land = 1;
351 private int m_update_coarse_locations = 50;
351 352
352 private int frameMS; 353 private int frameMS;
353 private int physicsMS2; 354 private int physicsMS2;
@@ -1417,6 +1418,18 @@ namespace OpenSim.Region.Framework.Scenes
1417 if (m_frame % m_update_presences == 0) 1418 if (m_frame % m_update_presences == 0)
1418 m_sceneGraph.UpdatePresences(); 1419 m_sceneGraph.UpdatePresences();
1419 1420
1421 if (m_frame % m_update_coarse_locations == 0)
1422 {
1423 List<Vector3> coarseLocations;
1424 List<UUID> avatarUUIDs;
1425 SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60);
1426 // Send coarse locations to clients
1427 ForEachScenePresence(delegate(ScenePresence presence)
1428 {
1429 presence.SendCoarseLocations(coarseLocations, avatarUUIDs);
1430 });
1431 }
1432
1420 int tmpPhysicsMS2 = Util.EnvironmentTickCount(); 1433 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1421 if ((m_frame % m_update_physics == 0) && m_physics_enabled) 1434 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
1422 m_sceneGraph.UpdatePreparePhysics(); 1435 m_sceneGraph.UpdatePreparePhysics();
@@ -3301,9 +3314,6 @@ namespace OpenSim.Region.Framework.Scenes
3301 catch (NullReferenceException) { } 3314 catch (NullReferenceException) { }
3302 }); 3315 });
3303 3316
3304 ForEachScenePresence(
3305 delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
3306
3307 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); 3317 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
3308 if (agentTransactions != null) 3318 if (agentTransactions != null)
3309 { 3319 {
@@ -3355,14 +3365,6 @@ namespace OpenSim.Region.Framework.Scenes
3355 } 3365 }
3356 } 3366 }
3357 3367
3358 /// <summary>
3359 /// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap.
3360 /// </summary>
3361 public void NotifyMyCoarseLocationChange()
3362 {
3363 ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
3364 }
3365
3366 #endregion 3368 #endregion
3367 3369
3368 #region Entities 3370 #region Entities