From 6e01769bcff35be9cace62a0342cf2d275608891 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 12 Feb 2008 04:27:20 +0000 Subject: * A bunch of updates to make things more smooth. ** Sending the actual TimeDilation to the client now instead of the 62455 constant. The client is *supposed* to use that value to sync with the simulator. (actually sending ushort.maxvalue * TimeDilation) ** Disabling prim that inter-penetrate instead of just not attaching a joint ** Reduced prim spin a 'little' bit, but not *enough* ** Tweaked the TimeDilation algorithm to be closer to 1.0 by default and various changes to the sim stats reporter ** Created a .SetValues method to PhysicsVector so we can simply call the setvalues function instead of .x, .y, .z sets. ** Experimented with a .GetBytes Method on PhysicsActor to be able to use the LLVector3.FromBytes() method. ** Upped the Inter-penetration depth to 0.25 instead of .08. --- OpenSim/Region/Environment/Scenes/InnerScene.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 15 ++++++++++++--- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 5 ++++- OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 19 ++++++++++--------- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 +- OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 14 +++++++------- 6 files changed, 35 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 219db63..7831858 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -240,7 +240,7 @@ namespace OpenSim.Region.Environment.Scenes if (TryGetAvatar(remoteClient.AgentId, out av)) { ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle; - objupdate.RegionData.TimeDilation = 64096; + objupdate.RegionData.TimeDilation = ushort.MaxValue; objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[2]; // avatar stuff - horrible group copypaste diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 6b4f377..b797cc3 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -69,7 +69,7 @@ namespace OpenSim.Region.Environment.Scenes public InnerScene m_innerScene; private Random Rand = new Random(); - private uint _primCount = 702000; + private uint _primCount = 720000; private readonly Mutex _primAllocateMutex = new Mutex(false); private int m_timePhase = 24; @@ -113,7 +113,7 @@ namespace OpenSim.Region.Environment.Scenes protected int m_fps = 10; protected int m_frame = 0; - protected float m_timespan = 0.1f; + protected float m_timespan = 0.089f; protected DateTime m_lastupdate = DateTime.Now; protected float m_timedilation = 1.0f; @@ -750,8 +750,17 @@ namespace OpenSim.Region.Environment.Scenes finally { updateLock.ReleaseMutex(); + // Get actual time dilation + float tmpval = (m_timespan / (float)SinceLastFrame.TotalSeconds); - m_timedilation = m_timespan / (float)SinceLastFrame.TotalSeconds; + // If actual time dilation is greater then one, we're catching up, so subtract + // the amount that's greater then 1 from the time dilation + if (tmpval > 1.0) + { + tmpval = tmpval - (tmpval - 1.0f); + } + m_timedilation = tmpval; + m_lastupdate = DateTime.Now; } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index a745d9c..3b146ea 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1593,7 +1593,10 @@ namespace OpenSim.Region.Environment.Scenes part.UpdateMovement(); } } - + public float GetTimeDilation() + { + return m_scene.TimeDilation; + } /// /// Added as a way for the storage provider to reset the scene, /// most likely a better way to do this sort of thing but for now... diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 180ed51..7900900 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -94,10 +94,12 @@ namespace OpenSim.Region.Environment.Scenes public byte ObjectSaleType; public int SalePrice; public uint Category; + public Int32 CreationDate; public uint ParentID = 0; + private PhysicsVector m_lastRotationalVelocity = PhysicsVector.Zero; private Vector3 m_sitTargetPosition = new Vector3(0, 0, 0); private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1); private LLUUID m_sitTargetAvatar = LLUUID.Zero; @@ -417,9 +419,7 @@ namespace OpenSim.Region.Environment.Scenes { if (PhysActor.IsPhysical) { - m_rotationalvelocity.X = PhysActor.RotationalVelocity.X; - m_rotationalvelocity.Y = PhysActor.RotationalVelocity.Y; - m_rotationalvelocity.Z = PhysActor.RotationalVelocity.Z; + m_rotationalvelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(),0); } } @@ -1693,7 +1693,7 @@ namespace OpenSim.Region.Environment.Scenes byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; - remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid, + remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalID, m_shape, lPos, clientFlags, m_uuid, OwnerID, m_text, color, ParentID, m_particleSystem, lRot, m_clickAction, m_TextureAnimation); } @@ -1741,12 +1741,13 @@ namespace OpenSim.Region.Environment.Scenes LLQuaternion mRot = RotationOffset; if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) { - remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); + remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalID, lPos, mRot); } else { - remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, + remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalID, lPos, mRot, Velocity, RotationalVelocity); + //System.Console.WriteLine("LID: " + LocalID + " RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); } } @@ -1755,13 +1756,13 @@ namespace OpenSim.Region.Environment.Scenes LLQuaternion mRot = RotationOffset; if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) { - remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); + remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalID, lPos, mRot); } else { - remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, + remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalID, lPos, mRot, Velocity, RotationalVelocity); - //System.Console.WriteLine("RVel:" + RotationalVelocity); + //System.Console.WriteLine("LID: " + LocalID + "RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); } } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 8155b10..5403fc7 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -1289,7 +1289,7 @@ namespace OpenSim.Region.Environment.Scenes LLVector3 pos = m_pos; LLVector3 vel = Velocity; LLQuaternion rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w); - remoteClient.SendAvatarTerseUpdate(m_regionHandle, 64096, LocalId, new LLVector3(pos.X, pos.Y, pos.Z), + remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * (float)ushort.MaxValue), LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z), rot); m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 3e1fec2..a0539f0 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs @@ -181,7 +181,7 @@ namespace OpenSim.Region.Environment.Scenes // Then we divide the whole amount by the amount of seconds pass in between stats updates. sb[0].StatID = (uint) Stats.TimeDilation; - sb[0].StatValue = ((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); + sb[0].StatValue = m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); sb[1].StatID = (uint) Stats.SimFPS; sb[1].StatValue = simfps/statsUpdateFactor; @@ -280,13 +280,13 @@ namespace OpenSim.Region.Environment.Scenes public void AddTimeDilation(float td) { - float tdsetting = td; - if (tdsetting > 1.0f) - tdsetting = (tdsetting - (tdsetting - 0.91f)); + //float tdsetting = td; + //if (tdsetting > 1.0f) + //tdsetting = (tdsetting - (tdsetting - 0.91f)); - if (tdsetting < 0) - tdsetting = 0.0f; - m_timeDilation += tdsetting; + //if (tdsetting < 0) + //tdsetting = 0.0f; + m_timeDilation = td; } public void SetRootAgents(int rootAgents) -- cgit v1.1