Fix Dark Fog enemy synchronization on client - #773
Open
JoshyDo wants to merge 1 commit into
Open
Conversation
Author
|
Footage from playtester confirming it works: Dyson.Sphere.Program.-.2026-09-04.13-55-17.mp4Uploading Dyson Sphere Program - 2026-09-04 14-08-05(1).mp4… |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses several underlying issues causing Dark Fog enemies (specifically ground units and space enemies) to not properly synchronize and render on clients in multiplayer.
The fix targets 7 specific areas:
Missing Ground Activation Broadcasts
In
EnemyDFGroundSystem_Patch, the server was not broadcasting activation packets for ground units. Added logic to loop through_activate_unit_listand properly sendDFGActivateUnitPacketto clients.Base Alert Wave Sync
In
DFGBaseComponent_Patch, an inverted guard condition (!IsIncomingRequest.Value) was blocking base alert waves on clients. Fixed by ensuring it only returns false if it's a client and not an incoming request.Space Sector Purging
In
SpaceSector_Patch,isCombatModewas uninitialized on clients, causing the game to actively purge valid space enemies viaSetEmpty(). Fixed the initialization and added null guards.Client HP/Shield Preservation
In
CombatManager,combatStatIdwas being reset to 0 for all entities in the pool on load. Added an exception forEObjectType.Enemyto ensure enemy HP and shields are preserved on clients.Recycle Pool Memory Leak / Clobbering
In
EnemyManager, a bug was causing destroyed enemies to overwrite index 0 of the recycle stack (enemyRecycle[0] = enemyId;), destroying the pool queue. Rewrote this to correctly search, append, and resize the recycle arrays.Multithreaded Aggro Sync
Added
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic._enemy_ground_unit_parallel))]toGameTickLogic_Unit_Transpilerto ensure the aggro sync targets the multi-threaded function correctly.Retargeting Crash
Fixed a minor off-by-one bounds check (
<=to<) and added a>= 0check inDFGRetargetProcessorto preventIndexOutOfRangeExceptionerrors.(Note: These changes have been successfully compiled and tested in-game.)