Current WebRTC lock step connection with the room host (when not the host) or all room participants (when the host). This will only be initialized after calling MultiplayerController.joinOrCreateRoom.
Set to false to disable room updates, even when still not connected to a room in
multiplayer mode.
ReadonlyeventsAll events emitted by this controller.
ReadonlyknownThe current MultiplayerApi. This will be undefined if playing in single player.
ProtectedmultiplayerThis is populated if .startMultiplayer is called.
Protected ReadonlyparamsProtectedrejectedRooms that have rejected the current player, so the player doesn't keep trying to connect to them.
ReadonlyroomThe current connection state of the controller's connection to a multiplayer room.
ReadonlyroomCurrently joined room id. If a room has not been joined yet, this will be empty.
ProtectedroomUsed to keep track of the room update interval. This will be set when the controller is constructed in multiplayer mode or when a room is left. This will be cleared when a room is joined or if the controller is destroyed.
ReadonlyserviceThe current connection state of the controller's connection to a backend service.
Static ReadonlyeventsAll events emitted by this controller.
Static ReadonlyknownCleanup everything.
Get all room client ids.
For host clients, this includes the host client id whereas MultiplayerController.getConnectedClientIds does not.
Get the current client's WebRTC client id. This will return undefined if there is no
current connection.
Get all connected client ids.
For host clients, this does ont include the host client id whereas MultiplayerController.getAllClientIds does.
The current FPS of the data flow.
Detects if this controller is the room host or not.
Leave the current room or single player connection.
Start multiplayer mode. This initializes MultiplayerController.multiplayerApi and MultiplayerController.roomUpdateIntervalId.
ProtectedstartStarts polling the multiplayer server for room updates and fires listeners.
Start singleplayer mode.
ProtectedupdateSet the current connection state and fire listeners.
An all-in-one controller for singleplayer or lock-step multiplayer game state. Singleplayer mode requires no servers. Multiplayer mode requires a backend service running the MultiplayerApi.