The stadium that the game is currently being played in.
The min value of kick rate limit.
The rate value of kick rate limit.
The max value of kick rate limit.
The time limit of this current RoomState in seconds. -1 = no limit.
The score limit of this current RoomState. 0 = no limit.
The over-time limit of this current RoomState in seconds. -1 = no limit.
Whether the teams are locked or not. The non-admin players are allowed to change teams only if this feature is disabled and the game is stopped.
Whether player directions are active or not.
Whether the game will run its default logic or not. If this value is false, you will probably want to write your own game logic from scratch in onGameTick.
Whether the clock is paused or not.
Number of ticks the physics engine waits after each goal before restarting the game.
Number of ticks the physics engine waits after each pause before resuming the game.
Number of ticks the physics engine waits after deciding that the game is over before ending the game.
Current state of the game, or null if the game is stopped.
All players that are currently in this room.
Name of this room.
The custom colors for each team. The 0th index has null because it's the Spectators team.
Gui-related values of the room.
The extrapolated version of this RoomState, or null if the data is not available.
Returns a snapshot of the current room state. You can load the returned object directly into sandbox using its useSnapshot(roomState) function.
A complete snapshot of the current room state.
Returns the Player object for the player whose id is id.
The id of the player to be returned.
The Player object, or null if the player is not found.
Runs the simulation count steps. Use with extreme caution, especially on network rooms.
Number of steps to run the simulation.
void.
Returns all current game objects in hbs/json format. Note that the values written here are the currently active values, not the static and stored ones.
A json object that represents all objects in the current stadium.
Creates a vertex object in memory and returns it.
An object with the following structure:
x: number: The x component of the position of the new vertex.y: number: The y component of the position of the new vertex.bCoef: number | null: The bouncing coefficient of the new vertex.cMask: string[] | null: The collision mask of the new vertex.cGroup: string[] | null: The collision group of the new vertex.A Vertex object.
Creates a segment object in memory using vertex indices and returns it. The vertices must exist at the given indices in the vertices array of the current room.
An object with the following structure:
v0: int: Index of the first vertex of the new segment.v1: int: Index of the second vertex of the new segment.color: "transparent" | string | [r: int, g: int, b: int] | null: Color of the new segment.bias: number | null: Bias of the new segment.curve: number | null: Curve of the new segment. (unit: angles)curveF: number | null: Curve of the new segment. (unit: radians) While modifying this, the engine does not update some values. Only use this if you know what you are doing.vis: boolean | null: Visibility of the new segment.bCoef: number | null: Bouncing coefficient of the new segment.cMask: string[] | null: Collision mask of the new segment.cGroup: string[] | null: Collision group of the new segment.A Segment object.
Creates a segment object in memory using vertex objects and returns it.
An object with the following structure:
v0: Vertex: First vertex of the new segment.v1: Vertex: Second vertex of the new segment.color: "transparent" | string | [r: int, g: int, b: int] | null: Color of the new segment.bias: number | null: Bias of the new segment.curve: number | null: Curve of the new segment. (unit: angles)curveF: number | null: Curve of the new segment. (unit: radians) While modifying this, the engine does not update some values. Only use this if you know what you are doing.vis: boolean | null: Visibility of the new segment.bCoef: number | null: Bouncing coefficient of the new segment.cMask: string[] | null: Collision mask of the new segment.cGroup: string[] | null: Collision group of the new segment.A Segment object.
Creates a goal object in memory and returns it.
An object with the following structure:
p0: [x: number, y: number]: The starting point of the new goal object.p1: [x: number, y: number]: The ending point of the new goal object.team: "red" | "blue": The team of the new goal object.A Goal object.
Creates a plane object in memory and returns it.
An object with the following structure:
normal: [x: number, y: number]: The normal of the new plane. This value is normalized automatically.dist: number: The distance of the new plane to the origin(0,0).bCoef: number | null: The bouncing coefficient of the new plane.cMask: string[] | null: The collision mask of the new plane.cGroup: string[] | null: The collision group of the new plane.A Plane object.
Creates a disc object in memory and returns it.
An object with the following structure:
pos: [x: number, y: number]: The position of the new disc.speed: [x: number, y: number] | null: The speed of the new disc.gravity: [x: number, y: number] | null: The gravity (acceleration) of the new disc.radius: number: The radius of the new disc.invMass: number | null: The inverse mass of the new disc.damping: number | null: The damping of the new disc.color: "transparent" | string | [r: int, g: int, b: int] | null: The color of the new disc.bCoef: number | null: The bouncing coefficient of the new disc.cMask: string[] | null: The collision mask of the new disc.cGroup: string[] | null: The collision group of the new disc.A Disc object.
Creates a joint object in memory using disc indices and returns it.
An object with the following structure:
d0: int: The first disc index of the new joint.d1: int: The second disc index of the new joint.color: "transparent" | string | [r: int, g: int, b: int] | null: The color of the new joint.strength: "rigid" | number | null: The strengh of the new joint.length: number | [min: number, max: number] | null: The length of the new joint.A Joint object.
Creates a joint object in memory using disc objects and returns it.
An object with the following structure:
d0: Disc: The first disc of the new joint.d1: Disc: The second disc of the new joint.color: "transparent" | string | [r: int, g: int, b: int] | null: The color of the new joint.strength: "rigid" | number | null: The strength of the new joint.length: number | [min: number, max: number] | null: The length of the new joint.A Joint object.
Creates a vertex object and adds it to the current stadium.
An object with the following structure:
x: number: The x component of the position of the new vertex.y: number: The y component of the position of the new vertex.bCoef: number | null: The bouncing coefficient of the new vertex.cMask: string[] | null: The collision mask of the new vertex.cGroup: string[] | null: The collision group of the new vertex.void.
Creates a segment object using vertex indices and adds it to the current stadium. The vertices must exist at the given indices in the vertices array of the current room.
An object with the following structure:
v0: int: Index of the first vertex of the new segment.v1: int: Index of the second vertex of the new segment.color: "transparent" | string | [r: int, g: int, b: int] | null: Color of the new segment.bias: number | null: Bias of the new segment.curve: number | null: Curve of the new segment. (unit: angles)curveF: number | null: Curve of the new segment. (unit: radians) While modifying this, the engine does not update some values. Only use this if you know what you are doing.vis: boolean | null: Visibility of the new segment.bCoef: number | null: Bouncing coefficient of the new segment.cMask: string[] | null: Collision mask of the new segment.cGroup: string[] | null: Collision group of the new segment.void.
Creates a goal object and adds it to the current stadium.
An object with the following structure:
p0: [x: number, y: number]: The starting point of the new goal object.p1: [x: number, y: number]: The ending point of the new goal object.team: "red" | "blue": The team of the new goal object.void.
Creates a plane object and adds it to the current stadium.
An object with the following structure:
normal: [x: number, y: number]: The normal of the new plane. This value is normalized automatically.dist: number: The distance of the new plane to the origin(0,0).bCoef: number | null: The bouncing coefficient of the new plane.cMask: string[] | null: The collision mask of the new plane.cGroup: string[] | null: The collision group of the new plane.void.
Creates a disc object and adds it to the current stadium.
An object with the following structure:
pos: [x: number, y: number]: The position of the new disc.speed: [x: number, y: number] | null: The speed of the new disc.gravity: [x: number, y: number] | null: The gravity (acceleration) of the new disc.radius: number: The radius of the new disc.invMass: number | null: The inverse mass of the new disc.damping: number | null: The damping of the new disc.color: "transparent" | string | [r: int, g: int, b: int] | null: The color of the new disc.bCoef: number | null: The bouncing coefficient of the new disc.cMask: string[] | null: The collision mask of the new disc.cGroup: string[] | null: The collision group of the new disc.void.
Creates a joint object and adds it to the current stadium.
An object with the following structure:
d0: int: The first disc index of the new joint.d1: int: The second disc index of the new joint.color: "transparent" | string | [r: int, g: int, b: int] | null: The color of the new joint.strength: "rigid" | number | null: The strengh of the new joint.length: number | [min: number, max: number] | null: The length of the new joint.void.
Adds a spawn point with given coordinate to the given team in the current stadium.
An object with the following structure:
x: number: The x coordinate of the new spawn point.y: number: The y coordinate of the new spawn point.team: "red" | "blue": The team of the new spawn point.void.
Adds a player with given properties to the current stadium.
An object with the following structure:
id: int: The id the new player. Already existing ids should not be used. 0 < id < 65535.name: string: The name of the new player.avatar: string: The avatar of the new player.flag: string: The country code of the new player.team: "spec" | "red" | "blue": The team of the new player. If this is "spec", the keys after this are ignored. Otherwise, player is moved to the specified team, a player disc is automatically generated and the below values are applied to the new disc.pos: [x: number, y: number] | null: The position of the new player. Team must not be "spec".speed: [x: number, y: number] | null: The speed of the new player. Team must not be "spec".gravity: [x: number, y: number] | null: The gravity (acceleration) of the new player. Team must not be "spec".radius: number | null: The radius of the new player. Team must not be "spec".invMass: number | null: The inverse mass of the new player. Team must not be "spec".damping: number | null: The damping of the new player. Team must not be "spec".bCoef: number | null: The bouncing coefficient of the new player. Team must not be "spec".cMask: string[] | null: The collision mask of the new player. Team must not be "spec".cGroup: string[] | null: The collision group of the new player. Team must not be "spec".void.
Returns the indices of vertices that form a segment.
The segment that contain the vertices whose indices we are trying to find.
An array in this format: [index1: int, index2: int]. index1 and index2 are the indices of the 1st and 2nd vertices of the queried segment.
Returns the indices of vertices that form a segment.
The index of the segment that contain the vertices whose indices we are trying to find.
An array in this format: [index1: int, index2: int]. index1 and index2 are the indices of the 1st and 2nd vertices of the queried segment. Returns null if the segment does not exist.
Updates the idxth vertex's only the given values.
Index of the vertex that is desired to be updated.
An object with the following structure:
x: number | null: The new x coordinate of the vertex.y: number | null: The new y coordinate of the vertex.bCoef: number | null: The new bouncing coefficient of the vertex.cMask: string[] | null: The new collision mask of the vertex.cGroup: string[] | null: The new collision group of the vertex.void.
Updates the idxth segment's only the given values.
Index of the segment that is desired to be updated.
An object with the following structure:
v0: int | null: The new first vertex index of the segment.v1: int | null: The new second vertex index of the segment.color: "transparent" | string | [r: int, g: int, b: int] | null: The new color of the segment.bias: number | null: The new bias of the segment.curve: number | null: The new curve of the segment. (unit: degrees)curveF: number | null: The new curve of the segment. (unit: radians) While modifying this, the engine does not update some values. Only use this if you know what you are doing.vis: boolean | null: The new visibility of the segment.bCoef: number | null: The new bouncing coefficient of the segment.cMask: string[] | null: The new collision mask of the segment.cGroup: string[] | null: The new collision group of the segment.void.
Updates the idxth goal's only the given values.
Index of the goal that is desired to be updated.
An object with the following structure:
p0: [x: number, y: number] | null: The new first point of the goal.p1: [x: number, y: number] | null: The new second point of the goal.team: "red" | "blue" | null: The new team of the goal.void.
Updates the idxth plane's only the given values.
Index of the plane that is desired to be updated.
An object with the following structure:
normal: [x: number, y: number] | null: The new normal of the plane. This value is normalized automatically.dist: number | null: The new distance of the plane to the origin. (0, 0)bCoef: number | null: The new bouncing coefficient of the plane.cMask: string[] | null: The new collision mask of the plane.cGroup: string[] | null: The new collision group of the plane.void.
Updates the idxth disc's only the given values.
Index of the disc that is desired to be updated.
An object with the following structure:
pos: [x: number, y: number] | null: The new position of the disc.speed: [x: number, y: number] | null: The new speed of the disc.gravity: [x: number, y: number] | null: The new gravity (acceleration) of the disc.radius: number | null: The new radius of the disc.invMass: number | null: The new inverse mass of the disc.damping: number | null: The new damping of the disc.color: "transparent" | string | [r: int, g: int, b: int] | null: The new color of the disc.bCoef: number | null: The new bouncing coefficient of the disc.cMask: string[] | null: The new collision mask of the disc.cGroup: string[] | null: The new collision group of the disc.void.
Updates the given disc object(discObj)'s only the given values.
The disc that is desired to be updated.
An object with the following structure:
pos: [x: number, y: number] | null: The new position of the disc.speed: [x: number, y: number] | null: The new speed of the disc.gravity: [x: number, y: number] | null: The new gravity (acceleration) of the disc.radius: number | null: The new radius of the disc.invMass: number | null: The new inverse mass of the disc.damping: number | null: The new damping of the disc.color: "transparent" | string | [r: int, g: int, b: int] | null: The new color of the disc.bCoef: number | null: The new bouncing coefficient of the disc.cMask: string[] | null: The new collision mask of the disc.cGroup: string[] | null: The new collision group of the disc.void.
Updates the idxth joint's only the given values.
Index of the joint that is desired to be updated.
An object with the following structure:
d0: int | null: The new first disc index of the joint.d1: int | null: The new second disc index of the joint.color: "transparent" | string | [r: int, g: int, b: int] | null: The new color of the joint.strength: "rigid" | number | null: The new strength of the joint.length: number | [min: number, max: number] | null: The new length of the joint.void.
Updates the idxth spawn point in team(team) using only the given values.
Index of the spawn point that is desired to be updated.
Current team of the spawn point that is desired to be updated.
An object with the following structure:
x: number | null: The new x coordinate of the spawn point.y: number | null: The new y coordinate of the spawn point.team: "red" | "blue" | null: The new team of the spawn point.void.
Updates the player(playerId)'s only the given values.
Id of the player that is desired to be updated.
An object with the following structure:
name: string | null: The new name of the player.avatar: string | null: The new avatar of the player.flag: string | null: The new flag of the player.team: "spec" | "red" | "blue" | null: The new team of the player.pos: [x: number, y: number] | null: The new position of the player.speed: [x: number, y: number] | null: The new speed of the player.gravity: [x: number, y: number] | null: The new gravity (acceleration) of the player.radius: number | null: The new radius of the player.invMass: number | null: The new inverse mass of the player.damping: number | null: The new damping of the player.bCoef: number | null: The new bouncing coefficient of the player.cMask: string[] | null: The new collision mask of the player.cGroup: string[] | null: The new collision group of the player.void.
Removes a vertex from the current room.
Index of the vertex to remove.
void.
Removes a segment from the current room.
Index of the segment to remove.
void.
Removes a goal from the current room.
Index of the goal to remove.
void.
Removes a plane from the current room.
Index of the plane to remove.
void.
Removes a disc from the current room.
Index of the disc to remove.
void.
Removes a joint from the current room.
Index of the joint to remove.
void.
Removes a spawn point from the current room.
Index of the spawn point to remove.
The team that the spawn point belongs to.
void.
Removes a player from the current room.
Id of the player to remove.
void.
Updates the current stadium's only the given player physics values.
An object with the following structure:
radius: number | null: The new radius value of the player physics of the current stadium.gravity: [x: number, y: number] | null: The new gravity (acceleration) value of the player physics of the current stadium.invMass: number | null: The new inverse mass value of the player physics of the current stadium.bCoef: number | null: The new bouncing coefficient value of the player physics of the current stadium.cGroup: string[] | null: The new collision group value of the player physics of the current stadium.damping: number | null: The new damping value of the player physics of the current stadium.kickingDamping: number | null: The new kicking damping value of the player physics of the current stadium.acceleration: number | null: The new acceleration value of the player physics of the current stadium.kickingAcceleration: number | null: The new kickingAcceleration value of the player physics of the current stadium.kickStrength: number | null: The new kick strength value of the player physics of the current stadium.kickback: number | null: The new kick back value of the player physics of the current stadium.void.
Updates the current stadium's only the given background values.
An object with the following structure:
type: 0 | 1 | 2 | null: The new background type of the current stadium. (0: "none", 1: "grass", 2: "hockey")width: number | null: The new background width of the current stadium.height: number | null: The new background height of the current stadium.kickOffRadius: number | null: The new kick-off radius of the current stadium.cornerRadius: number | null: The new background corner radius of the current stadium.color: "transparent" | string | [r: number, g: number, b: number] | null: The new background color of the current stadium.goalLine: number | null: The new goal line distance of the current stadium.void.
Updates the current stadium's only the given general values.
An object with the following structure:
name: string | null: The new name of the current stadium.width: number | null: The new width of the current stadium.height: number | null: The new height of the current stadium.maxViewWidth: number | null: The new max view width of the current stadium.cameraFollow: 0 | 1 | null: The new camera follow value of the current stadium. (0: "", 1: "player")spawnDistance: number | null: The new spawn distance value of the current stadium.kickOffReset: boolean | null: The new kick-off reset value of the current stadium. true: "full", false: "partial"canBeStored: boolean | null: The new can-be-stored value of the current stadium.void.
Sets the player's current direction. room.state.directionActive must be true for this to work.
New direction value of the current player.
void.
Sets whether to use default game logic or not.
Whether the default game logic is active(1) or passive(0).
void.
Sends an announcement using the improved announcement api.
The announcement message. ( max length = 1000 )
OptionalcssVar: stringThe cssVar of the announcement message.
Optionalsound: stringThe sound of the announcement message.
OptionaltargetId: numberId of the player who will receive this announcement. If this value is null, the announcement is sent to everyone.
void.
Updates the current skin(textureId) of a player.
Id of the player whose skin will be modified.
New skin value of the player.
void.
Sets the cssVar attribute of a player to change its appearance in the room gui.
Id of the player whose cssVar will be modified.
New cssVar value of the player.
void.
Adds a new stadium object.
Type of the object to be added.
An object that is supposed to contain all parameters required to add that type of object.
void.
Updates an existing stadium object.
Type of the object to be updated.
Id of the object to be updated.
An object that is supposed to contain all parameters required to update that type of object.
void.
Removes an existing stadium object.
Type of the object to be removed.
Id of the object to be removed.
An instance of StadiumRemoveObjectEvent.
Sets the overtime limit.
The desired overtime limit of the game.
void.
Manually changes the energy of an individual player.
Id of the player whose energy values will be modified.
New values. Order of values is supposed to be: [energy, kEnergyGain, kEnergyDrain]. null means no change for each value.
void.
Manually change the direction of an individual player. room.state.directionActive must be true for this to work.
Id of the player whose energy values will be modified.
New direction value of the player.
void.
Introduces a new game input control and assigns it to the next bit of player.input value.
Unique name of the input control.
Keycodes for the default keys of this input control.
void.
Remove an existing game input control. This function might break the game input logic completely.
Unique name of the input control to be removed.
void.
Updates the current contents of a css variable.
Name of the css variable..
New value of the css variable.
void.
Plays a custom sound.
Name of the sound to be played.
void.
Changes the name of the room.
The new room name.
void.
Manually sets the current elapsed time.
New elapsed time value.
void.
Manually sets the current max goal ticks.
New max goal ticks value.
void.
Manually set the current max pause ticks.
New max pause ticks value.
void.
Manually set the current max end ticks.
New max end ticks value.
void.
Manually pause/resume the game clock.
Whether the game will be paused(1) or resumed(0).
void.
Manually set whether direction is active or not.
New directionActive value.
void.
Manually set the current team scores.
Id of the team whose score is desired to be changed.
New score for the team.
void.
Sets the player's current direction. room.state.directionActive must be true for this to work.
New direction value of the current player.
void
A class that defines the complete state of a room.