NEVER Do (Expert Networking Rules)
Core Architecture
- NEVER use
Reliablefor high-frequency data (Position/Movement) β Reliable packets block all following packets until acknowledged (Head-of-Line blocking). UseUnreliableOrdered. - NEVER trust the client for shared state (Health/Money/Inventory) β Clients should only suggest actions. The Server MUST validate and broadcast the result.
- NEVER hardcode the Server IP β Always allow for discovery (
net_lan_discovery.gd) or pass the IP via CLI/UI.
Performance & Bandwidth
- NEVER send the same data every frame β Use
net_adaptive_sync_throttle.gdto only send updates when state changes significantly or at fixed Hz intervals (e.g., 20Hz). - NEVER use
JSONfor high-speed synchronization β String serialization is massive over the wire. Use bit-packing (net_packet_bit_packer.gd) to keep packets under 100 bytes. - NEVER broadcast to all peers if it's not needed β In large worlds, use Interest Management (
net_visibility_grid_culling.gd). A player in the forest doesn't need the position of a player in the city.
Security
- NEVER allow unlimited RPC calls per second β An attacker can flood the server with 1,000 "Attack" RPCs to crash the game. Use
net_packet_rate_limiter.gd. - NEVER expose PeerIDs to the end-user β PeerIDs are internal. Always map them to persistent
UserIDs(net_custom_id_mapper.gd) from a database. - NEVER run a dedicated server with a GUI enabled β Use
--headless(net_headless_server_auto_start.gd) to save resources and ensure stability.
Decision Tree (transport / authority / sync Hz)
| Question | Prefer | Script |
|---|---|---|
| Desktop/console LAN or dedicated UDP | ENet | MANDATORY net_enet_expert_config.gd |
| Browser / NAT-hostile peers | WebRTC (or WebSocket fallback) | Official Docs + peer wrappers; still use secure RPC scripts |
| Who owns gameplay truth? | Server-authoritative | MANDATORY server_authoritative_controller.gd |
| Dedicated host without GUI | --headless |
MANDATORY net_headless_server_auto_start.gd / server_dedicated_host.gd |
| Position @ 10β20 Hz, not every frame | Adaptive throttle | MANDATORY net_adaptive_sync_throttle.gd |
Do NOT Load lobby/RPC beginner recipes from memory β use the golden path below and open only matching scripts.
Golden Path
- Host / dedicated β server_dedicated_host.gd + net_headless_server_auto_start.gd; clients β client_network_setup.gd.
- Secure RPC β secured_rpc_pattern.gd + net_packet_rate_limiter.gd + secure_variable_synchronizer.gd.
- Prediction / reconcile β client_prediction_synchronizer.gd + net_anti_desync_reconciler.gd; fighting/rollback β net_rollback_helper.gd.
- Interest culling β net_visibility_grid_culling.gd before broadcasting positions.
Available Scripts
Transport & host
- net_enet_expert_config.gd β channels, compression, bandwidth.
- net_headless_server_auto_start.gd β CLI/
--headlessdetect. - server_dedicated_host.gd β dedicated host bootstrap.
- client_network_setup.gd β client peer join.
- net_lan_discovery.gd β UDP LAN discovery.
- network_error_handler.gd β disconnect/error routing.
- packet_peer_latency_test.gd β latency probes.
- net_heartbeat_monitor.gd β RTT/jitter.
Authority, RPC, sync
- server_authoritative_controller.gd β server validates actions.
- secured_rpc_pattern.gd β safe RPC annotations/patterns.
- secure_variable_synchronizer.gd β server-owned vars.
- net_packet_rate_limiter.gd β flood protection.
- net_packet_bit_packer.gd β compact payloads (no JSON on hot path).
- net_adaptive_sync_throttle.gd β Hz / change-threshold sync.
- game_state_sync_manager.gd β snapshot/state sync.
- multiplayer_spawner_manager.gd β spawn authority.
- network_input_synchronizer.gd β input frames to server.
- networked_interpolator.gd β remote entity smoothing.
- net_custom_id_mapper.gd β UserID β PeerID.
Desync / rollback / interest
- client_prediction_synchronizer.gd β predict + correct.
- net_anti_desync_reconciler.gd β forced correction.
- net_rollback_helper.gd β snapshot re-sim helper.
- net_visibility_grid_culling.gd β interest management.
Expert Pointers
- Position/movement:
UnreliableOrdered+ throttle β never reliable every frame. - Clients suggest; server validates and broadcasts results.
- Large worlds: cull with visibility grid before adding more sync Hz.
Deep dives (on demand)
- RPC modes, lobby handshake, puppet interpolation β rpc-lobby-and-sync.md
- Delta-compression + network simulator concepts live in that reference (LLM-ignorance: unreliable vs reliable HoL blocking is NOT generic knowledge).
Reference
Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain β do not preload the whole lattice.
Official Documentation
- High-level multiplayer β RPC modes, authority, and peer lifecycle for host/join lobbies and server-validated actions.
- Networking β Transport map (ENet / WebSocket / WebRTC / HTTP) so peer choice matches platform and NAT constraints.
- MultiplayerAPI β
multiplayersingleton: peer IDs, connection signals, andrpc/rpc_identry points. - MultiplayerPeer β Transfer modes (reliable / unreliable / unordered) and connection status shared by every backend.
- ENetMultiplayerPeer β UDP host/client peer used for LAN, dedicated servers, and most action games.
- SceneMultiplayer β Default MultiplayerAPI: root path, auth callbacks, and scene-tree RPC routing.
- MultiplayerSpawner β Spawn/despawn replication so late joiners share the same networked scene graph.
- MultiplayerSynchronizer β Property replication, on-change deltas, and visibility filters that replace ad-hoc position RPCs.
- Node β
set_multiplayer_authority/is_multiplayer_authorityownership rules for input vs shared state. - PacketPeerUDP β Raw UDP send/receive for LAN discovery broadcasts outside the high-level multiplayer peer.
- WebRTC β Browser-friendly P2P path when ENet UDP cannot punch through firewalls alone.
- Command line tutorial β
--headlessand CLI flags for dedicated-server launches and multi-instance tests.
Related Skills
Prerequisites
- godot-project-foundations β Project layout, Autoloads, and export/feature flags that host/join and dedicated-server builds depend on.
- godot-gdscript-mastery β Typed
@rpcannotations, Callables, and PackedByteArray patterns used by secure RPCs and bit-packers. - godot-input-handling β Split InputMap reads from simulation so clients send intents and the authority owns outcomes.
Complements
- godot-adapt-single-to-multiplayer β Migration shape (authority split, prediction shells) before applying this skillβs lobby/RPC/ENet toolkit.
- godot-autoload-architecture β Session/lobby Autoloads that outlive scene changes during host/join and reconnect flows.
- godot-signal-architecture β Local peer-connected / lobby events that stay decoupled from transport RPCs.
- godot-server-architecture β Headless host scaffolding and PhysicsServer/RID patterns used by authoritative simulation.
- godot-export-builds β Dedicated-server export presets and CLI packaging for real multi-instance tests.
- godot-debugging-profiling β RTT/jitter overlays and remote debug habits that catch sync bugs localhost never shows.
- godot-save-load-systems β Persist UserIDs, lobby prefs, and reconnect tokens without treating PeerIDs as durable identity.
Downstream / consumers
- godot-performance-optimization β Cap replication Hz and interest culling when bandwidth/CPU budgets break under peer load.
- godot-monte-carlo-balancer β Retune economy/TTK after netcode changes alter effective weapon timings or ability windows.
- godot-genre-battle-royale β Large-peer interest management and late-join snapshots at BR scale.
- godot-genre-moba β Fixed-tick authority, ability RPCs, and spectator-safe state sync for multiplayer arenas.
Master
- godot-master β Library router and mirrored module entry; open when discovering which Domain Skill owns a cross-cutting networking concern.