From b81c829576dd916c0a7bf141919f5e13f025d818 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 28 Oct 2009 14:13:17 -0700 Subject: * Standalone logins will now go through the sequence of "requested region, default region, any region" before giving up * Hip offset should have been added not subtracted (it's a negative offset). This puts avatar feet closer to the ground * Improved duplicate checking for terse updates. This should reduce bandwidth and walking through walls --- OpenSim/Client/Linden/LLStandaloneLoginModule.cs | 4 ++++ .../Communications/Services/LoginService.cs | 26 +++++++++------------ .../Hypergrid/HGStandaloneLoginModule.cs | 6 ++++- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 15 ++++++------ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 21 ++++++++++------- bin/OpenMetaverseTypes.dll | Bin 102400 -> 102400 bytes 6 files changed, 40 insertions(+), 32 deletions(-) diff --git a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs index bb9b623..8739ce5 100644 --- a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs +++ b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs @@ -231,6 +231,10 @@ namespace OpenSim.Client.Linden { return scene.RegionInfo; } + else if (m_scenes.Count > 0) + { + return m_scenes[0].RegionInfo; + } return null; } diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs index 922cd49..b652299 100644 --- a/OpenSim/Framework/Communications/Services/LoginService.cs +++ b/OpenSim/Framework/Communications/Services/LoginService.cs @@ -1031,30 +1031,26 @@ namespace OpenSim.Framework.Communications.Services return true; } - // StartLocation not available, send him to a nearby region instead - // regionInfo = m_gridService.RequestClosestRegion(""); - //m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName); + // Get the default region handle + ulong defaultHandle = Utils.UIntsToLong(m_defaultHomeX * Constants.RegionSize, m_defaultHomeY * Constants.RegionSize); - // Send him to default region instead - ulong defaultHandle = (((ulong)m_defaultHomeX * Constants.RegionSize) << 32) | - ((ulong)m_defaultHomeY * Constants.RegionSize); + // If we haven't already tried the default region, reset regionInfo + if (regionInfo != null && defaultHandle != regionInfo.RegionHandle) + regionInfo = null; - if ((regionInfo != null) && (defaultHandle == regionInfo.RegionHandle)) + if (regionInfo == null) { - m_log.ErrorFormat("[LOGIN]: Not trying the default region since this is the same as the selected region"); - return false; + m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); + regionInfo = GetRegionInfo(defaultHandle); } - m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); - regionInfo = GetRegionInfo(defaultHandle); - if (regionInfo == null) { - m_log.ErrorFormat("[LOGIN]: No default region available. Aborting."); - return false; + m_log.ErrorFormat("[LOGIN]: Sending user to any region"); + regionInfo = RequestClosestRegion(String.Empty); } - theUser.CurrentAgent.Position = new Vector3(128, 128, 0); + theUser.CurrentAgent.Position = new Vector3(128f, 128f, 0f); response.StartLocation = "safe"; return PrepareLoginToRegion(regionInfo, theUser, response, client); diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index 4199c98..46ee3c0 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs @@ -193,6 +193,10 @@ namespace OpenSim.Region.CoreModules.Hypergrid { return scene.RegionInfo; } + else if (m_scenes.Count > 0) + { + return m_scenes[0].RegionInfo; + } return null; } @@ -248,7 +252,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid { foreach (Scene nextScene in m_scenes) { - if (nextScene.RegionInfo.RegionName == regionName) + if (nextScene.RegionInfo.RegionName.Equals(regionName, StringComparison.InvariantCultureIgnoreCase)) { scene = nextScene; return true; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a99a802..c16c4fe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2394,18 +2394,19 @@ if (m_shape != null) { /// public void SendScheduledUpdates() { - const float VELOCITY_TOLERANCE = 0.0001f; - const float POSITION_TOLERANCE = 0.1f; + const float ROTATION_TOLERANCE = 0.01f; + const float VELOCITY_TOLERANCE = 0.001f; + const float POSITION_TOLERANCE = 0.05f; const int TIME_MS_TOLERANCE = 3000; if (m_updateFlag == 1) { // Throw away duplicate or insignificant updates - if (RotationOffset != m_lastRotation || - Acceleration != m_lastAcceleration || - (Velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE || - (RotationalVelocity - m_lastAngularVelocity).Length() > VELOCITY_TOLERANCE || - (OffsetPosition - m_lastPosition).Length() > POSITION_TOLERANCE || + if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || + !Acceleration.Equals(m_lastAcceleration) || + !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || + !RotationalVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || + !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) { AddTerseUpdateToAllAvatars(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9ba19d3..63c979f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2362,8 +2362,9 @@ namespace OpenSim.Region.Framework.Scenes public override void Update() { - const float VELOCITY_TOLERANCE = 0.0001f; - const float POSITION_TOLERANCE = 10.0f; + const float ROTATION_TOLERANCE = 0.01f; + const float VELOCITY_TOLERANCE = 0.001f; + const float POSITION_TOLERANCE = 0.05f; const int TIME_MS_TOLERANCE = 3000; SendPrimUpdates(); @@ -2377,9 +2378,9 @@ namespace OpenSim.Region.Framework.Scenes if (m_isChildAgent == false) { // Throw away duplicate or insignificant updates - if (m_bodyRot != m_lastRotation || - (m_velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE || - (m_pos - m_lastPosition).Length() > POSITION_TOLERANCE || + if (!m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || + !m_velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || + !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) { SendTerseUpdateToAllClients(); @@ -2415,7 +2416,9 @@ namespace OpenSim.Region.Framework.Scenes m_perfMonMS = Environment.TickCount; Vector3 pos = m_pos; - pos.Z -= m_appearance.HipOffset; + pos.Z += m_appearance.HipOffset; + + //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, pos, m_velocity, Vector3.Zero, m_bodyRot, Vector4.UnitW, m_uuid, null, GetUpdatePriority(remoteClient))); @@ -2514,7 +2517,7 @@ namespace OpenSim.Region.Framework.Scenes return; Vector3 pos = m_pos; - pos.Z -= m_appearance.HipOffset; + pos.Z += m_appearance.HipOffset; remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, pos, m_appearance.Texture.GetBytes(), @@ -2585,7 +2588,7 @@ namespace OpenSim.Region.Framework.Scenes // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); Vector3 pos = m_pos; - pos.Z -= m_appearance.HipOffset; + pos.Z += m_appearance.HipOffset; m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot)); @@ -2694,7 +2697,7 @@ namespace OpenSim.Region.Framework.Scenes } Vector3 pos = m_pos; - pos.Z -= m_appearance.HipOffset; + pos.Z += m_appearance.HipOffset; m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot)); diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll index 331d58b..95d6021 100644 Binary files a/bin/OpenMetaverseTypes.dll and b/bin/OpenMetaverseTypes.dll differ -- cgit v1.1