ReadonlybanReadonlyblueBlue team's current score. null if game is not active. read-only.
ReadonlyconfigThe current roomConfig object.
ReadonlycurrentThe current frame number of the room. read-only.
ReadonlycurrentThe current Player object.
ReadonlycurrentCurrent player's id.
For a host room, can be true. For a client room, can be a callback function with parameters hostRoomState and clientRoomState. (Look at https://github.com/wxyz-abcd/mooball/tree/main/examples/other/compareStates.js for the default implementation of desync checking.) This callback is called whenever a desync occurs if the host room's debugDesync value is also true. Defaults to null.
ReadonlyfakeThe current fake password value of the room. read-only. host-only.
ReadonlyfixedThe current fixed player count value of the room. read-only. host-only.
ReadonlygameThe object that holds the game state information. Returns null if game is not active.
ReadonlygameThe object that holds the extrapolated game state information. Returns null if game is not active or no extrapolated data is available yet.
ReadonlygeoThe current geolocation of the room. read-only. host-only.
ReadonlyguiGui-related values of the room. read-only.
ReadonlyhideWhether to hide the owner of this room or not. read-only. host-only.
Readonlyistrue for a host room, false for a client room.
ReadonlylibrariesArray of all available libraries.
ReadonlylibrariesAll available libraries mapped as librariesMap[library.name] = library, for meaningful communication between addons inside our custom addon codes.
ReadonlylinkThe url of the room. read-only.
ReadonlymaxThe current maximum number of players of the room. read-only. host-only.
ReadonlynameThe name of the room. read-only.
ReadonlypasswordThe current password of the room. read-only. host-only.
ReadonlyplayersThe list of players in the room. read-only.
ReadonlypluginsArray of all available plugins. This is used internally to restore the order of plugins while a plugin is being activated/deactivated.
ReadonlypluginsAll available plugins mapped as pluginsMap[plugin.name] = plugin, for meaningful communication between addons inside our custom addon codes.
ReadonlyredRed team's current score. null if game is not active. read-only.
ReadonlyrendererThe current renderer object.
The current join-recaptcha status of the room. host-only.
ReadonlyscoreThe game's current score limit. read-only.
ReadonlysdpSession description value of the room's WebRTC connection. (only for client rooms)
ReadonlyshowWhether the room is currently being shown in the room list of the backend server or not. read-only. host-only.
ReadonlystadiumThe stadium object of the room. read-only.
ReadonlystateThe object that holds the whole room state.
ReadonlystateThe object that holds the whole extrapolated room state. Returns null if no extrapolated data is available yet.
ReadonlytimeElapsed time in current game. null if game is not active. read-only.
ReadonlytimeThe game's current time limit. read-only.
The current recaptcha token of the room. If changed, it will also refresh the room link. host-only.
ReadonlyunlimitedWhether the room's player count checking is disabled or not. read-only. host-only.
Bans all given auth(s) from joining the room. host-only.
The auth(s) to ban.
An array that contains; for each auth parameter in the given order, the id of the new ban entry if successful, otherwise null.
Adds the libraryObj at the end of the libraries list and initializes it.
The Library object to be added.
void.
Bans a player from joining the room. host-only.
Id of the player to ban.
Id of the new ban entry if successful, otherwise null.
Adds the pluginObj at the end of the plugins list, initializes and activates it if necessary.
The Plugin object to be added.
void.
Removes the last two players from spectators and adds them to consecutive teams. The first is always added to red, the second is always blue. If there is only one player, it is added to a random team. admin-only.
void.
Moves the current player to the team whose id is teamId. This operation is blocked by default if the current player is not admin and (the game is active or teams are locked).
Id of the team that is desired to join.
void.
Clears the ban of a player. host-only.
Id of the player whose ban will be cleared.
void.
Clears all bans. host-only.
void.
Clears the event queue. Can be useful when the game engine is stuck.
void.
Executes any event inside this room. host-only.
The event to be executed.
Id of the player of whom this event will be executed by.
void.
Sends any event to the target player. If targetId is null; works the same as executeEvent.
CAUTION: It will probably cause "intentional" desync for most events. host-only.
The event to be sent.
Id of the player to whom this event will be sent to.
void.
Extrapolates the current room state and sets the ext variables inside
original objects to their newly calculated extrapolated states. Normally
designed to be used in renderers.
The time to extrapolate the state for in milliseconds. Defaults to 0.
Whether to allow multiple calls in the same game tick. Should be true only while using it inside a renderer's render function. Defaults to false.
The extrapolated room state.
Returns the ball disc.
Optionalextrapolated: booleanDefaults to false.
true: return the latest extrapolated version if available, otherwise the original version.false: return the original version.A Disc object.
Returns the disc whose id is discId.
Id of the disc to be returned.
Optionalextrapolated: booleanDefaults to false.
true: return the latest extrapolated version if available, otherwise the original version.false: return the original version.A Disc object.
Returns the disc array of the current room.
Optionalextrapolated: booleanDefaults to false.
true: return the latest extrapolated version if available, otherwise the original version.false: return the original version.An array that consists of Disc objects.
Returns the current player's key state value.
An integer between 0 and 31 inclusive.
Returns the Player object for the player whose id is id.
Id of the player.
A Player object.
Returns the disc that belongs to the player whose id is playerId.
Id of the player whose disc is to be returned.
Optionalextrapolated: booleanDefaults to false.
true: return the latest extrapolated version if available, otherwise the original version.false: return the original version.A Disc object.
Returns the disc that belongs to the player whose id is playerId. Faster than getPlayerDisc, but experimental. Use at your own risk.
Id of the player whose disc is to be returned.
A Disc object.
Returns true if game is paused.
void.
Returns whether the replay recorder is active or not.
true if replay recording is active; false otherwise.
Kicks or bans a player.
Id of the player who is being kicked/banned.
The kick/ban reason. If null, it is interpreted as he/she leaving by himself/herself, and the ban value is ignored in that case.
If true, the player is being banned; otherwise, the player is being kicked.
void.
Leaves the current room. Also releases the resources used by this object.
void.
Locks or unlocks the ability for non-admin players to change teams while the game is not active. admin-only.
void.
Adds all callbacks in roomConfig into the room's current RoomConfig object. If there is a callback with the same name, a new callback is created that calls both of them. (The current callback is called first.)
The RoomConfig object to be mixed with the current room's RoomConfig object.
void.
Moves the Library at the specified libraryIndex to the index newIndex.
The index of the library that will be moved to a new index.
The new index that the library is desired to be at.
void.
Moves the Plugin at the specified pluginIndex to the index newIndex.
The index of the plugin that will be moved to a new index.
The new index that the plugin is desired to be at.
void.
Pauses or resumes the game. admin-only.
void.
Removes the last two players from the spectators team and adds them to consecutive teams. The first is added to a random team, the second is added to the rival of the first team, etc. If there is only one player, it is added to a random team. admin-only.
void.
Removes the ban entry with the given id. host-only.
Id of the ban entry to remove.
True if the ban entry was removed, otherwise false.
Removes the libraryObj from the libraries list and finalizes it.
The Library object to be removed.
void.
Removes the pluginObj from the plugins list, deactivates and finalizes it if necessary.
The Plugin object to be removed.
void.
Removes all of the players whose ids exist in the array playerIdList, and adds them back in the given order to the top or bottom of the player list depending on the moveToTop value. host-only.
The ids of players that are desired to be removed from the room's players list, reordered to match the order in idList and added back to the room's players list.
Whether to add the players to the top or bottom of the room's players list.
void.
Moves every player in a team to the spectators team. admin-only.
Id of the team whose whose players will be moved to the spectators team.
void.
Moves every player to the spectators team. admin-only.
void.
Sends an announcement message. host-only.
The announcement message that is desired to be sent. msg.length must be <= 1000.
OptionaltargetId: numberIf null, the message is sent to everyone; otherwise, only the player whose id is targetId will receive this announcement. Default value = null.
Optionalcolor: numberThe desired color of the announcement. Range: -1 <= color < 16777216. Default value = -1.
Utils.numberToColor function.-1 means transparent.Optionalstyle: stringThe desired font style of the announcement. Default value = "normal". Must be one of the following:
normal: use document's default font style.bold: fontWeight = "bold".italic: fontStyle = "italic".small: fontSize = "12px".small-bold: fontWeight = "bold", fontSize = "12px".small-italic: fontWeight = "italic", fontSize = "12px".Optionalsound: numberThe desired sound of the announcement. Default value = 1. Must be one of the following:
0: no sound.1: chat sound.2: highlight sound.void.
Creates a BinaryCustomEvent event message with given type and data properties and sends it. The values type and data completely depend on your custom event's order and logic.
The type of the binary custom event.
Any custom binary data for this specific event.
OptionaltargetId: numberIf given, sends this event only to the player with this id if the player is using this modified client.
void.
Sends a chat message.
The message that is desired to be sent. msg.length must be <= 140.
If null, the message is sent to everyone; otherwise, only the player whose id is targetId will receive this chat message. host-only.
void.
Sends a custom connection error string to a client. Shortly after this operation, the connection to the client will be lost, and the error will appear on the client's screen. This function must be called just after the client has joined the room, otherwise it will most likely fail.
Id of the player that is expected to leave the room.
The error message that the client will see on screen.
The snapshot copy of the current room's state.
Creates a CustomEvent event message with given type and data properties and sends it. The values type and data completely depend on your custom event's order and logic.
The type of the custom event.
Any custom data for this specific event. This is converted to a string via JSON.stringify while being serialized.
OptionaltargetId: numberIf given, sends this event only to the player with this id if the player is using this modified client.
void.
Sets the current player's client avatar value.
The desired avatar value. avatar.length must be <= 2.
void.
Sets the current player's chat indicator status.
true activates the chat indicator, false deactivates it.
void.
Sets the RoomConfig object that contains all the main callbacks of this room.
The new RoomConfig instance to be replaced with the room's current one.
void.
Sets the current stadium to stadium. The game must be stopped first. admin-only.
The desired stadium to be set as the room's current stadium.
void.
Sets the properties of a disc. host-only.
Id of the disc whose properties are desired to be set.
The desired properties to set. This will not change the omitted keys of the disc. properties has the following structure:
x: number | null: The desired x coordinate of the disc.y: number | null: The desired y coordinate of the disc.xspeed: number | null: Desired x component of the speed of the disc.yspeed: number | null: Desired y component of the speed of the disc.xgravity: number | null: Desired x component of the gravity of the disc.ygravity: number | null: Desired y component of the gravity of the disc.radius: number | null: The desired radius of the disc.bCoeff: number | null: The desired bouncing coefficient of the disc.invMass: number | null: The desired inverse mass of the disc.damping: number | null: The desired damping of the disc.color: int | null: The desired color of the disc.cMask: int | null: The desired collision mask of the disc.cGroup: int | null: The desired collision group of the disc.void.
Fakes Mooball's backend by directly modifying the password-protectedness of the room. host-only.
If fakePwd is true or false, the room will set its password-protected status to the passed fakePwd value regardless of the room's actual password value. Passing null returns to default behaviour. host-only.
void.
Sets the current player's handicap value.
The desired handicap value in msecs. 0 <= handicap <= 300.
void.
Sets the current player's key state value.
The desired key state value. 0 <= state <= 31.
Optionalinstant: booleanIf true, sends the event immediately. This is introduced later to reduce input lag. Default value = true.
void.
Sets the kick rate limit of the current room. admins-only.
The desired min value of kick rate limit. 0 <= min <= 255.
The desired rate value of kick rate limit. 0 <= rate <= 255.
The desired burst value of kick rate limit. 0 <= burst <= 100.
void.
Give/take away admin rights to/from a player. admin-only.
Id of the player who will have his/her admin rights changed.
Whether the player is desired to have admin rights or not.
void.
Sets the avatar to value for the player whose id is id. host-only.
Id of the player whose avatar is being changed.
The desired avatar value. avatar.length must be <= 2.
If true, sets the headless avatar. Otherwise, sets the client avatar.
void.
Sets the desired disc properties of any player. host-only.
Id of the player whose disc properties are desired to be changed.
The desired properties to set. This will not change the omitted keys of the disc. properties has the following structure:
x: number | null: The desired x coordinate of the disc.y: number | null: The desired y coordinate of the disc.xspeed: number | null: Desired x component of the speed of the disc.yspeed: number | null: Desired y component of the speed of the disc.xgravity: number | null: Desired x component of the gravity of the disc.ygravity: number | null: Desired y component of the gravity of the disc.radius: number | null: The desired radius of the disc.bCoeff: number | null: The desired bouncing coefficient of the disc.invMass: number | null: The desired inverse mass of the disc.damping: number | null: The desired damping of the disc.color: int | null: The desired color of the disc.cMask: int | null: The desired collision mask of the disc.cGroup: int | null: The desired collision group of the disc.void.
Creates an IdentityEvent event message with given player id and data properties and sends it. This event sets playerObject.identity value to the given data object for all clients.
Id of the player whose identity data is being changed.
The new identity data.
Signature of the identity data.
OptionaltargetId: numberIf given, sends this event only to the player with this id if the player is using this modified client.
void.
Moves a player to a different team. admin-only.
Id of the player to be moved to a different team.
Id of the team to move the player to.
void.
Activate or deactivate the plugin whose name is name.
Name of the plugin that is desired to be activated/deactivated.
Whether to activate(active = true) the plugin or to deactivate(active = false) it.
void.
Sets the room's properties. Only room host can use this function.
An object that might have the following keys: (You might omit any key if you don't want to change its value.)
name: string | null: The desired name of the current room.password: string | null: The desired password of the current room, or null to clear the password.geo: GeoLocation | null: The desired geolocation of the current room.playerCount: int | null: An integer value to fix the player count of the current room to that number, or null to return to normal behaviour. Original Mooball backend has the current restriction about this value: 0 <= playerCount <= 30. If the room does not satisfy this, it is not shown in the room list.maxPlayerCount: int | null: The maximum player count value of the current room. Original Mooball backend has the current restriction about this value: 0 <= maxPlayerCount <= 30. If the room does not satisfy this, it is not shown in the room list.fakePassword: boolean | null: If set to true or false, the room will set its password-protected status to your value. Passing null disables this behaviour.unlimitedPlayerCount: boolean: If set to true, bypasses the player count checks, resulting in unlimited maximum player count. However, the default backend will not show the room in the room list if the player count > 30.showInRoomList: boolean: Whether to show this room in the room list or not.tintColor: uint32: Background tint color(to show in room list) of this room.thumbnail: string: Thumbnail(to show in room list) of this room.hideIdentity: booolean: Whether to hide the owner of this room or not.void.
Sets the Renderer object that will render the game. If exists, the old renderer is finalized and the new renderer is initialized.
The new Renderer object that will replace the old one.
void.
Sets the score limit of the room. The game must be stopped first. admin-only.
The desired score limit. 0 <= value <= 99. 0 means unlimited.
void.
Sets the synchronization status of the current player.
The desired synchronization status.
void.
Sets the team colors for the team whose id is teamId. admins-only.
Id of the team whose colors are desired to be changed. Can either be 1(red) or 2(blue).
The desired angle of stripes. Should be between -180 and 180.
Minimum 2, maximum 4 numeric (0 <= integer <= 16777215) color parameters. First parameter is the text color, and the others are stripe colors.
void.
Sets the time limit of the room. The game must be stopped first. admin-only.
The desired time limit. 0 <= value <= 99. 0 means unlimited.
void.
When a player joins the room, the engine is first checking whether the current player count>=room's maximum player count value. This function enables or disables this check. host-only.
Whether the unlimited player count feature is desired to be active or not.
void.
Starts the game. admin-only.
void.
Start recording replay. Recording should be stopped before calling this.
true if succeeded, false otherwise.
Start streaming the game. Streaming and recording should be stopped before calling this. (Currently, recording and streaming cannot be run simultaneously)
Optionalparams: StartStreamingParamsThe parameters required for the streaming to work.
A StartStreamingReturnValue structure if succeeded, or null otherwise.
Stops the game. admin-only.
void.
Stop recording replay. Recording should be started before calling this.
The recorded replay data if succeeded, null otherwise.
Stop streaming the game. Streaming should be started before calling this.
void.
Returns a snapshot of the current room state. You can load this object directly into sandbox using its useSnapshot(roomState) function. Note that the values stored here are the currently active values, not the static and stored ones.
The snapshot copy of the current room's state.
Replaces the Library at the specified libraryIndex with the newLibraryObj library. The old library is finalized and the new library is initialized. The names of the libraries must be the same.
The index of the library that is about to be replaced with the new Library object.
The new Library object that will replace the old one.
void.
Replaces the Plugin at the specified pluginIndex with the newPluginObj plugin. The old plugin is deactivated and finalized and the new plugin is initialized. If the old plugin was active before, the new plugin is also activated. The names of the plugins must be the same.
The index of the plugin that is about to be replaced with the new Plugin object.
The new Plugin object that will replace the old one.
void.
The current list of banned players. read-only. host-only.