Core/Time: Remove artificially high minimal update intervals

Port From (https://github.com/TrinityCore/TrinityCore/commit/3a67e376811743be208da4aab8a9e452e1ae637e)
This commit is contained in:
hondacrx
2022-02-22 13:54:46 -05:00
parent 8ce8408f91
commit 338a861cd9
5 changed files with 14 additions and 13 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ namespace Framework.Constants
//Liquid
public const float LiquidTileSize = (533.333f / 128.0f);
public const int MinMapUpdateDelay = 50;
public const int MinMapUpdateDelay = 1;
public const int MinGridDelay = (Time.Minute * Time.InMilliseconds);
public const int MapResolution = 128;
+2 -2
View File
@@ -91,7 +91,7 @@ namespace Framework.Networking
{
Log.outDebug(LogFilter.Network, "Network Thread Starting");
int sleepTime = 10;
int sleepTime = 1;
while (!_stopped)
{
Thread.Sleep(sleepTime);
@@ -116,7 +116,7 @@ namespace Framework.Networking
}
uint diff = Time.GetMSTimeDiffToNow(tickStart);
sleepTime = (int)(diff > 10 ? 0 : 10 - diff);
sleepTime = (int)(diff > 1 ? 0 : 1 - diff);
}
Log.outDebug(LogFilter.Misc, "Network Thread exits");
+1 -1
View File
@@ -257,7 +257,7 @@ namespace Game
Values[WorldCfg.IntervalGridclean] = MapConst.MinGridDelay;
}
Values[WorldCfg.IntervalMapupdate] = GetDefaultValue("MapUpdateInterval", 100);
Values[WorldCfg.IntervalMapupdate] = GetDefaultValue("MapUpdateInterval", 10);
if ((int)Values[WorldCfg.IntervalMapupdate] < MapConst.MinMapUpdateDelay)
{
Log.outError(LogFilter.ServerLoading, "MapUpdateInterval ({0}) must be greater {1}. Use this minimal value.", Values[WorldCfg.IntervalMapupdate], MapConst.MinMapUpdateDelay);
+8 -7
View File
@@ -31,7 +31,7 @@ namespace WorldServer
{
public class Server
{
const uint WorldSleep = 50;
const uint WorldSleep = 1;
static void Main()
{
@@ -189,14 +189,15 @@ namespace WorldServer
var realCurrTime = Time.GetMSTime();
uint diff = Time.GetMSTimeDiff(realPrevTime, realCurrTime);
if (diff == 0)
{
// sleep until enough time passes that we can update all timers
Thread.Sleep(1);
continue;
}
Global.WorldMgr.Update(diff);
realPrevTime = realCurrTime;
uint executionTimeDiff = Time.GetMSTimeDiffToNow(realCurrTime);
// we know exactly how long it took to update the world, if the update took less than WORLD_SLEEP_CONST, sleep for WORLD_SLEEP_CONST - world update time
if (executionTimeDiff < WorldSleep)
Thread.Sleep((int)(WorldSleep - executionTimeDiff));
}
}
+2 -2
View File
@@ -334,9 +334,9 @@ GridCleanUpDelay = 300000
#
# MapUpdateInterval
# Description: Time (milliseconds) for map update interval.
# Default: 100 - (0.1 second)
# Default: 10 - (0.01 second)
MapUpdateInterval = 100
MapUpdateInterval = 10
#
# ChangeWeatherInterval