Skip to content

GECS v9.3.4: Network spawn signals

Latest

Choose a tag to compare

@csprance csprance released this 19 Sep 00:48

GECS v9.3.4: Network spawn signals

A small networking bugfix release. If you use GECS Network and rely on NetworkSync.entity_spawned or NetworkSync.local_player_spawned, you want this one.

Fixed

entity_spawned and local_player_spawned now actually fire.

Both signals were declared on NetworkSync, covered in the docs, and connected in the network example, but the code that emitted them was lost during the Network v2 rewrite. Connecting to them was legal and silent, so your callback just never ran. This has been the case since v7.0.0.

They now work the way the docs describe, on every peer:

  • Clients get entity_spawned after a spawn payload is applied, including each entity in the late-join world state.
  • The host gets entity_spawned right before it broadcasts the spawn, so you no longer need separate host-side code.
  • local_player_spawned fires right after entity_spawned when the entity is a player owned by the local peer (host included). Server-owned entities (peer_id == 0) never trigger it.
  • By the time either signal fires, component data, CN_LocalAuthority / CN_ServerAuthority markers, and relationships are already on the entity.
  • No emit for updates to an entity that already exists, payloads from a stale session, or entities added and removed in the same frame.
network_sync.entity_spawned.connect(_on_entity_spawned)
network_sync.local_player_spawned.connect(_on_local_player_spawned)

If you patched SpawnManager.handle_spawn_entity() locally to emit these yourself, remove the patch when you upgrade or your handlers will run twice.

Doc correction for Entity.relationships_batch_removed.

The doc comment said this signal fires from remove_relationships(). It has not been emitted since v8.0.0. Connect to relationship_removed instead, which fires once per removed relationship. The signal itself is still declared, so existing code keeps compiling.

Tests

  • New test_network_sync_signals.gd runs a real NetworkSync node as both client and host and checks every case listed above.
  • A new source scan fails the suite if any signal under addons/gecs is declared but never emitted, so this kind of bug can't come back quietly.

Upgrading

No breaking changes and no migration steps from 9.3.x.

Thanks to raydenuni for the report.

Full Changelog: v9.3.3...v9.3.4