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)
|
||||
{
|
||||
TickRateLow = 60;
|
||||
TickRateHigh = 60;
|
||||
tickrate60stimer = TotalTimeElapsed;
|
||||
#if !DEBUG
|
||||
GameServer.Log(PM.ToString(), ServerLog.MessageType.ServerMessage);
|
||||
#endif
|
||||
TickRateLow = 60;
|
||||
TickRateHigh = 60;
|
||||
tickrate60stimer = TotalTimeElapsed;
|
||||
}
|
||||
if (RealTickRate > TickRateHigh)
|
||||
{
|
||||
@@ -153,7 +153,6 @@ namespace Barotrauma
|
||||
{
|
||||
return
|
||||
#if !DEBUG
|
||||
$"[{DateTime.Now}]\n" +
|
||||
$"Server Performence Info \n" +
|
||||
#endif
|
||||
$"Item Count: {ItemCount}\n" +
|
||||
|
||||
@@ -643,7 +643,6 @@ namespace Barotrauma
|
||||
public static void UpdateAll(float deltaTime, Camera cam)
|
||||
{
|
||||
mapEntityUpdateTick++;
|
||||
|
||||
#if CLIENT
|
||||
var sw = new System.Diagnostics.Stopwatch();
|
||||
sw.Start();
|
||||
@@ -657,7 +656,7 @@ namespace Barotrauma
|
||||
hull.Update(deltaTime * MapEntityUpdateInterval, cam);
|
||||
}
|
||||
#if CLIENT
|
||||
Hull.UpdateCheats(deltaTime * MapEntityUpdateInterval, cam);
|
||||
Hull.UpdateCheats(deltaTime * MapEntityUpdateInterval, cam);
|
||||
#endif
|
||||
|
||||
foreach (Structure structure in Structure.WallList)
|
||||
@@ -693,53 +692,40 @@ namespace Barotrauma
|
||||
GameMain.PerformanceCounter.AddElapsedTicks("Update:MapEntity:Misc", sw.ElapsedTicks);
|
||||
sw.Restart();
|
||||
#endif
|
||||
Task PItemTask = Task.Factory.StartNew(() =>
|
||||
{
|
||||
foreach (var item in GameMain.LuaCs.Game.UpdatePriorityItems)
|
||||
Task ItemTask = Task.Factory.StartNew(() =>
|
||||
{
|
||||
if (item.Removed) continue;
|
||||
|
||||
item.Update(deltaTime, cam);
|
||||
}
|
||||
});
|
||||
|
||||
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
|
||||
Item.UpdatePendingConditionUpdates(deltaTime);
|
||||
//mapEntityUpdateTick % MapEntityUpdateInterval == 0
|
||||
if (true)
|
||||
{
|
||||
foreach (Item item in Item.ItemList)
|
||||
Item lastUpdatedItem = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (GameMain.LuaCs.Game.UpdatePriorityItems.Contains(item)) { continue; }
|
||||
lastUpdatedItem = item;
|
||||
item.Update(deltaTime * MapEntityUpdateInterval, cam);
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
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(
|
||||
"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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Task.WaitAll(ItemTask, GapTask, StructuralTask);
|
||||
|
||||
if (mapEntityUpdateTick % MapEntityUpdateInterval == 0)
|
||||
{
|
||||
UpdateAllProjSpecific(deltaTime * MapEntityUpdateInterval);
|
||||
|
||||
Spawner?.Update();
|
||||
}
|
||||
#if CLIENT
|
||||
sw.Stop();
|
||||
|
||||
@@ -107,6 +107,9 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
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
|
||||
physicsTime += deltaTime;
|
||||
lock (updateLock)
|
||||
@@ -220,9 +223,6 @@ namespace Barotrauma
|
||||
GameMain.PerformanceCounter.AddElapsedTicks("Update:Character", sw.ElapsedTicks);
|
||||
sw.Restart();
|
||||
#endif
|
||||
|
||||
Task SETask = Task.Factory.StartNew(() => StatusEffect.UpdateAll((float)deltaTime));
|
||||
|
||||
#if CLIENT
|
||||
sw.Stop();
|
||||
GameMain.PerformanceCounter.AddElapsedTicks("Update:StatusEffects", sw.ElapsedTicks);
|
||||
@@ -277,10 +277,12 @@ namespace Barotrauma
|
||||
#if CLIENT
|
||||
MapEntity.UpdateAll((float)deltaTime, cam);
|
||||
#elif SERVER
|
||||
Task.WaitAll(LevelTask, CharacterTask, SETask);
|
||||
Task.WaitAll(LevelTask, CharacterTask);
|
||||
|
||||
//This is internally multi-threaded
|
||||
MapEntity.UpdateAll((float)deltaTime, Camera.Instance);
|
||||
|
||||
StatusEffect.UpdateAll((float)deltaTime);
|
||||
#endif
|
||||
|
||||
#if CLIENT
|
||||
|
||||
Reference in New Issue
Block a user