SDK reference

SDK reference

The Godot GDScript SDK (MultiplayerService autoload), v0.3.0.

Installation & configuration

  • Copy addons/multiplayer_service into your project and enable the plugin.
  • configure(public_key) then connect_to_server(url), or connect_using_config() to use the editor-saved credentials.
  • Guest auth is automatic; player_id is stable across reconnects.

Key methods

AreaMethods
Connectionconfigure, connect_to_server, connect_using_config, disconnect_from_server
Roomscreate_room, join_room, leave_room, list_players
Lobbiescreate_lobby, list_lobbies, join_lobby, join_lobby_by_id
Matchmakingjoin_matchmaking, leave_matchmaking
Eventssend_event
State syncpatch_room_state, set_entity_state, patch_entity_state, delete_entity_state
Debugset_debug_enabled, get_ping_ms, create_debug_report, create_debug_report_string

Signals

Connect to signals for every important event:

  • Connectionconnected, disconnected, welcomed, authenticated, reconnecting, reconnected, reconnect_failed, connection_error.
  • Roomsroom_created, room_joined, player_joined, player_left, room_players, room_expired.
  • Lobbieslobby_created, lobby_list, lobby_joined, lobby_closed.
  • Matchmakingmatchmaking_queued, match_found, matchmaking_left, matchmaking_timeout.
  • Eventsevent_received.
  • State syncstate_snapshot_received, room_state_changed, entity_state_changed, entity_state_deleted, state_update_rejected.
  • Errorssdk_error (structured), error_received.

Error codes

CodeRetryableMeaning
malformed_messagenoThe message wasn't a valid envelope.
unknown_message_typenoUnrecognized message type.
invalid_payloadnoA required field is missing/invalid.
room_not_foundnoNo such room/lobby, or it expired.
room_fullnoThe room/lobby hit its max players.
payload_too_largenoMessage over the 16 KB limit.
rate_limitedyesSending too fast; back off.
state_forbiddennoNot the entity owner / not the room host.
entity_not_foundnoPatch/delete on a missing entity.
state_limit_exceedednoRoom hit its entity cap.
state_too_largenoState 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.