diff options
author | Teravus Ovares | 2008-02-07 08:15:38 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-07 08:15:38 +0000 |
commit | 3674257095f0c511b1f5810fdc034c2d49bb73a8 (patch) | |
tree | a9b4cda92de5ef51d7626b526aa19cd5a563089d | |
parent | * didn't save :P so, this is the other half to my last commit (diff) | |
download | opensim-SC-3674257095f0c511b1f5810fdc034c2d49bb73a8.zip opensim-SC-3674257095f0c511b1f5810fdc034c2d49bb73a8.tar.gz opensim-SC-3674257095f0c511b1f5810fdc034c2d49bb73a8.tar.bz2 opensim-SC-3674257095f0c511b1f5810fdc034c2d49bb73a8.tar.xz |
* This update contains a bucket-full of network optimizations.
* ParcelProperties are sent only when needed instead of on any movement
* Terse Updates and other temporary data packets are marked unreliable
* After a certain amount of users, the sim actually sends updates on things less
* Experimental
* Tested to 68 avatar with pCampBot (And it's surprising what actually causes the most lag.. the text chat!)
-rw-r--r-- | OpenSim/Framework/ClientManager.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Environment/LandManagement/LandManager.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 7 |
6 files changed, 53 insertions, 7 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs index 62ff203..6843dce 100644 --- a/OpenSim/Framework/ClientManager.cs +++ b/OpenSim/Framework/ClientManager.cs | |||
@@ -164,6 +164,7 @@ namespace OpenSim.Framework | |||
164 | { | 164 | { |
165 | packet.AgentData.AgentID = LocalClients[i].AgentId; | 165 | packet.AgentData.AgentID = LocalClients[i].AgentId; |
166 | packet.AgentData.SessionID = LocalClients[i].SessionId; | 166 | packet.AgentData.SessionID = LocalClients[i].SessionId; |
167 | packet.Header.Reliable = false; | ||
167 | LocalClients[i].OutPacket(packet, ThrottleOutPacketType.Task); | 168 | LocalClients[i].OutPacket(packet, ThrottleOutPacketType.Task); |
168 | } | 169 | } |
169 | 170 | ||
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index aeac1b2..363688f 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -957,6 +957,7 @@ namespace OpenSim.Region.ClientStack | |||
957 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | 957 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; |
958 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | 958 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); |
959 | kill.ObjectData[0].ID = localID; | 959 | kill.ObjectData[0].ID = localID; |
960 | kill.Header.Reliable = false; | ||
960 | OutPacket(kill, ThrottleOutPacketType.Task); | 961 | OutPacket(kill, ThrottleOutPacketType.Task); |
961 | } | 962 | } |
962 | 963 | ||
@@ -1378,6 +1379,7 @@ namespace OpenSim.Region.ClientStack | |||
1378 | viewertime.TimeInfo.SunDirection = sunPos; | 1379 | viewertime.TimeInfo.SunDirection = sunPos; |
1379 | viewertime.TimeInfo.SunAngVelocity = sunVel; | 1380 | viewertime.TimeInfo.SunAngVelocity = sunVel; |
1380 | viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch(); | 1381 | viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch(); |
1382 | viewertime.Header.Reliable = false; | ||
1381 | OutPacket(viewertime, ThrottleOutPacketType.Task); | 1383 | OutPacket(viewertime, ThrottleOutPacketType.Task); |
1382 | } | 1384 | } |
1383 | 1385 | ||
@@ -1426,6 +1428,7 @@ namespace OpenSim.Region.ClientStack | |||
1426 | } | 1428 | } |
1427 | viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f); | 1429 | viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f); |
1428 | viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch(); | 1430 | viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch(); |
1431 | viewertime.Header.Reliable = false; | ||
1429 | OutPacket(viewertime, ThrottleOutPacketType.Task); | 1432 | OutPacket(viewertime, ThrottleOutPacketType.Task); |
1430 | } | 1433 | } |
1431 | 1434 | ||
@@ -1521,7 +1524,7 @@ namespace OpenSim.Region.ClientStack | |||
1521 | ani.AnimationList[i].AnimID = animations[i]; | 1524 | ani.AnimationList[i].AnimID = animations[i]; |
1522 | ani.AnimationList[i].AnimSequenceID = seqs[i]; | 1525 | ani.AnimationList[i].AnimSequenceID = seqs[i]; |
1523 | } | 1526 | } |
1524 | 1527 | ani.Header.Reliable = false; | |
1525 | OutPacket(ani, ThrottleOutPacketType.Task); | 1528 | OutPacket(ani, ThrottleOutPacketType.Task); |
1526 | } | 1529 | } |
1527 | 1530 | ||
@@ -1580,6 +1583,9 @@ namespace OpenSim.Region.ClientStack | |||
1580 | terse.RegionData.TimeDilation = timeDilation; | 1583 | terse.RegionData.TimeDilation = timeDilation; |
1581 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 1584 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
1582 | terse.ObjectData[0] = terseBlock; | 1585 | terse.ObjectData[0] = terseBlock; |
1586 | |||
1587 | terse.Header.Reliable = false; | ||
1588 | |||
1583 | 1589 | ||
1584 | OutPacket(terse, ThrottleOutPacketType.Task); | 1590 | OutPacket(terse, ThrottleOutPacketType.Task); |
1585 | } | 1591 | } |
@@ -1604,6 +1610,7 @@ namespace OpenSim.Region.ClientStack | |||
1604 | ib.You = -1; | 1610 | ib.You = -1; |
1605 | ib.Prey = -1; | 1611 | ib.Prey = -1; |
1606 | loc.Index = ib; | 1612 | loc.Index = ib; |
1613 | loc.Header.Reliable = false; | ||
1607 | OutPacket(loc, ThrottleOutPacketType.Task); | 1614 | OutPacket(loc, ThrottleOutPacketType.Task); |
1608 | } | 1615 | } |
1609 | 1616 | ||
@@ -1706,7 +1713,7 @@ namespace OpenSim.Region.ClientStack | |||
1706 | terse.RegionData.TimeDilation = timeDilation; | 1713 | terse.RegionData.TimeDilation = timeDilation; |
1707 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 1714 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
1708 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity); | 1715 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity); |
1709 | 1716 | terse.Header.Reliable = false; | |
1710 | OutPacket(terse, ThrottleOutPacketType.Task); | 1717 | OutPacket(terse, ThrottleOutPacketType.Task); |
1711 | } | 1718 | } |
1712 | 1719 | ||
@@ -1719,7 +1726,7 @@ namespace OpenSim.Region.ClientStack | |||
1719 | terse.RegionData.TimeDilation = timeDilation; | 1726 | terse.RegionData.TimeDilation = timeDilation; |
1720 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 1727 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
1721 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity); | 1728 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity); |
1722 | 1729 | terse.Header.Reliable = false; | |
1723 | OutPacket(terse, ThrottleOutPacketType.Task); | 1730 | OutPacket(terse, ThrottleOutPacketType.Task); |
1724 | } | 1731 | } |
1725 | 1732 | ||
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index 09fa09b..dd13fc0 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs | |||
@@ -718,23 +718,32 @@ namespace OpenSim.Region.Environment.LandManagement | |||
718 | } | 718 | } |
719 | } | 719 | } |
720 | 720 | ||
721 | public void sendLandUpdate(ScenePresence avatar) | 721 | public void sendLandUpdate(ScenePresence avatar, bool force) |
722 | { | 722 | { |
723 | Land over = getLandObject((int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), | 723 | Land over = getLandObject((int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), |
724 | (int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); | 724 | (int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); |
725 | 725 | ||
726 | if (over != null) | 726 | if (over != null) |
727 | { | 727 | { |
728 | over.sendLandUpdateToClient(avatar.ControllingClient); | 728 | if (force) |
729 | { | ||
730 | over.sendLandUpdateToClient(avatar.ControllingClient); | ||
731 | } | ||
732 | |||
729 | if (avatar.currentParcelUUID != over.landData.globalID) | 733 | if (avatar.currentParcelUUID != over.landData.globalID) |
730 | { | 734 | { |
735 | over.sendLandUpdateToClient(avatar.ControllingClient); | ||
731 | avatar.currentParcelUUID = over.landData.globalID; | 736 | avatar.currentParcelUUID = over.landData.globalID; |
732 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID, | 737 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID, |
733 | m_scene.RegionInfo.RegionID); | 738 | m_scene.RegionInfo.RegionID); |
734 | } | 739 | } |
735 | } | 740 | } |
736 | } | 741 | } |
742 | public void sendLandUpdate(ScenePresence avatar) | ||
743 | { | ||
744 | sendLandUpdate(avatar, false); | ||
737 | 745 | ||
746 | } | ||
738 | public void handleSignificantClientMovement(IClientAPI remote_client) | 747 | public void handleSignificantClientMovement(IClientAPI remote_client) |
739 | { | 748 | { |
740 | ScenePresence clientAvatar = m_scene.GetScenePresence(remote_client.AgentId); | 749 | ScenePresence clientAvatar = m_scene.GetScenePresence(remote_client.AgentId); |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 6b891fd..a62e6c6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -626,7 +626,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
626 | // Aquire a lock so only one update call happens at once | 626 | // Aquire a lock so only one update call happens at once |
627 | updateLock.WaitOne(); | 627 | updateLock.WaitOne(); |
628 | float physicsFPS = 0; | 628 | float physicsFPS = 0; |
629 | 629 | int agentsInScene = m_innerScene.GetRootAgentCount() + m_innerScene.GetChildAgentCount(); | |
630 | |||
631 | if (agentsInScene > 21) | ||
632 | { | ||
633 | if (m_update_entities == 1) | ||
634 | { | ||
635 | m_update_avatars = 5; | ||
636 | m_update_entities = 5; | ||
637 | m_statsReporter.SetUpdateMS(6000); | ||
638 | } | ||
639 | } | ||
640 | else | ||
641 | { | ||
642 | if (m_update_entities == 5) | ||
643 | { | ||
644 | m_update_avatars = 1; | ||
645 | m_update_entities = 1; | ||
646 | m_statsReporter.SetUpdateMS(3000); | ||
647 | } | ||
648 | } | ||
649 | |||
650 | |||
630 | frameMS = System.Environment.TickCount; | 651 | frameMS = System.Environment.TickCount; |
631 | try | 652 | try |
632 | { | 653 | { |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 4062ef6..374586c 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -77,6 +77,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
77 | private bool m_newForce = false; | 77 | private bool m_newForce = false; |
78 | private bool m_newCoarseLocations = true; | 78 | private bool m_newCoarseLocations = true; |
79 | private bool m_gotAllObjectsInScene = false; | 79 | private bool m_gotAllObjectsInScene = false; |
80 | |||
80 | 81 | ||
81 | // Default AV Height | 82 | // Default AV Height |
82 | private float m_avHeight = 127.0f; | 83 | private float m_avHeight = 127.0f; |
@@ -354,7 +355,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
354 | RegisterToEvents(); | 355 | RegisterToEvents(); |
355 | SetDirectionVectors(); | 356 | SetDirectionVectors(); |
356 | 357 | ||
357 | m_scene.LandManager.sendLandUpdate(this); | 358 | m_scene.LandManager.sendLandUpdate(this, true); |
358 | } | 359 | } |
359 | 360 | ||
360 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, | 361 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, |
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index f2cefb5..3e1fec2 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | |||
@@ -124,6 +124,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
124 | m_report.Enabled = true; | 124 | m_report.Enabled = true; |
125 | } | 125 | } |
126 | 126 | ||
127 | public void SetUpdateMS(int ms) | ||
128 | { | ||
129 | statsUpdatesEveryMS = ms; | ||
130 | statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000); | ||
131 | m_report.Interval = statsUpdatesEveryMS; | ||
132 | } | ||
133 | |||
127 | private void statsHeartBeat(object sender, EventArgs e) | 134 | private void statsHeartBeat(object sender, EventArgs e) |
128 | { | 135 | { |
129 | m_report.Enabled = false; | 136 | m_report.Enabled = false; |