aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs18
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs19
2 files changed, 31 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 929f282..f27a6eb 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3554,7 +3554,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3554 double priority = m_prioritizer.GetUpdatePriority(this, entity); 3554 double priority = m_prioritizer.GetUpdatePriority(this, entity);
3555 3555
3556 lock (m_entityUpdates.SyncRoot) 3556 lock (m_entityUpdates.SyncRoot)
3557 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); 3557 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation), entity.LocalId);
3558 } 3558 }
3559 3559
3560 private void ProcessEntityUpdates(int maxUpdates) 3560 private void ProcessEntityUpdates(int maxUpdates)
@@ -3570,14 +3570,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3570 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race 3570 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
3571 // condition where a kill can be processed before an out-of-date update for the same object. 3571 // condition where a kill can be processed before an out-of-date update for the same object.
3572 lock (m_killRecord) 3572 lock (m_killRecord)
3573 { 3573 {
3574 float avgTimeDilation = 1.0f;
3574 EntityUpdate update; 3575 EntityUpdate update;
3575 while (updatesThisCall < maxUpdates) 3576 while (updatesThisCall < maxUpdates)
3576 { 3577 {
3577 lock (m_entityUpdates.SyncRoot) 3578 lock (m_entityUpdates.SyncRoot)
3578 if (!m_entityUpdates.TryDequeue(out update)) 3579 if (!m_entityUpdates.TryDequeue(out update))
3579 break; 3580 break;
3580 3581 avgTimeDilation += update.TimeDilation;
3582 avgTimeDilation *= 0.5f;
3583
3581 if (update.Entity is SceneObjectPart) 3584 if (update.Entity is SceneObjectPart)
3582 { 3585 {
3583 SceneObjectPart part = (SceneObjectPart)update.Entity; 3586 SceneObjectPart part = (SceneObjectPart)update.Entity;
@@ -3725,8 +3728,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3725 3728
3726 #region Packet Sending 3729 #region Packet Sending
3727 3730
3728 const float TIME_DILATION = 1.0f; 3731 //const float TIME_DILATION = 1.0f;
3729 ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); 3732
3733
3734 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
3730 3735
3731 if (terseAgentUpdateBlocks.IsValueCreated) 3736 if (terseAgentUpdateBlocks.IsValueCreated)
3732 { 3737 {
@@ -3739,7 +3744,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3739 3744
3740 for (int i = 0; i < blocks.Count; i++) 3745 for (int i = 0; i < blocks.Count; i++)
3741 packet.ObjectData[i] = blocks[i]; 3746 packet.ObjectData[i] = blocks[i];
3742 3747
3748
3743 OutPacket(packet, ThrottleOutPacketType.Unknown, true); 3749 OutPacket(packet, ThrottleOutPacketType.Unknown, true);
3744 } 3750 }
3745 3751
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 7fd59a0..eb97f41 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -287,6 +287,9 @@ namespace OpenSim.Region.Physics.OdePlugin
287 private OdePrim cp1; 287 private OdePrim cp1;
288 private OdeCharacter cc2; 288 private OdeCharacter cc2;
289 private OdePrim cp2; 289 private OdePrim cp2;
290 private int tickCountFrameRun;
291
292 private int latertickcount=0;
290 //private int cStartStop = 0; 293 //private int cStartStop = 0;
291 //private string cDictKey = ""; 294 //private string cDictKey = "";
292 295
@@ -3123,6 +3126,22 @@ namespace OpenSim.Region.Physics.OdePlugin
3123 } 3126 }
3124 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); 3127 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
3125 } 3128 }
3129 latertickcount = Util.EnvironmentTickCount() - tickCountFrameRun;
3130
3131 // OpenSimulator above does 10 fps. 10 fps = means that the main thread loop and physics
3132 // has a max of 100 ms to run theoretically.
3133 // If the main loop stalls, it calls Simulate later which makes the tick count ms larger.
3134 // If Physics stalls, it takes longer which makes the tick count ms larger.
3135
3136 if (latertickcount < 100)
3137 m_timeDilation = 1.0f;
3138 else
3139 {
3140 m_timeDilation = 100f / latertickcount;
3141 //m_timeDilation = Math.Min((Math.Max(100 - (Util.EnvironmentTickCount() - tickCountFrameRun), 1) / 100f), 1.0f);
3142 }
3143
3144 tickCountFrameRun = Util.EnvironmentTickCount();
3126 } 3145 }
3127 3146
3128 return fps; 3147 return fps;