Refactor MapEntity.UpdateAll for improved parallelism

Rewrites MapEntity.UpdateAll to use more granular parallelism, reducing contention and improving performance by parallelizing hull, structure, and gap resets, while keeping order-dependent and non-thread-safe updates sequential. Updates GameScreen to pass ParallelOptions to UpdateAll.
This commit is contained in:
eero
2025-12-22 17:48:14 +08:00
parent bab02fca8a
commit b146fa326d
2 changed files with 86 additions and 65 deletions
@@ -273,11 +273,11 @@ namespace Barotrauma
});
#if CLIENT
MapEntity.UpdateAll((float)deltaTime, cam);
MapEntity.UpdateAll((float)deltaTime, cam, parallelOptions);
#elif SERVER
// TODO: Move both UpdateAll() method to this file
MapEntity.UpdateAll((float)deltaTime, Camera.Instance);
MapEntity.UpdateAll((float)deltaTime, Camera.Instance, parallelOptions);
StatusEffect.UpdateAll((float)deltaTime);
#endif