* 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!)
ThreadPoolClientBranch
Teravus Ovares 2008-02-07 08:15:38 +00:00
parent 0e771c8d39
commit 3674257095
6 changed files with 53 additions and 7 deletions

View File

@ -164,6 +164,7 @@ namespace OpenSim.Framework
{ {
packet.AgentData.AgentID = LocalClients[i].AgentId; packet.AgentData.AgentID = LocalClients[i].AgentId;
packet.AgentData.SessionID = LocalClients[i].SessionId; packet.AgentData.SessionID = LocalClients[i].SessionId;
packet.Header.Reliable = false;
LocalClients[i].OutPacket(packet, ThrottleOutPacketType.Task); LocalClients[i].OutPacket(packet, ThrottleOutPacketType.Task);
} }

View File

@ -957,6 +957,7 @@ namespace OpenSim.Region.ClientStack
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
kill.ObjectData[0].ID = localID; kill.ObjectData[0].ID = localID;
kill.Header.Reliable = false;
OutPacket(kill, ThrottleOutPacketType.Task); OutPacket(kill, ThrottleOutPacketType.Task);
} }
@ -1378,6 +1379,7 @@ namespace OpenSim.Region.ClientStack
viewertime.TimeInfo.SunDirection = sunPos; viewertime.TimeInfo.SunDirection = sunPos;
viewertime.TimeInfo.SunAngVelocity = sunVel; viewertime.TimeInfo.SunAngVelocity = sunVel;
viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch(); viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch();
viewertime.Header.Reliable = false;
OutPacket(viewertime, ThrottleOutPacketType.Task); OutPacket(viewertime, ThrottleOutPacketType.Task);
} }
@ -1426,6 +1428,7 @@ namespace OpenSim.Region.ClientStack
} }
viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f); viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f);
viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch(); viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch();
viewertime.Header.Reliable = false;
OutPacket(viewertime, ThrottleOutPacketType.Task); OutPacket(viewertime, ThrottleOutPacketType.Task);
} }
@ -1521,7 +1524,7 @@ namespace OpenSim.Region.ClientStack
ani.AnimationList[i].AnimID = animations[i]; ani.AnimationList[i].AnimID = animations[i];
ani.AnimationList[i].AnimSequenceID = seqs[i]; ani.AnimationList[i].AnimSequenceID = seqs[i];
} }
ani.Header.Reliable = false;
OutPacket(ani, ThrottleOutPacketType.Task); OutPacket(ani, ThrottleOutPacketType.Task);
} }
@ -1581,6 +1584,9 @@ namespace OpenSim.Region.ClientStack
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = terseBlock; terse.ObjectData[0] = terseBlock;
terse.Header.Reliable = false;
OutPacket(terse, ThrottleOutPacketType.Task); OutPacket(terse, ThrottleOutPacketType.Task);
} }
@ -1604,6 +1610,7 @@ namespace OpenSim.Region.ClientStack
ib.You = -1; ib.You = -1;
ib.Prey = -1; ib.Prey = -1;
loc.Index = ib; loc.Index = ib;
loc.Header.Reliable = false;
OutPacket(loc, ThrottleOutPacketType.Task); OutPacket(loc, ThrottleOutPacketType.Task);
} }
@ -1706,7 +1713,7 @@ namespace OpenSim.Region.ClientStack
terse.RegionData.TimeDilation = timeDilation; terse.RegionData.TimeDilation = timeDilation;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity); terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity);
terse.Header.Reliable = false;
OutPacket(terse, ThrottleOutPacketType.Task); OutPacket(terse, ThrottleOutPacketType.Task);
} }
@ -1719,7 +1726,7 @@ namespace OpenSim.Region.ClientStack
terse.RegionData.TimeDilation = timeDilation; terse.RegionData.TimeDilation = timeDilation;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity); terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity);
terse.Header.Reliable = false;
OutPacket(terse, ThrottleOutPacketType.Task); OutPacket(terse, ThrottleOutPacketType.Task);
} }

View File

@ -718,23 +718,32 @@ namespace OpenSim.Region.Environment.LandManagement
} }
} }
public void sendLandUpdate(ScenePresence avatar) public void sendLandUpdate(ScenePresence avatar, bool force)
{ {
Land over = getLandObject((int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), Land over = getLandObject((int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
(int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); (int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
if (over != null) if (over != null)
{
if (force)
{ {
over.sendLandUpdateToClient(avatar.ControllingClient); over.sendLandUpdateToClient(avatar.ControllingClient);
}
if (avatar.currentParcelUUID != over.landData.globalID) if (avatar.currentParcelUUID != over.landData.globalID)
{ {
over.sendLandUpdateToClient(avatar.ControllingClient);
avatar.currentParcelUUID = over.landData.globalID; avatar.currentParcelUUID = over.landData.globalID;
m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID, m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID,
m_scene.RegionInfo.RegionID); m_scene.RegionInfo.RegionID);
} }
} }
} }
public void sendLandUpdate(ScenePresence avatar)
{
sendLandUpdate(avatar, false);
}
public void handleSignificantClientMovement(IClientAPI remote_client) public void handleSignificantClientMovement(IClientAPI remote_client)
{ {
ScenePresence clientAvatar = m_scene.GetScenePresence(remote_client.AgentId); ScenePresence clientAvatar = m_scene.GetScenePresence(remote_client.AgentId);

View File

@ -626,6 +626,27 @@ namespace OpenSim.Region.Environment.Scenes
// Aquire a lock so only one update call happens at once // Aquire a lock so only one update call happens at once
updateLock.WaitOne(); updateLock.WaitOne();
float physicsFPS = 0; float physicsFPS = 0;
int agentsInScene = m_innerScene.GetRootAgentCount() + m_innerScene.GetChildAgentCount();
if (agentsInScene > 21)
{
if (m_update_entities == 1)
{
m_update_avatars = 5;
m_update_entities = 5;
m_statsReporter.SetUpdateMS(6000);
}
}
else
{
if (m_update_entities == 5)
{
m_update_avatars = 1;
m_update_entities = 1;
m_statsReporter.SetUpdateMS(3000);
}
}
frameMS = System.Environment.TickCount; frameMS = System.Environment.TickCount;
try try

View File

@ -78,6 +78,7 @@ namespace OpenSim.Region.Environment.Scenes
private bool m_newCoarseLocations = true; private bool m_newCoarseLocations = true;
private bool m_gotAllObjectsInScene = false; private bool m_gotAllObjectsInScene = false;
// Default AV Height // Default AV Height
private float m_avHeight = 127.0f; private float m_avHeight = 127.0f;
@ -354,7 +355,7 @@ namespace OpenSim.Region.Environment.Scenes
RegisterToEvents(); RegisterToEvents();
SetDirectionVectors(); SetDirectionVectors();
m_scene.LandManager.sendLandUpdate(this); m_scene.LandManager.sendLandUpdate(this, true);
} }
public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams,

View File

@ -124,6 +124,13 @@ namespace OpenSim.Region.Environment.Scenes
m_report.Enabled = true; m_report.Enabled = true;
} }
public void SetUpdateMS(int ms)
{
statsUpdatesEveryMS = ms;
statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
m_report.Interval = statsUpdatesEveryMS;
}
private void statsHeartBeat(object sender, EventArgs e) private void statsHeartBeat(object sender, EventArgs e)
{ {
m_report.Enabled = false; m_report.Enabled = false;