Commit Graph

5968 Commits

Author SHA1 Message Date
Eero
046483b9da Revert "OBT1.1.0 Merge branch 'dev_pte' into dev"
This reverts commit 177cf89756, reversing
changes made to 42ba733cd4.
2025-12-29 11:18:11 +08:00
Eero
177cf89756 OBT1.1.0 Merge branch 'dev_pte' into dev 2025-12-29 11:15:41 +08:00
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
bd1e624eb1 Remove unnecessary thread-safety code from entity spawning
Eliminated redundant locks and related comments in EntitySpawner and Entity classes, simplifying the spawn and remove queue handling. Also removed outdated comments in GameScreen regarding thread safety. These changes assume entity spawning and removal are no longer performed from multiple threads, improving code clarity and maintainability.
2025-12-28 17:45:51 +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
59bf2749dd Improve thread safety in sound and physics systems
Refactored SoundChannel and SoundManager to use explicit locking for OpenAL operations and channel assignment, preventing race conditions during parallel sound playback. Added thread-local stacks in DynamicTree to ensure thread safety during parallel physics queries and raycasts. These changes address concurrency issues when sounds or physics queries are triggered from multiple threads.
2025-12-28 16:18:49 +08:00
Eero
ad0bcddaa4 CL_Fix Use TryAdd when adding afflictions to dictionary
Replaces afflictions.Add with afflictions.TryAdd to prevent exceptions if the affliction already exists in the dictionary.
2025-12-28 15:11:56 +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
NotAlwaysTrue
42ba733cd4 Fixed a potential conflict with mods 2025-12-28 14:17:01 +08:00
Eero
45312af297 WIP Make static collections thread-safe using ThreadStatic and ThreadLocal
Refactored various static and instance collections to use [ThreadStatic], ThreadLocal, or local variables to prevent concurrent modification issues during parallel updates. This affects status effect targets, affliction lists, damage modifiers, and cached data in Character, CharacterHealth, Limb, Explosion, Hull, Submarine, and ToolBox classes. Also replaced Dictionary caches with ConcurrentDictionary where appropriate for thread safety.
2025-12-28 14:14:53 +08:00
Eero
c5fa49405f WIP Make networking code thread-safe and refactor update ID
Replaces direct increments of LastClientListUpdateID with a thread-safe IncrementLastClientListUpdateID method and uses Interlocked for atomic operations. Refactors EntitySpawner to lock access to the spawn/remove queue for thread safety. Updates INetSerializableStruct to use concurrent collections for cached variables and type behaviors, improving thread safety in networking code.
2025-12-28 13:10:17 +08:00
NotAlwaysTrue
42af6f2ec0 Fixed #22 2025-12-28 13:02:31 +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
NotAlwaysTrue
edd50ef181 Update publish-release.yml 2025-12-27 20:54:06 +08:00
NotAlwaysTrue
ced6dca7a3 OBT/1.0.6
Fixed a typo using "e" instead of "a" in word "performance"
2025-12-27 20:33:51 +08:00
NotAlwaysTrue
559aeb3c3f Fixed a typo using e instead of a :( 2025-12-27 18:47:50 +08:00
NotAlwaysTrue
16131e0acc Fixed a typo 2025-12-27 18:45:51 +08:00
NotAlwaysTrue
e8f377c20d Sync with Main
Sync with Main
2025-12-27 16:08:15 +08:00
NotAlwaysTrue
27896d53ef OBT/1.0.5
OBT/1.0.5
2025-12-27 16:06:23 +08:00
NotAlwaysTrue
a44d89f953 Revert "Revert back to 1.0.3" 2025-12-27 16:05:20 +08:00
NotAlwaysTrue
75465f2f21 OBT/1.0.5
Same as 1.0.4
Fixed a crash introduced by 1.0.4
2025-12-27 16:02:38 +08:00
NotAlwaysTrue
3aadff7a3c Improved thread safety for Gap.update() 2025-12-27 15:55:50 +08:00
NotAlwaysTrue
c65101537d Merge pull request #17 from NotAlwaysTrue/revert-16-master-fix
Revert back to 1.0.3
2025-12-27 15:35:07 +08:00
NotAlwaysTrue
b35eee5561 Revert "OBT/1.0.4" 2025-12-27 15:32:16 +08:00
NotAlwaysTrue
cdfe87c81b OBT/1.0.4
Add a marker to help distinguish EP from other SV Executables
Fixed a "Failed to copy object. Source is null." introduced by last update
Uses dynamic ThreadCount instead of fixed 16
Re-Removed most PF support
Re-Parallelzed Level update and Character Update(a conflict warning will be issued
2025-12-27 13:26:30 +08:00
NotAlwaysTrue
7e899d900a Added ClientCount for PerformenceMonitor
Add a marker to help distinguish EP from other SV Executables
Fixed a "Failed to copy object. Source is null." introduced by last update
Uses dynamic ThreadCount instead of fixed 16
Re-Removed most PF support
Re-Parallelzed Level update and Character Update(a conflict warning will be issued
2025-12-27 13:19:36 +08:00
NotAlwaysTrue
a037e616bf OBT/1.0.3
Restored multiple removed parallel stuff
Restored PF support(why)
Fixed #7
2025-12-27 02:12:25 +08:00
NotAlwaysTrue
f7650bd6df Re-applied multiple fixs 2025-12-27 02:06:04 +08:00
NotAlwaysTrue
716a35701c Revision 6032010
Removed a potential issue causing the server to stuck in GameScreen.cs (Internal reports)
Added an Warning message to SEEM
2025-12-27 01:59:17 +08:00
Eero
6032010847 Improve parallelization in map and game screen updates
Refactored update logic in MapEntity and GameScreen to use more granular and conditional parallelization, reducing unnecessary allocations and improving performance. Updates to hulls, structures, items, and physics bodies are now executed in parallel where safe, and item updates are only performed when necessary. Also parallelized submarine and physics body transform updates.
2025-12-26 21:04:07 +08:00
NotAlwaysTrue
5446795196 Fixed #7 (re-applied) 2025-12-26 11:07:54 +08:00
NotAlwaysTrue
31ed540939 OBT/1.0.2
Fixed #10
Fixed #12
Sync with upstream
2025-12-26 01:19:04 +08:00
NotAlwaysTrue
e715fdc835 Fixed #10
Fixed #12
2025-12-26 01:16:05 +08:00
Evil Factory
81f44969ee Fix memory leak that happens when you press retry in singleplayer 2025-12-25 23:42:55 +08:00
NotAlwaysTrue
fc35d888fc Merge pull request #6 from NotAlwaysTrue/master-dev 2025-12-23 23:12:38 +08:00
NotAlwaysTrue
eb01597dd3 Try-catch Sever Entity Event Manager thread-safety issue 2025-12-23 22:38:06 +08:00
Eero
572430cc2b Add server-only usage warning to README
Added prominent warnings in both English and Chinese indicating that this release is intended for server-side use only and should not be run on the client. Users are advised to thoroughly test compatibility before deployment.
2025-12-23 13:19:10 +08:00
eero
7b263676e0 Reapply "Refactor ServerEntityEventManager event processing"
This reverts commit bdd6c52e4e.
2025-12-23 00:36:47 +08:00
NotAlwaysTrue
c8123383d5 Add another try-catch to avoid Destination array was not long enough. Check the destination index, length, and the array's lower bounds issue 2025-12-23 00:17:45 +08:00
eero
bdd6c52e4e Revert "Refactor ServerEntityEventManager event processing"
This reverts commit de65cd88bc.
2025-12-23 00:16:02 +08:00
eero
de65cd88bc Refactor ServerEntityEventManager event processing
Introduces async event processing with cancellation support using SemaphoreSlim and CancellationTokenSource. Improves client event handling logic, separates in-game and mid-round sync clients, and adds proper disposal of resources. Enhances robustness and maintainability of event management.
2025-12-23 00:07:47 +08:00
NotAlwaysTrue
83ca51a99b Fixed compile errors :( 2025-12-22 22:58:22 +08:00
NotAlwaysTrue
1def7b7b8d add catch code for previous commit :( 2025-12-22 22:54:33 +08:00
NotAlwaysTrue
dadd6c598f try-finally multiple UniqueEvents.ToList() to avoid issues(Destination array was not long enough. Check the destination index, length, and the array's lower bounds) 2025-12-22 22:43:02 +08:00
NotAlwaysTrue
b891ec7793 Add a try-finally in HumanPrefab to fix an issue causing issue(Destination array was not long enough. )
Fixed another Collection was modified in SubmarineBody.Update()
2025-12-22 21:51:07 +08:00
eero
5b823d8684 Clarify thread safety in update methods
Updated comments in GameScreen.cs to indicate that StatusEffect.UpdateAll and Character.UpdateAnimAll are not thread-safe and must be executed on the main thread. Also removed a non-English comment from MapEntity.cs for consistency.
2025-12-22 18:07:17 +08:00
eero
b146fa326d 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.
2025-12-22 17:48:14 +08:00