SDK reference
The Godot GDScript SDK (MultiplayerService autoload), v0.3.0.
Installation & configuration
- Copy
addons/multiplayer_serviceinto your project and enable the plugin. configure(public_key)thenconnect_to_server(url), orconnect_using_config()to use the editor-saved credentials.- Guest auth is automatic;
player_idis stable across reconnects.
Key methods
| Area | Methods |
|---|---|
| Connection | configure, connect_to_server, connect_using_config, disconnect_from_server |
| Rooms | create_room, join_room, leave_room, list_players |
| Lobbies | create_lobby, list_lobbies, join_lobby, join_lobby_by_id |
| Matchmaking | join_matchmaking, leave_matchmaking |
| Events | send_event |
| State sync | patch_room_state, set_entity_state, patch_entity_state, delete_entity_state |
| Debug | set_debug_enabled, get_ping_ms, create_debug_report, create_debug_report_string |
Signals
Connect to signals for every important event:
- Connection —
connected,disconnected,welcomed,authenticated,reconnecting,reconnected,reconnect_failed,connection_error. - Rooms —
room_created,room_joined,player_joined,player_left,room_players,room_expired. - Lobbies —
lobby_created,lobby_list,lobby_joined,lobby_closed. - Matchmaking —
matchmaking_queued,match_found,matchmaking_left,matchmaking_timeout. - Events —
event_received. - State sync —
state_snapshot_received,room_state_changed,entity_state_changed,entity_state_deleted,state_update_rejected. - Errors —
sdk_error(structured),error_received.
Error codes
| Code | Retryable | Meaning |
|---|---|---|
malformed_message | no | The message wasn't a valid envelope. |
unknown_message_type | no | Unrecognized message type. |
invalid_payload | no | A required field is missing/invalid. |
room_not_found | no | No such room/lobby, or it expired. |
room_full | no | The room/lobby hit its max players. |
payload_too_large | no | Message over the 16 KB limit. |
rate_limited | yes | Sending too fast; back off. |
state_forbidden | no | Not the entity owner / not the room host. |
entity_not_found | no | Patch/delete on a missing entity. |
state_limit_exceeded | no | Room hit its entity cap. |
state_too_large | no | State over the size cap. |
Reconnection
After an unexpected drop the SDK reconnects automatically with backoff, reusing the token to
resume the same player_id. A heartbeat timeout (default 45s) recovers half-open
links. Set rejoin_last_room_on_reconnect = true to re-join the last room by code.
disconnect_from_server() is treated as intentional and does not reconnect.
Debug reports
create_debug_report() returns a snapshot (SDK + Godot versions, connection/player
state, last errors, last 50 messages, ping). create_debug_report_string() gives
copyable JSON for the dashboard's debug bundle viewer.