Up to date
This page is up to date for Godot 4.3
.
If you still find outdated information, please open an issue.
AuthoritativeLobbyClient¶
Inherits: BlaziumClient < Node < Object
Node for connecting to the Blazium Lobby service. Offers authoritative lobby making features.
Description¶
The AuthoritativeLobbyClient node provides an interface for connecting to the Blazium Authoritative service. There is a free instance hosted on the blazium.app domain that is used by default.
The normal flow is as follows:
Listen to all the signals you are interested in.
Connect to the server using connect_to_lobby method.
Call any other methods to create, view or join lobbies, as well as add data to them.
Close the session using disconnect_from_lobby method at the end of the game.
Note: Some methods are non blocking and can be awaited in order to get the result.
There are also members on this class that are automatically updated as the lobby gets updated, such as:
peer: The current peer. Reflects changes to the self peer.
peers: The lobby peers. Reflects changes to all peers.
lobby: The lobby. Reflects changes to the lobby.
peer_data: The current peer private data.
Note: The main difference between this service and the non authoritative LobbyClient are:
The host cannot set any data or notify peer_disconnected.
The received_lobby_data signal doesn't have the
is_private
parameter.
Tutorials¶
Properties¶
|
||
|
||
|
||
|
||
|
||
|
Methods¶
add_lobby_tags(tags: Dictionary) |
|
create_lobby(title: String, tags: Dictionary = {}, max_players: int = 4, password: String = "") |
|
del_lobby_tags(keys: Array[String]) |
|
void |
|
is_host() |
|
join_lobby(lobby_id: String, password: String = "") |
|
list_lobbies(tags: Dictionary = {}, start: int = 0, count: int = 10) |
|
lobby_call(method: String, args: Array) |
|
send_chat_message(chat_message: String) |
|
set_lobby_ready(ready: bool) |
|
set_lobby_sealed(seal: bool) |
|
set_peer_name(peer_name: String) |
Signals¶
connected_to_lobby(peer: LobbyPeer, reconnection_token: String) 🔗
Signal generated after you connect to the lobby.
disconnected_from_lobby(reason: String) 🔗
Signal generated after you disconnect from the lobby.
lobby_created(lobby: LobbyInfo, peers: Array[LobbyPeer]) 🔗
Signal generated after a lobby is created.
lobby_joined(lobby: LobbyInfo, peers: Array[LobbyPeer]) 🔗
Signal generated after you joint a lobby.
Signal generated after you leave a lobby.
lobby_notified(data: Object) 🔗
Signal generated after a notification is received.
Signal generated after the host seals the lobby.
lobby_tagged(tags: Dictionary) 🔗
Signal generated after the host updated the tags of the lobby
log_updated(command: String, logs: String) 🔗
Signals a log from a command.
peer_disconnected(peer: LobbyPeer) 🔗
Signal generated after a peer disconnects. If they don't reconnect they will be removed.
peer_joined(peer: LobbyPeer) 🔗
Signal generated after a peer joins the lobby.
peer_left(peer: LobbyPeer, kicked: bool) 🔗
Signal generated after a peer leaves the lobby.
peer_messaged(peer: LobbyPeer, chat_message: String) 🔗
Signal generated after a peer sends a chat message.
Signal generated after a peer names himself.
peer_ready(peer: LobbyPeer, is_ready: bool) 🔗
Signal generated after a peer is ready.
peer_reconnected(peer: LobbyPeer) 🔗
Signal generated after a peer reconnects.
received_lobby_data(data: Object) 🔗
Signal generated after data is sent to the lobby.
received_peer_data(data: Object, to_peer: LobbyPeer, is_private: bool) 🔗
Signal generated after data is sent to peer.
Property Descriptions¶
bool get_connected()
True if the client is connected, else false.
The game id.
LobbyInfo get_lobby()
The current lobby. Reflects changes to the lobby.
LobbyPeer get_peer()
The current peer. Reflects changes to the self peer.
Dictionary peer_data = {}
🔗
Dictionary get_peer_data()
The current peer private data.
The lobby peers. Reflects changes to all peers.
String reconnection_token = ""
🔗
Reconnection token.
String server_url = "wss://authlobby.blazium.app/connect"
🔗
Set to what url this lobby should connect to.
Method Descriptions¶
LobbyResponse add_lobby_tags(tags: Dictionary) 🔗
Add tags to the lobby. Only works if you are host.
Returns a LobbyResponse object that has a LobbyResponse.finished signal that is emitted when finished.
Generates lobby_tagged.
Connect to a Blazium Lobby Server using the game_id and server_url.
Generates connected_to_lobby signal if successful.
ViewLobbyResponse create_lobby(title: String, tags: Dictionary = {}, max_players: int = 4, password: String = "") 🔗
Create a lobby and become host. If you are already in a lobby, you cannot create one. You need to leave first.
The new lobby can have a title, tags, max players and password. 0 max players means unlimited.
Returns a ViewLobbyResponse object that has a ViewLobbyResponse.finished signal that is emitted when finished.
Generates lobby_created signal.
LobbyResponse del_lobby_tags(keys: Array[String]) 🔗
Delete one or more keys from the lobby tags. Only works if you are host.
Returns a LobbyResponse object that has a LobbyResponse.finished signal that is emitted when finished.
Generates lobby_tagged.
void disconnect_from_lobby() 🔗
Disconnect from the lobby server.
Generates disconnected_from_lobby signal.
Returns true if you are the host of the current lobby.
ViewLobbyResponse join_lobby(lobby_id: String, password: String = "") 🔗
Join a lobby. If you are already in a lobby, you cannot join another one. You need to leave first.
If the lobby you want to join is password protected, you need to provide the password.
Returns a ViewLobbyResponse object that has a ViewLobbyResponse.finished signal that is emitted when finished.
Generates lobby_joined.
LobbyResponse kick_peer(peer_id: String) 🔗
Kick a peer. You need to be host to do so.
Returns a LobbyResponse object that has a LobbyResponse.finished signal that is emitted when finished.
Generates peer_left signal with kicked set to true.
LobbyResponse leave_lobby() 🔗
Leave a lobby. You need to be in a lobby to leave one.
Returns a LobbyResponse object that has a LobbyResponse.finished signal that is emitted when finished.
Generates lobby_left.
ListLobbyResponse list_lobbies(tags: Dictionary = {}, start: int = 0, count: int = 10) 🔗
Lists all lobbies. Lobbies that are sealed won't show in the list, except if you disconnected and trying to reconnect to a lobby.
AuthoritativeLobbyResponse lobby_call(method: String, args: Array) 🔗
Call a method on the server.
LobbyResponse send_chat_message(chat_message: String) 🔗
Send a chat message. Only works if you are in a lobby.
Returns a LobbyResponse object that has a LobbyResponse.finished signal that is emitted when finished.
Generates peer_messaged.
LobbyResponse set_lobby_ready(ready: bool) 🔗
Ready up in the lobby. You need to be in a lobby and unready to run this.
Returns a LobbyResponse object that has a LobbyResponse.finished signal that is emitted when finished.
Generates peer_ready.
LobbyResponse set_lobby_sealed(seal: bool) 🔗
Seals the lobby. You need to be the host to do this and the lobby needs to be unsealed.
Returns a LobbyResponse object that has a LobbyResponse.finished signal that is emitted when finished.
Generates lobby_sealed.
LobbyResponse set_peer_name(peer_name: String) 🔗
Set your peer name.
Returns a LobbyResponse object that has a LobbyResponse.finished signal that is emitted when finished.
Generates peer_named signal if you are in lobby.