Skip to content

Fix example network client disconnect cleanup & CN_NetworkIdentity typo#10

Merged
Donach merged 2 commits into
mainfrom
fix/network-example-cleanup-101370867382778011
Mar 3, 2026
Merged

Fix example network client disconnect cleanup & CN_NetworkIdentity typo#10
Donach merged 2 commits into
mainfrom
fix/network-example-cleanup-101370867382778011

Conversation

@Donach

@Donach Donach commented Mar 2, 2026

Copy link
Copy Markdown

This PR fixes an issue where the example_network project was not properly cleaning up network entities when clients disconnected.

Changes

  1. Component Typo Fix: Replaced C_NetworkIdentity with CN_NetworkIdentity across e_player.gd, e_projectile.gd, example_sync_config.gd, and the README.md. This typo was silently breaking the network addon's native logic because it relied on CN_NetworkIdentity to process broadcast despawns properly when a peer disconnects.
  2. Client Cleanup Fix: Modified _cleanup_network() in example_network/main.gd. Previously, it iterated over _spawned_peer_ids to clean up entities. Since that dictionary was only populated on the Server, clients were skipping the loop and leaving all networked entities behind as "ghosts" in the ECS world. It now duplicates and iterates over all world.entities to ensure complete cleanup on both server and clients upon disconnect.

PR created automatically by Jules for task 101370867382778011 started by @Donach

- Replaced references to `C_NetworkIdentity` with `CN_NetworkIdentity` in `example_network` components and configurations to correctly utilize the GECS Network addon's logic.
- Modified `example_network/main.gd`'s `_cleanup_network` function to completely purge all ECS entities unconditionally instead of looping over the server-only `_spawned_peer_ids` array, fixing a bug where clients would permanently retain network entities after manually disconnecting.

Co-authored-by: Donach <39565367+Donach@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- Updated PR_DESCRIPTION, README, and example scripts to reflect recent renaming of network components (e.g., C_SyncEntity → CN_SyncEntity, C_LocalAuthority → CN_LocalAuthority).
- Ensures alignment with the updated naming conventions introduced in the core network system.
@Donach Donach marked this pull request as ready for review March 3, 2026 06:36
@Donach Donach merged commit e64dd06 into main Mar 3, 2026
@Donach Donach deleted the fix/network-example-cleanup-101370867382778011 branch March 3, 2026 06:36
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