API: MultiPlayCore #
Inherits:
MPBase
Core of everything MultiPlay
Properties #
Type | Name | Default |
---|---|---|
bool |
assign_client_authority | true |
String |
bind_address | “*” |
int |
connect_timeout_ms | 50000 |
Node |
current_scene | null |
int |
current_swap_index | 0 |
bool |
debug_gui_enabled | true |
Variant |
debug_status_txt | "" |
PackedScene |
first_scene | |
bool |
is_server | false |
MPPlayer |
local_player | null |
int |
max_players | 2 |
int |
mode | 0 |
bool |
online_connected | false |
MultiplayerPeer |
online_peer | null |
int |
player_count | 0 |
bool |
player_node_ready | false |
PackedScene |
player_scene | |
MPPlayersCollection |
players | |
int |
port | 4200 |
bool |
started | false |
String |
swap_input_action |
Methods #
Returns Type | Syntax |
---|---|
create_player ( Variant player_id, Variant handshake_data ) |
|
load_scene ( String scene_path, Variant respawn_players ) |
|
start_one_screen ( ) | |
start_online_host ( bool act_client, Dictionary act_client_handshake_data, Dictionary act_client_credentials_data ) |
|
start_online_join ( String url, Dictionary handshake_data, Dictionary credentials_data ) |
|
start_solo ( ) | |
start_swap ( ) | |
swap_increment ( ) | |
swap_to ( ) |
Enumerations #
enum PlayMode:
- Online = 0
Network enabled multiplayer
- OneScreen = 1
Single screen multiplayer. User can play with multiple controllers/devices.
- Swap = 2
Swap mode. Intended to be played with one player, user can switch to the peer they wanted to control.
- Solo = 3
Solo, self explanatory
enum ConnectionError:
- UNKNOWN = 0
Unknown reason
- SERVER_FULL = 1
The server’s full
- AUTH_FAILED = 2
Authentication Failure
- TIMEOUT = 3
Connection timed out
- CONNECTION_FAILURE = 4
Failure during connection
- INVALID_HANDSHAKE = 5
Internal handshake data cannot be readed by the server
- VERSION_MISMATCH = 6
Client’s Multiplay version is not compatible with the server
Property Descriptions #
bool
assign_client_authority
- Default:
true
Should Client authority be assigned automatically?
String
bind_address
- Default:
"*"
Which ip to bind on in online game host.
int
connect_timeout_ms
- Default:
50000
Time in milliseconds before timing out the user.
Node
current_scene
- Default:
null
Current scene node
int
current_swap_index
- Default:
0
Current swap index, Swap mode only.
bool
debug_gui_enabled
- Default:
true
Enable Debug UI
Variant
debug_status_txt
- Default:
""
Debug Status
PackedScene
first_scene
- Default:
none
The first scene to load
bool
is_server
- Default:
false
Determines if MultiPlay is running as server
MPPlayer
local_player
- Default:
null
The local player node
int
max_players
- Default:
2
Max players for the game.
int
mode
- Default:
0
Current playmode
bool
online_connected
- Default:
false
If connected in online mode
MultiplayerPeer
online_peer
- Default:
null
MultiplayerPeer for the game
int
player_count
- Default:
0
Current player count
bool
player_node_ready
- Default:
false
If player node is ready
PackedScene
player_scene
- Default:
none
Your own template player scene.
MPPlayersCollection
players
- Default:
none
Players Collection
int
port
- Default:
4200
Which port to use in online game host.
bool
started
- Default:
false
Determines if MultiPlay has started
String
swap_input_action
- Default:
none
Which action key to use for swap mode.
Method Descriptions #
create_player ( Variant
player_id, Variant
handshake_data )
Create player node
load_scene ( String
scene_path, Variant
respawn_players )
Load scene for all players
start_one_screen ( )
Start one screen mode
start_online_host ( bool
act_client, Dictionary
act_client_handshake_data, Dictionary
act_client_credentials_data )
Start online mode as host
start_online_join ( String
url, Dictionary
handshake_data, Dictionary
credentials_data )
Start online mode as client
start_solo ( )
Start solo mode
start_swap ( )
Start swap mode
swap_increment ( )
Swap control to player according to index. Swap mode only
swap_to ( )
Specifically Swap to index. Swap mode only
Signals #
connected_to_server ( )
Emit when client has connected to the server, Only emit locally.
connection_error ( )
Emit when client faced connection error
disconnected_from_server ( )
Emit when client has disconnected from the server, Only emit locally.
player_connected ( )
Emit when new player is connected to the server, Emit to all players in the server.
player_disconnected ( )
Emit when player has disconnected from the server, Emit to all players in the server.
scene_loaded ( )
On network scene loaded
swap_changed ( int
to_index, int
old_index )
Emit when swap index has changed. Only emit in Swap Play mode