From ea5d1d0ff0c847741b7d854b54fa3b61c9984a5a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 20 Oct 2011 20:48:51 +0100 Subject: [PATCH] Get OdeScene to use passed in time step rather than hard-coded 0.089 However, I still don't recommend changing MinFrameTime from 0.089, high values do not work well and lower values don't seem to make much difference --- OpenSim/Region/Framework/Scenes/Scene.cs | 10 +++- .../RegionReadyModule/RegionReadyModule.cs | 2 +- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 54 ++++++++----------- 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 241419b8de..15bf81cab3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1124,7 +1124,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void StartTimer() { - //m_log.Debug("[SCENE]: Starting timer"); +// m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); + //m_heartbeatTimer.Enabled = true; //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); @@ -1199,6 +1200,8 @@ namespace OpenSim.Region.Framework.Scenes ++Frame; +// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame); + try { int tmpAgentMS = Util.EnvironmentTickCount(); @@ -1316,6 +1319,8 @@ namespace OpenSim.Region.Framework.Scenes if (LoginsDisabled && Frame == 20) { +// m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); + // In 99.9% of cases it is a bad idea to manually force garbage collection. However, // this is a rare case where we know we have just went through a long cycle of heap // allocations, and there is no more work to be done until someone logs in @@ -1332,8 +1337,9 @@ namespace OpenSim.Region.Framework.Scenes EventManager.TriggerLoginsEnabled(RegionInfo.RegionName); } m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); + // For RegionReady lockouts - if( LoginLock == false) + if(LoginLock == false) { LoginsDisabled = false; } diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 963d1e2542..4c4f5fb890 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -105,7 +105,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); - if(m_disable_logins == true) + if (m_disable_logins == true) { scene.LoginLock = true; scene.LoginsDisabled = true; diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 916c3becb2..8cf95d0c13 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -2610,24 +2610,27 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); framecount++; float fps = 0; - //m_log.Info(timeStep.ToString()); - step_time += timeStep; - - // If We're loaded down by something else, - // or debugging with the Visual Studio project on pause - // skip a few frames to catch up gracefully. - // without shooting the physicsactors all over the place - if (step_time >= m_SkipFramesAtms) - { - // Instead of trying to catch up, it'll do 5 physics frames only - step_time = ODE_STEPSIZE; - m_physicsiterations = 5; - } - else - { - m_physicsiterations = 10; - } + float timeLeft = timeStep; + + //m_log.Info(timeStep.ToString()); +// step_time += timeStep; +// +// // If We're loaded down by something else, +// // or debugging with the Visual Studio project on pause +// // skip a few frames to catch up gracefully. +// // without shooting the physicsactors all over the place +// +// if (step_time >= m_SkipFramesAtms) +// { +// // Instead of trying to catch up, it'll do 5 physics frames only +// step_time = ODE_STEPSIZE; +// m_physicsiterations = 5; +// } +// else +// { +// m_physicsiterations = 10; +// } if (SupportsNINJAJoints) { @@ -2650,18 +2653,14 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); //base.TriggerPhysicsBasedRestart(); //} - int i = 0; - // Figure out the Frames Per Second we're going at. //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size - fps = (step_time / ODE_STEPSIZE) * 1000; + fps = (timeStep / ODE_STEPSIZE) * 1000; // HACK: Using a time dilation of 1.0 to debug rubberbanding issues //m_timeDilation = Math.Min((step_time / ODE_STEPSIZE) / (0.09375f / ODE_STEPSIZE), 1.0f); - step_time = 0.089f; - - while (step_time > 0.0f) + while (timeLeft > 0.0f) { try { @@ -2802,14 +2801,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); ode.dunlock(world); } - step_time -= ODE_STEPSIZE; - i++; - //} - //else - //{ - //fps = 0; - //} - //} + timeLeft -= ODE_STEPSIZE; } lock (_characters)