Skip to content

Commit 8af4cd0

Browse files
committed
refactor(example): rename components to CN_ prefix in example code
- 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.
1 parent a29221e commit 8af4cd0

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

PR_DESCRIPTION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ func _init() -> void:
7575

7676
### Components
7777
- `C_NetworkIdentity` - Authority and ownership tracking
78-
- `C_SyncEntity` - Enables continuous synchronization
79-
- `C_LocalAuthority` - Marker for locally controlled entities
78+
- `CN_SyncEntity` - Enables continuous synchronization
79+
- `CN_LocalAuthority` - Marker for locally controlled entities
8080
- `C_RemoteEntity` - Marker for remotely controlled entities
8181
- `C_ServerOwned` - Marker for server-owned entities
8282

example_network/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ A minimal multiplayer example demonstrating the GECS Network addon's two synchro
55
## Features Demonstrated
66

77
### 1. Continuous Sync (Players)
8-
Players use `C_SyncEntity` which enables Godot's native `MultiplayerSynchronizer` for real-time position updates.
8+
Players use `CN_SyncEntity` which enables Godot's native `MultiplayerSynchronizer` for real-time position updates.
99

1010
```gdscript
1111
# e_player.gd
1212
func define_components() -> Array:
1313
return [
1414
C_NetVelocity.new(),
1515
C_PlayerInput.new(),
16-
C_SyncEntity.new(true, true, false), # sync position + rotation
16+
CN_SyncEntity.new(true, true, false), # sync position + rotation
1717
]
1818
```
1919

2020
### 2. Spawn-Only Sync (Projectiles)
21-
Projectiles do NOT have `C_SyncEntity`. The server spawns them and broadcasts component values once - then all clients simulate locally.
21+
Projectiles do NOT have `CN_SyncEntity`. The server spawns them and broadcasts component values once - then all clients simulate locally.
2222

2323
```gdscript
2424
# e_projectile.gd
@@ -28,7 +28,7 @@ func define_components() -> Array:
2828
C_Projectile.new(),
2929
C_NetVelocity.new(),
3030
C_NetPosition.new(), # Position synced at spawn
31-
# NO C_SyncEntity - spawn-only pattern
31+
# NO CN_SyncEntity - spawn-only pattern
3232
]
3333
```
3434

@@ -89,9 +89,9 @@ projectile.get_component(C_Projectile).projectile_color = color
8989

9090
### Local-Only Movement (Continuous Sync)
9191
```gdscript
92-
# s_movement.gd - Query with C_LocalAuthority
92+
# s_movement.gd - Query with CN_LocalAuthority
9393
func query() -> QueryBuilder:
94-
return q.with_all([C_NetVelocity, C_PlayerInput, C_LocalAuthority])...
94+
return q.with_all([C_NetVelocity, C_PlayerInput, CN_LocalAuthority])...
9595
```
9696

9797
### Middleware Visual Setup

example_network/entities/e_player.gd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class_name E_NetworkPlayer
22
extends Entity
33
## Player entity for the network example.
4-
## Demonstrates continuous sync via C_SyncEntity.
4+
## Demonstrates continuous sync via CN_SyncEntity.
55

66
## Peer ID that owns this player (set by main.gd when spawning)
77
@export var owner_peer_id: int = 0
@@ -25,6 +25,6 @@ func define_components() -> Array:
2525
C_NetVelocity.new(),
2626
C_PlayerInput.new(),
2727
C_PlayerNumber.new(), # Join order number (1-4) for color assignment
28-
# C_SyncEntity enables native MultiplayerSynchronizer for position/rotation
29-
C_SyncEntity.new(true, true, false), # sync_position=true, sync_rotation=true
28+
# CN_SyncEntity enables native MultiplayerSynchronizer for position/rotation
29+
CN_SyncEntity.new(true, true, false), # sync_position=true, sync_rotation=true
3030
]

example_network/entities/e_projectile.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class_name E_NetworkProjectile
22
extends Entity
33
## Projectile entity for the network example.
4-
## Demonstrates spawn-only sync - NO C_SyncEntity means server broadcasts
4+
## Demonstrates spawn-only sync - NO CN_SyncEntity means server broadcasts
55
## spawn data once, then all clients simulate locally.
66

77

@@ -12,7 +12,7 @@ func define_components() -> Array:
1212
C_Projectile.new(),
1313
C_NetVelocity.new(),
1414
C_NetPosition.new(), # Position synced at spawn
15-
# NOTE: No C_SyncEntity! This enables spawn-only sync pattern.
15+
# NOTE: No CN_SyncEntity! This enables spawn-only sync pattern.
1616
# Server spawns and broadcasts component values at spawn time.
1717
# Clients receive spawn RPC and simulate locally from there.
1818
]

example_network/systems/s_input.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
class_name S_NetworkInput
22
extends System
33
## Input system - reads keyboard input, updates C_PlayerInput.
4-
## Only processes local player (entities with C_LocalAuthority).
4+
## Only processes local player (entities with CN_LocalAuthority).
55

66

77
func query() -> QueryBuilder:
88
# Only process entities we have local control over
9-
return q.with_all([C_PlayerInput, C_LocalAuthority]).iterate([C_PlayerInput])
9+
return q.with_all([C_PlayerInput, CN_LocalAuthority]).iterate([C_PlayerInput])
1010

1111

1212
func process(entities: Array[Entity], components: Array, delta: float) -> void:

example_network/systems/s_movement.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class_name S_NetworkMovement
22
extends System
33
## Movement system - applies velocity to entity position.
4-
## Processes entities with C_LocalAuthority (local simulation).
4+
## Processes entities with CN_LocalAuthority (local simulation).
55
## Remote entities receive position updates via native MultiplayerSynchronizer.
66

77
const MOVE_SPEED := 5.0
@@ -10,7 +10,7 @@ const ARENA_BOUND := 4.5 # Half of 10x10 arena minus player size
1010

1111
func query() -> QueryBuilder:
1212
# Only move local entities - remote positions come from network sync
13-
return q.with_all([C_NetVelocity, C_PlayerInput, C_LocalAuthority]).iterate([C_NetVelocity, C_PlayerInput])
13+
return q.with_all([C_NetVelocity, C_PlayerInput, CN_LocalAuthority]).iterate([C_NetVelocity, C_PlayerInput])
1414

1515

1616
func process(entities: Array[Entity], components: Array, delta: float) -> void:

project.godot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ config/name="GECS"
1414
config/description="Godot Entity Component System - Example project and testing suite"
1515
config/version="5.0.0"
1616
run/main_scene="uid://x5ubiio43y7w"
17-
config/features=PackedStringArray("4.6", "Forward Plus")
17+
config/features=PackedStringArray("4.5", "Forward Plus")
1818

1919
[audio]
2020

0 commit comments

Comments
 (0)