forked from godotengine/godot
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from Ughuuu/update-authoritative-client
Update authoritative client
- Loading branch information
Showing
16 changed files
with
1,657 additions
and
372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
292 changes: 287 additions & 5 deletions
292
modules/blazium_sdk/doc_classes/AuthoritativeClient.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,306 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="AuthoritativeClient" inherits="LobbyClient" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> | ||
<class name="AuthoritativeClient" inherits="BlaziumClient" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> | ||
<brief_description> | ||
A lobby client that is authoritative. | ||
Node for connecting to the Blazium Lobby service. Offers authoritative lobby making features. | ||
</brief_description> | ||
<description> | ||
A lobby client that is authoritative. | ||
The [AuthoritativeClient] node provides an interface for connecting to the Blazium Authoritative service. There is a free instance hosted on the [url=https://blazium.app]blazium.app[/url] domain that is used by default. | ||
The normal flow is as follows: | ||
1. Listen to all the signals you are interested in. | ||
2. Connect to the server using [method connect_to_lobby] method. | ||
3. Call any other methods to create, view or join lobbies, as well as add data to them. | ||
4. Close the session using [method disconnect_from_lobby] method at the end of the game. | ||
[b]Note:[/b] 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: | ||
- [member peer]: The current peer. Reflects changes to the self peer. | ||
- [member peers]: The lobby peers. Reflects changes to all peers. | ||
- [member lobby]: The lobby. Reflects changes to the lobby. | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
<methods> | ||
<method name="add_lobby_tags"> | ||
<return type="LobbyResponse" /> | ||
<param index="0" name="tags" type="Dictionary" /> | ||
<description> | ||
Add tags to the lobby. Only works if you are host. | ||
Returns a [LobbyResponse] object that has a [signal LobbyResponse.finished] signal that is emitted when finished. | ||
Generates [signal lobby_tagged]. | ||
</description> | ||
</method> | ||
<method name="connect_to_lobby"> | ||
<return type="bool" /> | ||
<description> | ||
Connect to a Blazium Lobby Server using the [member game_id] and [member server_url]. | ||
Generates [signal connected_to_lobby] signal if successful. | ||
</description> | ||
</method> | ||
<method name="create_lobby"> | ||
<return type="ViewLobbyResponse" /> | ||
<param index="0" name="title" type="String" /> | ||
<param index="1" name="tags" type="Dictionary" default="{}" /> | ||
<param index="2" name="max_players" type="int" default="4" /> | ||
<param index="3" name="password" type="String" default="""" /> | ||
<description> | ||
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 [signal ViewLobbyResponse.finished] signal that is emitted when finished. | ||
Generates [signal lobby_created] signal. | ||
</description> | ||
</method> | ||
<method name="del_lobby_tags"> | ||
<return type="LobbyResponse" /> | ||
<param index="0" name="keys" type="String[]" /> | ||
<description> | ||
Delete one or more keys from the lobby tags. Only works if you are host. | ||
Returns a [LobbyResponse] object that has a [signal LobbyResponse.finished] signal that is emitted when finished. | ||
Generates [signal lobby_tagged]. | ||
</description> | ||
</method> | ||
<method name="disconnect_from_lobby"> | ||
<return type="void" /> | ||
<description> | ||
Disconnect from the lobby server. | ||
Generates [signal disconnected_from_lobby] signal. | ||
</description> | ||
</method> | ||
<method name="is_host"> | ||
<return type="bool" /> | ||
<description> | ||
Returns true if you are the host of the current lobby. | ||
</description> | ||
</method> | ||
<method name="join_lobby"> | ||
<return type="ViewLobbyResponse" /> | ||
<param index="0" name="lobby_id" type="String" /> | ||
<param index="1" name="password" type="String" default="""" /> | ||
<description> | ||
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 [signal ViewLobbyResponse.finished] signal that is emitted when finished. | ||
Generates [signal lobby_joined]. | ||
</description> | ||
</method> | ||
<method name="kick_peer"> | ||
<return type="LobbyResponse" /> | ||
<param index="0" name="peer_id" type="String" /> | ||
<description> | ||
Kick a peer. You need to be host to do so. | ||
Returns a [LobbyResponse] object that has a [signal LobbyResponse.finished] signal that is emitted when finished. | ||
Generates [signal peer_left] signal with kicked set to true. | ||
</description> | ||
</method> | ||
<method name="leave_lobby"> | ||
<return type="LobbyResponse" /> | ||
<description> | ||
Leave a lobby. You need to be in a lobby to leave one. | ||
Returns a [LobbyResponse] object that has a [signal LobbyResponse.finished] signal that is emitted when finished. | ||
Generates [signal lobby_left]. | ||
</description> | ||
</method> | ||
<method name="list_lobbies"> | ||
<return type="ListLobbyResponse" /> | ||
<param index="0" name="tags" type="Dictionary" default="{}" /> | ||
<param index="1" name="start" type="int" default="0" /> | ||
<param index="2" name="count" type="int" default="10" /> | ||
<description> | ||
Lists all lobbies. Lobbies that are sealed won't show in the list, except if you disconnected and trying to reconnect to a lobby. | ||
</description> | ||
</method> | ||
<method name="lobby_call"> | ||
<return type="LobbyCallResponse" /> | ||
<return type="AuthoritativeResponse" /> | ||
<param index="0" name="method" type="String" /> | ||
<param index="1" name="args" type="Array" /> | ||
<description> | ||
Call a method on the server. | ||
</description> | ||
</method> | ||
<method name="send_chat_message"> | ||
<return type="LobbyResponse" /> | ||
<param index="0" name="chat_message" type="String" /> | ||
<description> | ||
Send a chat message. Only works if you are in a lobby. | ||
Returns a [LobbyResponse] object that has a [signal LobbyResponse.finished] signal that is emitted when finished. | ||
Generates [signal peer_messaged]. | ||
</description> | ||
</method> | ||
<method name="set_lobby_ready"> | ||
<return type="LobbyResponse" /> | ||
<param index="0" name="ready" type="bool" /> | ||
<description> | ||
Ready up in the lobby. You need to be in a lobby and unready to run this. | ||
Returns a [LobbyResponse] object that has a [signal LobbyResponse.finished] signal that is emitted when finished. | ||
Generates [signal peer_ready]. | ||
</description> | ||
</method> | ||
<method name="set_lobby_sealed"> | ||
<return type="LobbyResponse" /> | ||
<param index="0" name="seal" type="bool" /> | ||
<description> | ||
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 [signal LobbyResponse.finished] signal that is emitted when finished. | ||
Generates [signal lobby_sealed]. | ||
</description> | ||
</method> | ||
<method name="set_peer_name"> | ||
<return type="LobbyResponse" /> | ||
<param index="0" name="peer_name" type="String" /> | ||
<description> | ||
Set your peer name. | ||
Returns a [LobbyResponse] object that has a [signal LobbyResponse.finished] signal that is emitted when finished. | ||
Generates [signal peer_named] signal if you are in lobby. | ||
</description> | ||
</method> | ||
<method name="view_lobby"> | ||
<return type="ViewLobbyResponse" /> | ||
<param index="0" name="lobby_id" type="String" default="""" /> | ||
<param index="1" name="password" type="String" default="""" /> | ||
<description> | ||
View data from a lobby. Returns lobby settings and peers. | ||
Returns a [ViewLobbyResponse] object that has a [signal ViewLobbyResponse.finished] signal that is emitted when finished. | ||
</description> | ||
</method> | ||
</methods> | ||
<members> | ||
<member name="server_url" type="String" setter="set_server_url" getter="get_server_url" overrides="LobbyClient" default=""wss://authlobby.blazium.app/connect"" /> | ||
<member name="connected" type="bool" setter="" getter="get_connected" default="false"> | ||
True if the client is connected, else false. | ||
</member> | ||
<member name="game_id" type="String" setter="set_game_id" getter="get_game_id" default=""""> | ||
The game id. | ||
</member> | ||
<member name="lobby" type="LobbyInfo" setter="" getter="get_lobby"> | ||
The current lobby. Reflects changes to the lobby. | ||
</member> | ||
<member name="peer" type="LobbyPeer" setter="" getter="get_peer"> | ||
The current peer. Reflects changes to the self peer. | ||
</member> | ||
<member name="peers" type="LobbyPeer[]" setter="" getter="get_peers" default="[]"> | ||
The lobby peers. Reflects changes to all peers. | ||
</member> | ||
<member name="reconnection_token" type="String" setter="set_reconnection_token" getter="get_reconnection_token" default=""""> | ||
Reconnection token. | ||
</member> | ||
<member name="server_url" type="String" setter="set_server_url" getter="get_server_url" default=""wss://authlobby.blazium.app/connect""> | ||
Set to what url this lobby should connect to. | ||
</member> | ||
</members> | ||
<signals> | ||
<signal name="connected_to_lobby"> | ||
<param index="0" name="peer" type="LobbyPeer" /> | ||
<param index="1" name="reconnection_token" type="String" /> | ||
<description> | ||
Signal generated after you connect to the lobby. | ||
</description> | ||
</signal> | ||
<signal name="disconnected_from_lobby"> | ||
<param index="0" name="reason" type="String" /> | ||
<description> | ||
Signal generated after you disconnect from the lobby. | ||
</description> | ||
</signal> | ||
<signal name="lobby_created"> | ||
<param index="0" name="lobby" type="LobbyInfo" /> | ||
<param index="1" name="peers" type="LobbyPeer[]" /> | ||
<description> | ||
Signal generated after a lobby is created. | ||
</description> | ||
</signal> | ||
<signal name="lobby_joined"> | ||
<param index="0" name="lobby" type="LobbyInfo" /> | ||
<param index="1" name="peers" type="LobbyPeer[]" /> | ||
<description> | ||
Signal generated after you joint a lobby. | ||
</description> | ||
</signal> | ||
<signal name="lobby_left"> | ||
<param index="0" name="kicked" type="bool" /> | ||
<description> | ||
Signal generated after you leave a lobby. | ||
</description> | ||
</signal> | ||
<signal name="lobby_notified"> | ||
<param index="0" name="data" type="Object" /> | ||
<param index="1" name="from_peer" type="LobbyPeer" /> | ||
<description> | ||
Signal generated after a notification is received. | ||
</description> | ||
</signal> | ||
<signal name="lobby_sealed"> | ||
<param index="0" name="sealed" type="bool" /> | ||
<description> | ||
Signal generated after the host seals the lobby. | ||
</description> | ||
</signal> | ||
<signal name="lobby_tagged"> | ||
<param index="0" name="tags" type="Dictionary" /> | ||
<description> | ||
Signal generated after the host updated the tags of the lobby | ||
</description> | ||
</signal> | ||
<signal name="log_updated"> | ||
<param index="0" name="command" type="String" /> | ||
<param index="1" name="logs" type="String" /> | ||
<description> | ||
Signals a log from a command. | ||
</description> | ||
</signal> | ||
<signal name="peer_disconnected"> | ||
<param index="0" name="peer" type="LobbyPeer" /> | ||
<description> | ||
Signal generated after a peer disconnects. If they don't reconnect they will be removed. | ||
</description> | ||
</signal> | ||
<signal name="peer_joined"> | ||
<param index="0" name="peer" type="LobbyPeer" /> | ||
<description> | ||
Signal generated after a peer joins the lobby. | ||
</description> | ||
</signal> | ||
<signal name="peer_left"> | ||
<param index="0" name="peer" type="LobbyPeer" /> | ||
<param index="1" name="kicked" type="bool" /> | ||
<description> | ||
Signal generated after a peer leaves the lobby. | ||
</description> | ||
</signal> | ||
<signal name="peer_messaged"> | ||
<param index="0" name="peer" type="LobbyPeer" /> | ||
<param index="1" name="chat_message" type="String" /> | ||
<description> | ||
Signal generated after a peer sends a chat message. | ||
</description> | ||
</signal> | ||
<signal name="peer_named"> | ||
<param index="0" name="peer" type="LobbyPeer" /> | ||
<description> | ||
Signal generated after a peer names himself. | ||
</description> | ||
</signal> | ||
<signal name="peer_ready"> | ||
<param index="0" name="peer" type="LobbyPeer" /> | ||
<param index="1" name="is_ready" type="bool" /> | ||
<description> | ||
Signal generated after a peer is ready. | ||
</description> | ||
</signal> | ||
<signal name="peer_reconnected"> | ||
<param index="0" name="peer" type="LobbyPeer" /> | ||
<description> | ||
Signal generated after a peer reconnects. | ||
</description> | ||
</signal> | ||
<signal name="received_lobby_data"> | ||
<param index="0" name="data" type="Object" /> | ||
<description> | ||
Signal generated after data is sent to the lobby. | ||
</description> | ||
</signal> | ||
<signal name="received_peer_data"> | ||
<param index="0" name="data" type="Object" /> | ||
<param index="1" name="to_peer" type="LobbyPeer" /> | ||
<description> | ||
Signal generated after data is sent to peer. | ||
</description> | ||
</signal> | ||
</signals> | ||
</class> |
6 changes: 3 additions & 3 deletions
6
...ium_sdk/doc_classes/LobbyCallResponse.xml → ...sdk/doc_classes/AuthoritativeResponse.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...azium_sdk/doc_classes/LobbyCallResult.xml → ...m_sdk/doc_classes/AuthoritativeResult.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.