Version: stable
fusion.init(app_id,app_version)
Initialize Fusion.
PARAMETERS
app_id |
string |
|
app_version |
string |
fusion.init_from_settings()
Initialize Fusion from game.project settings.
PARAMETERS
None
fusion.get_disconnect_cause()
Get disconnect cause.
PARAMETERS
None
RETURNS
number |
Cause |
fusion.join_or_create_room_random(create_room_options,matchmaking_options)
Join or create random room.
PARAMETERS
create_room_options |
table |
|
matchmaking_options |
table |
fusion.join_room_random(matchmaking_options)
Join random room.
PARAMETERS
matchmaking_options |
table |
fusion.join_room(room_name,join_room_options)
Join room.
PARAMETERS
room_name |
string |
|
join_room_options |
table |
fusion.join_or_create_room(room_name,create_room_options,join_room_options)
Join or create room.
PARAMETERS
room_name |
string |
|
create_room_options |
table |
|
join_room_options |
table |
fusion.create_room(room_name,create_room_options)
Create room.
PARAMETERS
room_name |
string |
|
create_room_options |
table |
fusion.leave_room(will_come_back,send_auth_cookie)
Leave room.
PARAMETERS
will_come_back |
boolean |
|
send_auth_cookie |
boolean |
fusion.is_connected()
Check if Fusion is connected.
PARAMETERS
None
RETURNS
boolean |
fusion.is_running()
Check if Fusion has config and is connected.
PARAMETERS
None
RETURNS
boolean |
fusion.is_started()
Check if Fusion is started. Fusion is considered started after a call to. `fusion.start()` has received a `EventOnFusionStart` event.
PARAMETERS
None
RETURNS
boolean |
fusion.enable_debug(enable)
Enable/disable debugging.
PARAMETERS
enable |
boolean |
fusion.register_scene_object(scene,factory_url,owner_mode,id)
Register a scene object.
PARAMETERS
scene |
number |
|
factory_url |
string |
|
owner_mode |
number |
|
id |
string |
fusion.spawn(factory_url,position,rotation,scene,owner_mode)
Create a networked game object. This will spawn a game object in the same. Way as when calling factory.create(). The function will also register the spawned object with Fusion as if manually calling register_object()
PARAMETERS
factory_url |
string |
|
position |
vector3 |
Initial position of created game object |
rotation |
quat |
Initial rotation of created game object |
scene |
number |
The scene to which this object belongs |
owner_mode |
number |
Owner mode of spawned object |
RETURNS
hash |
Of the spawned game object |
fusion.register_object(scene,factory_url,owner_mode,id)
Register an object.
PARAMETERS
scene |
number |
|
factory_url |
string |
|
owner_mode |
number |
|
id |
string |
fusion.unregister_object(id)
Unregister a previously registered object.
PARAMETERS
id |
string |
fusion.scene_change(index,sequence,data)
Change scene.
PARAMETERS
index |
number |
|
sequence |
number |
|
data |
string |
fusion.rpc(target_player,data)
Send RPC.
PARAMETERS
target_player |
number |
0 = all, specific PlayerId = targeted |
data |
string |
RETURNS
boolean |
fusion.get_local_player_id()
Get the player id of the local client
PARAMETERS
None
RETURNS
number |
Player id of the local client |
fusion.get_owner_id(id)
Get the player id of the current owner of an object
PARAMETERS
id |
string |
Id of the object to get the owner for |
RETURNS
number |
Player id of the object's owner |
fusion.has_authority(id)
Check if this client has authority over a game object. Use this to decide if user input should be handled or not.
PARAMETERS
id |
string |
RETURNS
boolean |
Returns true if the client has authority |
fusion.has_owner(id)
Check if an object has an owner
PARAMETERS
id |
string |
Id of the object |
RETURNS
boolean |
If the object has an owner |
fusion.want_authority(claim_ownership,id)
Signal desire for the local client to own an object
PARAMETERS
claim_ownership |
boolean |
|
id |
string |
Id of the object to own |
fusion.clear_owner_cooldown(id)
Explicitly clear the ownership cooldown
PARAMETERS
id |
string |
Id of the object to clear cooldown for |
fusion.set_send_rate(send_rate,id)
Set the send rate of an object. This decided how much bandwidth to allocate
PARAMETERS
send_rate |
number |
|
id |
string |
Id of the object to send rate for |
fusion.set_local_send_rate(send_rate,id)
Set the local send rate divisor for an object. A value of `1` means the object sends every tick (highest rate). A value of `16` means it sends every 16th tick (lowest rate). This is a client-side optimization -- the object still exists on all clients but consumes less bandwidth when you are not the active authority.
PARAMETERS
send_rate |
number |
|
id |
string |
Id of the object to send rate for |
fusion.reset_send_rate(id)
Reset the send rate of an object.
PARAMETERS
id |
string |
Id of the object to reset send rate for |
fusion.player_count()
Get player count
PARAMETERS
None
RETURNS
number |
Number of players |
fusion.is_master_client()
Get if this client is the room's master
PARAMETERS
None
RETURNS
boolean |
True if this client is the room's master |
fusion.get_rtt()
Get round trip time
PARAMETERS
None
RETURNS
number |
Round trip time in seconds |
fusion.network_time_diff()
Get raw offset between server time and local time. A positive value means the server clock is ahead of the local clock.
PARAMETERS
None
RETURNS
number |
Time diff |
fusion.set_global_interest_key()
Set global visibility key for an object
PARAMETERS
None
fusion.set_area_interest_key()
Set area visibility key for an object
PARAMETERS
None
fusion.set_user_interest_key()
Set user visibility key for an object
PARAMETERS
None
fusion.set_area_keys(keys)
Set area visibility keys
PARAMETERS
keys |
table |
Area keys to set. Stored as a table of key value pairs (area_key->send_rate) |
fusion.remove_user_key()
Remove a user visibility key from an object
PARAMETERS
None
DISCONNECT_CAUSE_OPERATIONNOTALLOWEDINCURRENTSTATE