Overview
Godot provides a comprehensive networking system for creating multiplayer games. The system is built aroundMultiplayerAPI for high-level multiplayer functionality and various peer implementations for different networking backends.
Godot’s multiplayer system uses a client-server architecture by default, where one peer acts as the authoritative server.
Multiplayer Architecture
Client-Server Model
Godot uses a client-server architecture where:- Server - Authoritative peer that manages game state (peer ID = 1)
- Clients - Connect to the server and send/receive updates
- Peer-to-Peer - All peers can communicate, but one is designated as server
MultiplayerAPI
TheMultiplayerAPI class provides high-level networking functionality:
Key Features
- RPC (Remote Procedure Calls) - Call functions on remote peers
- Automatic synchronization - Sync properties across network
- Connection management - Handle peer connections/disconnections
- Authority system - Control which peer owns which nodes
Basic Setup
RPC System
Remote Procedure Calls allow you to execute functions on other peers:Basic RPC
RPC Modes
RPC Configuration Options
Multiplayer Authority
Control which peer has authority over a node:MultiplayerPeer
TheMultiplayerPeer is the low-level networking backend:
Transfer Modes
Network Signals
Key signals for managing multiplayer connections:Getting Connected Peers
Best Practices
Use appropriate transfer modes
Use appropriate transfer modes
Use
reliable for critical events (damage, spawning) and unreliable for frequent updates (position, rotation).Minimize RPC calls
Minimize RPC calls
Batch data when possible and avoid calling RPCs every frame. Use property synchronization for frequently changing values.
Handle disconnections gracefully
Handle disconnections gracefully
Always implement proper cleanup when peers disconnect to avoid orphaned nodes and data.
Test with latency
Test with latency
Use network simulation tools to test your game with realistic latency and packet loss.
See Also
High-Level Multiplayer
Learn about spawning and synchronization
Low-Level Networking
Understand ENet and WebSocket implementations
HTTP Requests
Make HTTP/REST API calls