Skip to content

Fix Dark Fog enemy synchronization on client - #773

Open
JoshyDo wants to merge 1 commit into
NebulaModTeam:masterfrom
JoshyDo:fix/dark-fog-sync
Open

Fix Dark Fog enemy synchronization on client#773
JoshyDo wants to merge 1 commit into
NebulaModTeam:masterfrom
JoshyDo:fix/dark-fog-sync

Conversation

@JoshyDo

@JoshyDo JoshyDo commented Sep 6, 2026

Copy link
Copy Markdown

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:

  1. Missing Ground Activation Broadcasts
    In EnemyDFGroundSystem_Patch, the server was not broadcasting activation packets for ground units. Added logic to loop through _activate_unit_list and properly send DFGActivateUnitPacket to clients.

  2. 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.

  3. Space Sector Purging
    In SpaceSector_Patch, isCombatMode was uninitialized on clients, causing the game to actively purge valid space enemies via SetEmpty(). Fixed the initialization and added null guards.

  4. Client HP/Shield Preservation
    In CombatManager, combatStatId was being reset to 0 for all entities in the pool on load. Added an exception for EObjectType.Enemy to ensure enemy HP and shields are preserved on clients.

  5. 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.

  6. Multithreaded Aggro Sync
    Added [HarmonyPatch(typeof(GameLogic), nameof(GameLogic._enemy_ground_unit_parallel))] to GameTickLogic_Unit_Transpiler to ensure the aggro sync targets the multi-threaded function correctly.

  7. Retargeting Crash
    Fixed a minor off-by-one bounds check (<= to <) and added a >= 0 check in DFGRetargetProcessor to prevent IndexOutOfRangeException errors.

(Note: These changes have been successfully compiled and tested in-game.)

@JoshyDo

JoshyDo commented Sep 6, 2026

Copy link
Copy Markdown
Author

Footage from playtester confirming it works:

Dyson.Sphere.Program.-.2026-09-04.13-55-17.mp4

Uploading Dyson Sphere Program - 2026-09-04 14-08-05(1).mp4…

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.

1 participant