godot-multiplayer
gamedev-skills/awesome-gamedev-agent-skills
Build networked Godot 4.7 games with ENet, RPCs, and state replication.
What is godot-multiplayer?
Set up multiplayer servers/clients using ENetMultiplayerPeer, define remote functions with @rpc annotations, assign per-node authority, and replicate state via MultiplayerSpawner and MultiplayerSynchronizer. Use this when adding networking to a Godot project, implementing client-server communication, or syncing player and world state across peers.
- Create ENet multiplayer servers and clients with configurable ports and player limits
- Define and call remote functions (RPCs) with @rpc annotations, routing to all peers or specific peer IDs
- Assign per-node multiplayer authority to control which peer can modify each node's state
- Automatically spawn and synchronize nodes across peers using MultiplayerSpawner and MultiplayerSynchronizer
- Handle connection lifecycle events (peer_connected, peer_disconnected, connection_failed, server_disconnected)
- Validate client input on the server and broadcast authoritative results to all clients
How to install godot-multiplayer
npx skills add https://github.com/gamedev-skills/awesome-gamedev-agent-skills --skill godot-multiplayer- Godot 4.7 or compatible 4.x version
- Basic understanding of Godot nodes, scenes, and GDScript
- Familiarity with game loops and input handling
How to use godot-multiplayer
- 1.Create an ENetMultiplayerPeer and call create_server() or create_client(), then assign it to multiplayer.multiplayer_peer
- 2.Connect to multiplayer signals (peer_connected, peer_disconnected, connected_to_server) to handle join/leave events
- 3.Define RPC methods using @rpc annotations with parameters like 'any_peer', 'authority', and 'call_local'
- 4.Call RPCs via rpc() for all peers or rpc_id(peer_id) for a specific peer; use multiplayer.get_remote_sender_id() to identify the caller
- 5.Assign multiplayer authority per node with set_multiplayer_authority(id) and gate input/logic with is_multiplayer_authority()
- 6.Add MultiplayerSynchronizer children to nodes and configure which properties to replicate (position, velocity, etc.) in the editor
- 7.Validate all client input on the server before applying state changes or broadcasting results to other peers
Use cases
- Hosting a multiplayer game server and having clients join over ENet with automatic peer ID assignment
- Implementing player input: clients send fire/move requests as RPCs to the server for validation and broadcast
- Syncing avatar positions and velocities across all players using MultiplayerSynchronizer properties
- Spawning networked objects (projectiles, items) on all peers when triggered by server-validated events
- Building a dedicated headless server that manages game state and validates all client actions
- Game developers building multiplayer games in Godot 4.x
- Programmers implementing client-server networking and RPC communication
- Teams creating competitive or cooperative multiplayer experiences
- Developers migrating from single-player to networked Godot projects
godot-multiplayer FAQ
@rpc('authority') (the default) means only the node's authority (owner) can call it; clients calling it are ignored. @rpc('any_peer') allows any peer to call it, typically used for client-to-server requests like input validation.
RPC signatures must match exactly across all peers—Godot checksums all @rpc methods in a script. If the set of @rpc methods or their annotations differ between client and server builds, routing breaks. Ensure every peer has identical @rpc declarations.
Always validate client input on the server before applying state changes. Clients send intent (e.g., 'fire' request), the server validates it (can the player afford it? is it in range?), and then broadcasts the authoritative result to all peers. Never trust client-reported positions or results.
No, RPCs and MultiplayerSynchronizer only serialize primitive data types (int, float, string, Vector2, etc.), arrays, and dictionaries. For complex objects, send their data as primitives and reconstruct them on the receiving end.
Set multiplayer.multiplayer_peer = OfflineMultiplayerPeer.new() to reset the peer and disconnect. This will trigger peer_disconnected signals on all remaining peers.
Full instructions (SKILL.md)
Source of truth, from gamedev-skills/awesome-gamedev-agent-skills.
name: godot-multiplayer description: > Build networked games with Godot 4.7 high-level multiplayer: set up an ENetMultiplayerPeer server/client, define RPCs with the @rpc annotation (call via rpc()/rpc_id()), set per-node multiplayer authority, and replicate state with MultiplayerSpawner and MultiplayerSynchronizer. Use when adding multiplayer/networking to a Godot project, writing @rpc functions, or syncing player/world state across peers.
Godot Multiplayer (4.x high-level)
Connect peers, call functions remotely with @rpc, assign authority, and replicate state
with MultiplayerSpawner/MultiplayerSynchronizer. Targets Godot 4.7 (ENet). Treat
all client input as untrusted; keep the server authoritative.
When to use
- Use when adding networked multiplayer: hosting/joining over ENet, calling RPCs, assigning per-node authority, or auto-spawning/syncing nodes across peers.
When not to use: local split-screen (no networking); raw TCP/UDP/WebSocket protocol
work (low-level PacketPeer); HTTP requests. For save/persistence → save-systems.
Core workflow
- Create a peer (
ENetMultiplayerPeer), callcreate_server(port, max)orcreate_client(ip, port), and assign it tomultiplayer.multiplayer_peer. The server's unique ID is always1; clients get random positive IDs. - Handle connection signals on
multiplayer:peer_connected(id),peer_disconnected(id),connected_to_server,connection_failed,server_disconnected. - Define RPCs with
@rpc(...). Call them on aCallableviarpc()(all peers) orrpc_id(peer_id)(one peer). Inside,multiplayer.get_remote_sender_id()tells you who sent it. - Keep RPC signatures identical on every peer that runs the script — Godot checksums
all
@rpcmethods in a script; mismatches break silently. - Assign authority per node with
set_multiplayer_authority(id); gate input/RPCs byis_multiplayer_authority(). - Replicate state with
MultiplayerSpawner(auto-instances scenes on clients) andMultiplayerSynchronizer(auto-syncs selected properties). - Validate on the server. Don't trust client-reported positions/results.
Patterns
1. Host or join (ENet)
const PORT := 7000
const MAX_PLAYERS := 8
func host() -> void:
var peer := ENetMultiplayerPeer.new()
var err := peer.create_server(PORT, MAX_PLAYERS)
if err != OK:
push_error("Cannot host: %s" % err); return
multiplayer.multiplayer_peer = peer
multiplayer.peer_connected.connect(_on_peer_connected)
func join(ip := "127.0.0.1") -> void:
var peer := ENetMultiplayerPeer.new()
peer.create_client(ip, PORT)
multiplayer.multiplayer_peer = peer
multiplayer.connected_to_server.connect(func(): print("connected"))
func leave() -> void:
multiplayer.multiplayer_peer = OfflineMultiplayerPeer.new()
2. RPCs: client sends input to the server (any_peer, call_local)
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("fire") and is_multiplayer_authority():
request_fire.rpc_id(1) # send only to the server (id 1)
# Clients may call this; it runs on the server (and locally if server is a player).
@rpc("any_peer", "call_local", "reliable")
func request_fire() -> void:
var sender := multiplayer.get_remote_sender_id()
if not _can_fire(sender): # server-side validation
return
spawn_projectile.rpc(sender) # tell everyone to spawn it
@rpc("authority", "call_local", "reliable")
func spawn_projectile(owner_id: int) -> void:
_do_spawn(owner_id)
3. Per-node authority (each player controls their own avatar)
extends CharacterBody2D
func _ready() -> void:
# The node name is the owning peer's id; that peer is the authority.
set_multiplayer_authority(name.to_int())
func _physics_process(delta: float) -> void:
if not is_multiplayer_authority():
return # only the owner reads input & moves
velocity = Input.get_vector("left", "right", "up", "down") * 200.0
move_and_slide()
4. MultiplayerSynchronizer config (editor + replication)
# Add a MultiplayerSynchronizer child; in its Replication editor add the properties to
# sync (e.g. position, velocity). Set "Sync"/"Spawn" flags per property. From code you
# can scope visibility:
@onready var sync: MultiplayerSynchronizer = $MultiplayerSynchronizer
func _ready() -> void:
# Only replicate this node to a specific peer (e.g. private info).
sync.set_visibility_for(target_peer_id, true)
Pitfalls
- RPC signature checksum. Every
@rpcmethod in a script must exist with the same declaration on both client and server builds — even unused ones. A mismatch causes errors that may point at the wrong function. Argument names/count are not checked, but the set of RPCs and their annotations are. - Default
@rpcis"authority". Clients calling it are ignored unless you set"any_peer". Use"call_local"so the host (also a player) runs it too. - NodePaths must match across peers. RPC routing uses the node's path/name; spawn nodes
with identical names on all peers (use
MultiplayerSpawneroradd_child(node, true)for readable, deterministic names). - Trusting the client. Never let clients set authoritative state (health, position, hits) directly. Send intent, validate on the server, then broadcast results.
- RPC on non-Node classes fails.
@rpcmethods must be onNode-derived classes, not plainResource/RefCounted. - RPCs don't serialize Objects/Callables. Pass plain data (ints, strings, arrays, dictionaries, PackedArrays).
- Forgetting to reset the peer. To disconnect cleanly, set
multiplayer.multiplayer_peer = OfflineMultiplayerPeer.new(). - Android needs INTERNET permission in the export preset or all networking is blocked.
References
- For
MultiplayerSpawnersetup, transfer modes/channels,SceneMultiplayerauthentication (auth_callback/complete_auth), a lobby skeleton, and dedicated-server export notes, readreferences/replication-and-rpc.md.
Related skills
godot-nodes-scenes— instancing the scenes that get spawned/synced.godot-signals-groups— connection signals and event flow.godot-export— exporting a headless dedicated server build.
Related skills
More from gamedev-skills/awesome-gamedev-agent-skills and the wider catalog.

godot-nodes-scenes
Structure Godot 4.x games with scenes, nodes, and runtime instancing.

godot-physics
Configure Godot 4.x physics bodies, collision layers/masks, overlap detection, and raycasts in 2D and 3D.

godot-resources
Design data-driven Godot 4.7 games with custom Resource classes and .tres/.res files.

godot-shaders
Write Godot 4.7 shaders (2D canvas_item and 3D spatial) with uniforms, TIME animation, and screen-reading.

godot-signals-groups
Decouple Godot 4.x gameplay with signals and node groups instead of hard-coded references.

godot-tilemap
Build and edit tile-based 2D levels in Godot 4.7 with TileMapLayer, collision, terrains, and runtime cell manipulation.