Commit Graph

218 Commits

Author SHA1 Message Date
Eero e167a34f32 Make entity lists thread-safe with copy-on-write wrappers
Replaced static entity lists (e.g., HullList, GapList, MapEntityList, etc.) with thread-safe copy-on-write wrappers to improve concurrency and prevent race conditions. Updated usages and related methods to support the new thread-safe collections, ensuring atomic operations and lock-free reads throughout the codebase.
2025-12-28 21:59:03 +08:00
Eero 1db14631df Defer physics transforms to ensure thread safety
Refactored multiple components to defer Farseer physics transform operations using PhysicsBodyQueue, preventing unsafe calls from parallel contexts. This change addresses thread safety issues with Farseer's DynamicTree and ensures transforms are executed in a safe context. Also increased the spawn amount limit in DebugConsole from 100 to 100000.
2025-12-28 17:14:16 +08:00
Eero f485583621 Unstable 0.2 Defer physics operations during parallel updates
Introduces a thread-safe queue for deferring physics operations (such as body creation and transforms) to the main thread, ensuring Farseer Physics is not accessed from parallel contexts. Updates Holdable, Item, MapEntity, and GameScreen to use the new PhysicsBodyQueue for safe physics operations during parallel updates, and refactors PhysicsBodyQueue to support general deferred physics actions.
2025-12-28 15:10:06 +08:00
Eero 49355fe32b Unstable Add thread-safe queue for deferred physics body creation
Introduces PhysicsBodyQueue to safely defer physics body creation to the main thread, addressing thread-safety issues with Farseer Physics during parallel updates. Updates LevelResource, TriggerComponent, BallastFloraBehavior, and MapEntity to use the queue for all physics body creation and refresh operations, ensuring they are processed outside of parallel loops. Also adds cleanup of the queue at round end.
2025-12-28 14:42:17 +08:00
Eero 31812d524d Make collections thread-safe for AI and character systems
Refactored various collections (lists, dictionaries, queues, and caches) in AI, character, animation, and item component systems to use thread-safe patterns and concurrent data structures. This includes introducing copy-on-write wrappers, ConcurrentDictionary, ConcurrentQueue, and ThreadLocal where appropriate to ensure safe concurrent access and mutation, improving stability in multi-threaded scenarios.
2025-12-28 12:53:10 +08:00
Eero 46595b1399 WIP Make collections thread-safe and add safe iteration
Replaced static lists and dictionaries with thread-safe ConcurrentDictionary or ThreadLocal collections for various item components and systems. Updated all relevant code to use snapshots (ToArray, ToList) for safe iteration, and added helper methods for marking and clearing changed connections. These changes improve thread safety and prevent potential concurrency issues in multi-threaded scenarios.
2025-12-28 04:59:56 +08:00
Eero 90962b2328 Refactor Item collections for thread safety and performance
Replaces static Item.ItemList and related collections with thread-safe data structures using ConcurrentDictionary and ImmutableHashSet. Adds thread-safe helpers for marking items for deconstruction and managing item lists. Updates all usages of Item.ItemList and DeconstructItems to use new APIs, improving performance and safety in multi-threaded contexts. Also refactors MeleeWeapon and Projectile impact queues to use ConcurrentQueue, and updates related logic throughout the codebase.
2025-12-28 03:57:04 +08:00
Evil Factory 352625af28 Merge remote-tracking branch 'upstream/master' 2025-12-08 12:35:44 -03:00
Markus Isberg 598966f200 Release 1.11.4.1 (Winter Update) 2025-12-08 14:56:47 +00:00
Evil Factory da13162c60 Merge branch 'master' of https://github.com/Regalis11/Barotrauma 2025-09-25 09:00:20 -03:00
Regalis11 b2d91cde7c Release 1.10.6.0 - Autumn Update 2025 Hotfix 1 2025-09-25 11:11:35 +03:00
Evil Factory cfab935b75 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2025-09-17 08:30:35 -03:00
Regalis11 caa0326cf8 Release 1.10.5.0 - Autumn Update 2025 2025-09-17 13:44:21 +03:00
EvilFactory b8fd8980a7 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2025-07-01 17:55:43 -03:00
Regalis11 6661bb607b Release 1.9.8.0 - Summer Update Hotfix 1 2025-07-01 11:40:07 +03:00
EvilFactory 2368640841 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2025-06-17 15:45:16 -03:00
Regalis11 ea5a2bc693 Release 1.9.7.0 - Summer Update 2025 2025-06-17 16:38:11 +03:00
EvilFactory 64faf5c967 Merge branch 'master' of https://github.com/Regalis11/Barotrauma 2025-04-29 07:27:36 -03:00
Regalis11 ec9e29af07 Release 1.8.8.1 - Calm Before the Storm Hotfix 1 2025-04-29 12:46:51 +03:00
EvilFactory 5e321a5abd Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2025-04-16 18:08:37 -03:00
Regalis11 1deef20f21 Release 1.8.7.0 - Calm Before the Storm Hotfix 1 2025-04-16 12:46:39 +03:00
EvilFactory 103871a4e9 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2025-04-10 10:37:09 -03:00
Markus Isberg a4a3427e4e Unstable 1.8.4.0 2025-03-12 12:56:27 +00:00
EvilFactory 6da26ffa93 Merge remote-tracking branch 'upstream/master' into develop 2024-12-11 10:44:53 -03:00
Regalis11 f6349b2175 v1.7.7.0 (Winter Update 2024) 2024-12-11 13:26:13 +02:00
EvilFactory 9e9ac6cd32 Merge remote-tracking branch 'upstream/master' into develop 2024-10-31 06:31:11 -03:00
Regalis11 26ffd2104e v1.6.19.1 (Unto the Breach Hotfix 1) 2024-10-31 11:27:32 +02:00
EvilFactory d906066425 Merge remote-tracking branch 'upstream/master' into develop 2024-10-28 10:10:02 -03:00
Regalis11 7eac44ea7d v1.6.18.1 (Unto the Breach Hotfix 1) 2024-10-28 15:03:46 +02:00
EvilFactory 30a8f0c561 Merge remote-tracking branch 'upstream/master' into develop 2024-10-22 12:42:35 -03:00
Regalis11 6e6c17e100 v1.6.17.0 (Unto the Breach update) 2024-10-22 17:29:04 +03:00
EvilFactory f4219b0c75 Merge remote-tracking branch 'upstream/master' into develop 2024-06-19 12:45:44 -03:00
Regalis11 169eced79a v1.5.7.0 (Summer Update Hotfix 1) 2024-06-19 18:42:16 +03:00
EvilFactory e163f7ed73 Merge remote-tracking branch 'upstream/master' into develop 2024-06-18 12:19:13 -03:00
Regalis11 230d1b6e78 v1.5.7.0 (Summer Update) 2024-06-18 16:50:02 +03:00
EvilFactory c518b696f6 Merge remote-tracking branch 'upstream/master' into develop 2024-05-02 12:25:49 -03:00
Markus Isberg 0a0a9784c5 Blood in the Water Hotfix 2 - 1.4.6.0 2024-05-02 14:08:04 +03:00
EvilFactory 0a9ff43986 Merge remote-tracking branch 'upstream/master' into develop 2024-04-24 12:20:11 -03:00
Regalis11 ff1b8951a7 v1.4.4.1 (Blood in the Water Update) 2024-04-24 18:09:05 +03:00
EvilFactory 7a74cd052f Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2024-03-28 14:26:18 -03:00
Regalis11 3791670c42 v1.3.0.1 (Epic Store release) 2024-03-28 18:34:33 +02:00
EvilFactory 2ebaa72a12 Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-12-20 11:34:03 -03:00
Regalis11 ada8d6f260 v1.2.7.0 (Winter Update hotfix) 2023-12-20 15:00:42 +02:00
EvilFactory 448e4cdfbb Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-12-14 11:56:39 -03:00
Regalis11 b91e85559d v1.2.6.0 (Winter Update) 2023-12-14 16:11:27 +02:00
EvilFactory 759f66cf9f Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop 2023-10-30 12:40:09 -03:00
Regalis11 a8f9c97dda v1.1.19.3 (Treacherous Tides Hotfix 2) 2023-10-30 17:38:29 +02:00
EvilFactory 7f311a6526 Merge branch 'master' of https://github.com/Regalis11/Barotrauma 2023-10-19 13:36:40 -03:00
Regalis11 df7e8f1625 v1.1.18.0 (Treacherous Tides Update) 2023-10-19 19:28:43 +03:00
EvilFactory a65d99021c Fixed merge and some errors 2023-10-19 12:53:49 -03:00