godot-multiplayer
O que ela faz
Esta skill mostra como adicionar multijogador em rede a um jogo do Godot 4 usando conexões ENet e ferramentas de sincronização embutidas. Ela é para desenvolvedores que criam jogos online no Godot.
Quando usar
- ✓Quando você quer adicionar hospedagem ou entrada em partidas multijogador a um jogo do Godot.
- ✓Quando você precisa de chamadas de função remotas, chamadas RPC, entre jogadores no Godot.
- ✓Quando quer que o estado dos jogadores ou do mundo fique sincronizado em vários computadores.
Link da skill
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/godot/godot-multiplayer/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Me ajude a deixar meu jogo do Godot jogável online para que dois amigos possam entrar na mesma partida.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
Ela explica como criar um servidor e clientes, definir chamadas remotas com anotações, atribuir quem controla cada objeto e sincronizar objetos criados e o estado entre os pares.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
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; a mismatch prints errors that can name an unrelated RPC. - 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)
This script sits on a player avatar whose authority is the owning client (Pattern 3), so
the server is not the node's authority. A server→clients RPC on such a node must be
"any_peer" and check that the sender is the server.
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:
if not multiplayer.is_server(): # ignore copies relayed to other clients
return
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
# "authority" here would make clients reject the server's call (the client is the
# authority), so accept any peer and keep only calls that come from the server.
@rpc("any_peer", "call_local", "reliable")
func spawn_projectile(owner_id: int) -> void:
if multiplayer.get_remote_sender_id() != 1:
return
_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"/"Sp
Perguntas frequentes
O servidor controla o jogo?
A skill diz para manter o servidor no comando dos resultados do jogo e tratar toda entrada dos clientes como não confiável.
Isso cobre jogo local em tela dividida?
Não. Jogo local sem rede está fora desta skill.
Ela cobre o salvamento de progresso?
Não. O salvamento é tratado por uma skill de save separada.
Detalhes
Descrição original do autor
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.
Popularidade
- Estrelas no GitHub
- 6,6 mil
- Posição no ranking
- #13824
- Licença
- Apache-2.0
- Atualizada em
- 28/10/2026
Comentários
- …
Mais skills deste repositório
router
6,6 milAjuda seu agente a escolher a skill certa de desenvolvimento de jogos para cada pedido, detectando sua engine e o tipo de tarefa que você precisa.
ai-behavior-trees-utility-ai
6,6 milAjuda seu agente a criar uma árvore de comportamento e um sistema de IA por utilidade para inimigos e personagens que escolhem ações por prioridade e pontuação.
audio-design
6,6 milEnsina seu agente a fazer a mixagem de áudio de jogos: barramentos, volume em decibéis, redução de volume sob diálogos, música adaptativa e variação de efeitos sonoros.
camera-systems
6,6 milAjuda seu agente a criar câmeras de jogo que seguem o personagem com suavidade, ficam dentro da fase e giram ou olham ao redor em 3D.
Skills parecidas
diffs
394 milPermite que seu agente gere um diff real e compartilhável das edições, como link de visualização ou arquivo de imagem, em vez de um resumo escrito à mão.
coding-agent
394 milAjuda seu agente a passar um trabalho grande de programação para o Codex, Claude Code ou OpenCode em segundo plano e acompanhar o andamento.
gh-issues
394 milAjuda seu agente a encontrar issues do GitHub, escolher quais resolver e abrir pull requests com correções, acompanhando os comentários de revisão.