Parallelize game update loops for performance

Refactored GameScreen update logic to use Parallel.Invoke and Parallel.ForEach for physics bodies, submarines, particles, level, characters, map entities, and status effects. This change aims to improve performance by leveraging multi-core processing. Also removed a debug Console.WriteLine from GameMain.
This commit is contained in:
eero
2025-12-22 15:47:15 +08:00
parent 9dc98192f4
commit 4d4f1f8351
2 changed files with 54 additions and 60 deletions
@@ -335,9 +335,6 @@ namespace Barotrauma
long prevTicks = stopwatch.ElapsedTicks;
while (ShouldRun)
{
#if DEBUG
Console.WriteLine(PM.ToString());
#endif
long currTicks = stopwatch.ElapsedTicks;
double elapsedTime = Math.Max(currTicks - prevTicks, 0) / frequency;
Timing.Accumulator += elapsedTime;