Move a lot of thing around to fix collection was modified.
Note: For now I can only adjust orders and cannot make some real thing. It will take time to check and refactor everything necessary.
This commit is contained in:
@@ -127,12 +127,12 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
if (TotalTimeElapsed - 60000 >= tickrate60stimer)
|
if (TotalTimeElapsed - 60000 >= tickrate60stimer)
|
||||||
{
|
{
|
||||||
TickRateLow = 60;
|
|
||||||
TickRateHigh = 60;
|
|
||||||
tickrate60stimer = TotalTimeElapsed;
|
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
GameServer.Log(PM.ToString(), ServerLog.MessageType.ServerMessage);
|
GameServer.Log(PM.ToString(), ServerLog.MessageType.ServerMessage);
|
||||||
#endif
|
#endif
|
||||||
|
TickRateLow = 60;
|
||||||
|
TickRateHigh = 60;
|
||||||
|
tickrate60stimer = TotalTimeElapsed;
|
||||||
}
|
}
|
||||||
if (RealTickRate > TickRateHigh)
|
if (RealTickRate > TickRateHigh)
|
||||||
{
|
{
|
||||||
@@ -153,7 +153,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
$"[{DateTime.Now}]\n" +
|
|
||||||
$"Server Performence Info \n" +
|
$"Server Performence Info \n" +
|
||||||
#endif
|
#endif
|
||||||
$"Item Count: {ItemCount}\n" +
|
$"Item Count: {ItemCount}\n" +
|
||||||
|
|||||||
@@ -643,7 +643,6 @@ namespace Barotrauma
|
|||||||
public static void UpdateAll(float deltaTime, Camera cam)
|
public static void UpdateAll(float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
mapEntityUpdateTick++;
|
mapEntityUpdateTick++;
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
var sw = new System.Diagnostics.Stopwatch();
|
var sw = new System.Diagnostics.Stopwatch();
|
||||||
sw.Start();
|
sw.Start();
|
||||||
@@ -657,7 +656,7 @@ namespace Barotrauma
|
|||||||
hull.Update(deltaTime * MapEntityUpdateInterval, cam);
|
hull.Update(deltaTime * MapEntityUpdateInterval, cam);
|
||||||
}
|
}
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
Hull.UpdateCheats(deltaTime * MapEntityUpdateInterval, cam);
|
Hull.UpdateCheats(deltaTime * MapEntityUpdateInterval, cam);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
foreach (Structure structure in Structure.WallList)
|
foreach (Structure structure in Structure.WallList)
|
||||||
@@ -693,53 +692,40 @@ namespace Barotrauma
|
|||||||
GameMain.PerformanceCounter.AddElapsedTicks("Update:MapEntity:Misc", sw.ElapsedTicks);
|
GameMain.PerformanceCounter.AddElapsedTicks("Update:MapEntity:Misc", sw.ElapsedTicks);
|
||||||
sw.Restart();
|
sw.Restart();
|
||||||
#endif
|
#endif
|
||||||
Task PItemTask = Task.Factory.StartNew(() =>
|
Task ItemTask = Task.Factory.StartNew(() =>
|
||||||
{
|
|
||||||
foreach (var item in GameMain.LuaCs.Game.UpdatePriorityItems)
|
|
||||||
{
|
{
|
||||||
if (item.Removed) continue;
|
Item.UpdatePendingConditionUpdates(deltaTime);
|
||||||
|
//mapEntityUpdateTick % MapEntityUpdateInterval == 0
|
||||||
item.Update(deltaTime, cam);
|
if (true)
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Task SpawnerTask = Task.Factory.StartNew(() =>
|
|
||||||
{
|
|
||||||
if (mapEntityUpdateTick % MapEntityUpdateInterval == 0)
|
|
||||||
{
|
|
||||||
UpdateAllProjSpecific(deltaTime * MapEntityUpdateInterval);
|
|
||||||
|
|
||||||
Spawner?.Update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Task.WaitAll(SpawnerTask, PItemTask, GapTask, StructuralTask);
|
|
||||||
|
|
||||||
Item.UpdatePendingConditionUpdates(deltaTime);
|
|
||||||
if (mapEntityUpdateTick % MapEntityUpdateInterval == 0)
|
|
||||||
{
|
|
||||||
lock(Item.ItemList)
|
|
||||||
{
|
|
||||||
Item lastUpdatedItem = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
foreach (Item item in Item.ItemList)
|
Item lastUpdatedItem = null;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (GameMain.LuaCs.Game.UpdatePriorityItems.Contains(item)) { continue; }
|
foreach (Item item in Item.ItemList)
|
||||||
lastUpdatedItem = item;
|
{
|
||||||
item.Update(deltaTime * MapEntityUpdateInterval, cam);
|
lastUpdatedItem = item;
|
||||||
|
item.Update(deltaTime * MapEntityUpdateInterval, cam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException e)
|
||||||
|
{
|
||||||
|
GameAnalyticsManager.AddErrorEventOnce(
|
||||||
|
"MapEntity.UpdateAll:ItemUpdateInvalidOperation",
|
||||||
|
GameAnalyticsManager.ErrorSeverity.Critical,
|
||||||
|
$"Error while updating item {lastUpdatedItem?.Name ?? "null"}: {e.Message}");
|
||||||
|
throw new InvalidOperationException($"Error while updating item {lastUpdatedItem?.Name ?? "null"}", innerException: e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException e)
|
});
|
||||||
{
|
|
||||||
GameAnalyticsManager.AddErrorEventOnce(
|
Task.WaitAll(ItemTask, GapTask, StructuralTask);
|
||||||
"MapEntity.UpdateAll:ItemUpdateInvalidOperation",
|
|
||||||
GameAnalyticsManager.ErrorSeverity.Critical,
|
if (mapEntityUpdateTick % MapEntityUpdateInterval == 0)
|
||||||
$"Error while updating item {lastUpdatedItem?.Name ?? "null"}: {e.Message}");
|
{
|
||||||
throw new InvalidOperationException($"Error while updating item {lastUpdatedItem?.Name ?? "null"}", innerException: e);
|
UpdateAllProjSpecific(deltaTime * MapEntityUpdateInterval);
|
||||||
}
|
|
||||||
}
|
Spawner?.Update();
|
||||||
}
|
}
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
|
|||||||
@@ -107,6 +107,9 @@ namespace Barotrauma
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Update(double deltaTime)
|
public override void Update(double deltaTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#warning For now CL side performence counter is partly useless bucz multiple changes on such things. Need time to take care of it
|
||||||
|
|
||||||
#if RUN_PHYSICS_IN_SEPARATE_THREAD
|
#if RUN_PHYSICS_IN_SEPARATE_THREAD
|
||||||
physicsTime += deltaTime;
|
physicsTime += deltaTime;
|
||||||
lock (updateLock)
|
lock (updateLock)
|
||||||
@@ -220,9 +223,6 @@ namespace Barotrauma
|
|||||||
GameMain.PerformanceCounter.AddElapsedTicks("Update:Character", sw.ElapsedTicks);
|
GameMain.PerformanceCounter.AddElapsedTicks("Update:Character", sw.ElapsedTicks);
|
||||||
sw.Restart();
|
sw.Restart();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Task SETask = Task.Factory.StartNew(() => StatusEffect.UpdateAll((float)deltaTime));
|
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
GameMain.PerformanceCounter.AddElapsedTicks("Update:StatusEffects", sw.ElapsedTicks);
|
GameMain.PerformanceCounter.AddElapsedTicks("Update:StatusEffects", sw.ElapsedTicks);
|
||||||
@@ -277,10 +277,12 @@ namespace Barotrauma
|
|||||||
#if CLIENT
|
#if CLIENT
|
||||||
MapEntity.UpdateAll((float)deltaTime, cam);
|
MapEntity.UpdateAll((float)deltaTime, cam);
|
||||||
#elif SERVER
|
#elif SERVER
|
||||||
Task.WaitAll(LevelTask, CharacterTask, SETask);
|
Task.WaitAll(LevelTask, CharacterTask);
|
||||||
|
|
||||||
//This is internally multi-threaded
|
//This is internally multi-threaded
|
||||||
MapEntity.UpdateAll((float)deltaTime, Camera.Instance);
|
MapEntity.UpdateAll((float)deltaTime, Camera.Instance);
|
||||||
|
|
||||||
|
StatusEffect.UpdateAll((float)deltaTime);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
|
|||||||
Reference in New Issue
Block a user