Skip to content

merge item multi-thread to CBT#61

Merged
NotAlwaysTrue merged 18 commits into
CBTfrom
dev_pte
Apr 30, 2026
Merged

merge item multi-thread to CBT#61
NotAlwaysTrue merged 18 commits into
CBTfrom
dev_pte

Conversation

@NotAlwaysTrue

Copy link
Copy Markdown
Owner

No description provided.

eiaol and others added 18 commits December 29, 2025 16:47
Refactors event, entity, and physics management to use thread-safe and lock-free data structures (Immutable collections, ConcurrentQueue, ConcurrentDictionary, Channel) for improved concurrency and performance. Replaces O(n) queue lookups with O(1) set/dictionary checks, ensures atomic updates for shared state, and optimizes queue draining and deferred action processing. Updates related code to use new APIs and patterns, and adds documentation for thread safety and workflow.
Replaced instance fields with ThreadLocal collections in Hull.GetConnectedHulls and Level.GetCells to ensure thread safety during parallel updates. Methods now return copies of the collections to prevent concurrent modification issues.
Changed ResetReceivedEvents from partial to regular method in EntitySpawner to ensure proper event queue clearing. Updated Level.cs to clear tempCellsLocal instead of tempCells, addressing potential issues with thread-local storage.
Implemented custom Lua converters for various thread-safe lists, ImmutableList, ImmutableHashSet, and ImmutableDictionary types. This allows seamless conversion between C# collections and Lua tables, improving Lua scripting integration with these collection types.
Replaced direct access to GameMain.Server.ConnectedClients with array snapshots in multiple server-side classes to prevent concurrent modification issues during parallel updates. Also updated PhysicsBody and LevelTrigger to avoid static/shared state in parallel contexts, improving thread safety and reliability.
Added an null check in AIObjectiveManager.cs to avoid accessing removed resources
Use shuffledGaps instead of gapList to ensure update order requirement(already in master)
Updated parallelism count
Removed min hard cap for MaxDegreeOfParallelism
Fixed ContactManager potential dead-lock issue
Use signal in DynamicTree so only one operation can be performed on the tree
Fixed crashes caused by gaps
@NotAlwaysTrue NotAlwaysTrue merged commit 39d16a4 into CBT Apr 30, 2026
2 of 3 checks passed
@NotAlwaysTrue NotAlwaysTrue deleted the dev_pte branch April 30, 2026 12:30
@NotAlwaysTrue NotAlwaysTrue restored the dev_pte branch April 30, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants