Skip to content

Merge itemrefactor into CBT env#62

Merged
NotAlwaysTrue merged 11 commits into
CBTfrom
dev_itemrefactor
Apr 30, 2026
Merged

Merge itemrefactor into CBT env#62
NotAlwaysTrue merged 11 commits into
CBTfrom
dev_itemrefactor

Conversation

@NotAlwaysTrue

Copy link
Copy Markdown
Owner

No description provided.

eiaol and others added 11 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
@NotAlwaysTrue NotAlwaysTrue merged commit 4c6749a into CBT Apr 30, 2026
2 of 3 checks passed
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