SFSGameSettings

Stores the configuration settings required to create a Game Room.


On the server side, a Game Room is represented by the SFSGame Java class, which extends the Room class providing advanced features such as Player matching, Invitations to join a game, public and private games, quick game joining, etc. On the client side, Game Rooms are regular Rooms with their SFSRoom.isGame property set to true.

Constructor

new SFSGameSettings(name)

Creates a new instance of the SFSGameSettings class.
Pass the instance to the CreateSFSGameRequest class constructor.
Parameters:
NameTypeDescription
namestringThe name of the Game Room to be created.

Extends

Members

allowOwnerOnlyInvitation :boolean

Indicates whether the Room allows Invitations to join the Room to be sent by any User or just by its owner.
Type:
  • boolean
Default Value
  • true

events :RoomEvents

Subset of the configuration parameters indicating which Room-related events should be dispatched by the client.

Room events include: Users entering or leaving the Room, User count change and User Variables update. If set to null, the events configured on the server side are enabled (see the SmartFoxServer Administration Tool documentation).

Default Value
  • null

extension :RoomExtension

Subset of the configuration parameters indicating which Extension (if any) should be attached to the Room on the server side, and its settings.
Default Value
  • null

groupId :string

Identifier (name) of the Group to which the Room is assigned.

If the Group doesn't exist yet, a new one is created before assigning the Room to it.

Type:
  • string
Default Value
  • "default"

invitationExpiryTime :number

Number of seconds before the Invitation to join the Game Room expires (if private only).

The suggested range is 10 to 40 seconds.

Type:
  • number
Default Value
  • 15

invitationParams :SFSObject

Optional object containing additional custom parameters to be sent together with the Invitation to join the Game Room (if private only).

Custom parameters to be transferred to the invitees can be, for example, a message for the Invitation recipient, the game details (title, type...), the inviter details, etc.

Default Value
  • null

invitedPlayers :Array.<SFSUser>|Array.<SFSBuddy>

List of SFSBuddy or SFSUser objects representing Players to be invited to join the Game Room (if private only).

If the number of invited Players is less than the minimum number of Players required to start the game (see the SFSGameSettings#minPlayersToStartGame property), the server will send additional Invitations automatically, searching for more Users in the Groups specified in the SFSGameSettings#searchableRooms list and filtering them by means of the SFSGameSettings#playerMatchExpression instance.

The matching criteria expressed by the SFSGameSettings#playerMatchExpression property do not apply to the Users specified in this list.

Type:
Default Value
  • null

isGame :boolean

Indicates whether the Room is a Game Room.
Type:
  • boolean
Default Value
  • false

isPublic :boolean

Indicates whether the Game Room is public or private.

A public Game Room can be joined by any Player whose User Variables match the SFSGameSettings#playerMatchExpression assigned to the Game Room. A private Game Room can be joined only by Users invited by the Room creator through the SFSGameSettings#invitedPlayers list.

Type:
  • boolean
Default Value
  • true

leaveLastJoinedRoom :boolean

Indicates whether the Players should leave the previously joined Room when joining the Game Room (if private only).

This setting applies to private games only because users join the Game Room automatically when they accept the invitation to play, while public games require a JoinRoomRequest request to be sent, where this behavior can be determined manually.

Type:
  • boolean
Default Value
  • true

maxSpectators :number

Maximum number of Spectators allowed to join the Room (only for Game Rooms).
Type:
  • number
Default Value
  • 0

maxUsers :number

Maximum number of Users allowed to join the Room.

In case of Game Rooms, this represents the maximum number of Players.

Type:
  • number
Default Value
  • 10

maxVariables :number

Maximum number of Room Variables allowed for the Room.
Type:
  • number
Default Value
  • 5

minPlayersToStartGame :number

Minimum number of Players required to start the game represented by the Game Room.

If the SFSGameSettings#notifyGameStarted property is set to true, when this number is reached, the game start is notified to all Users in the Game Room.

Type:
  • number
Default Value
  • 2

name :string

Name of the Room.
Type:
  • string

notifyGameStarted :boolean

Indicates whether a state change should be notified when the minimum number of Players is reached in the Game Room.

If set to true, this settings activates a simple game state (started or stopped) handled through the ReservedRoomVariables.RV_GAME_STARTED reserved Room Variable. Listening to the SFSEvent.ROOM_VARIABLES_UPDATE event for this Room Variable allows clients to be notified when the game represented by the Game Room can start due to the minimum number of Players being reached.

As the used Room Variable is created as global (see the SFSRoomVariable class description), its update is broadcast outside the Room too: this can be used on the client side, for example, to show the game state in a list of available Game Rooms.

Type:
  • boolean
Default Value
  • false

password :string

Password to join the Room (optional).

If the password is set to an empty string, the Room won't be password protected.

Type:
  • string
Default Value
  • (empty string)

permissions :RoomPermissions

Maximum number of Room Variables allowed for the Room.

Permissions include: name and password change, maximum Users change and public messaging. If set to null, the permissions configured on the server side are used (see the SmartFoxServer Administration Tool documentation).

Default Value
  • null

playerMatchExpression :MatchExpression

Matching expression to filter Players.

Filtering is applied when:

  1. Users try to join a public Game Room as Players (their User Variables must match the matching criteria).
  2. The server selects additional Users to invite to join a private Game Room (see the SFSGameSettings#searchableRooms property).

Filtering is not applied to Users directly invited by the Room creator to join the Game Room (if private only); see the SFSGameSettings#invitedPlayers property.

Default Value
  • null

searchableRooms :Array.<string>

List of names of Groups where to search for Players to invite in the Game Room (if private only).

If the Users invited to join the Game Room (see the SFSGameSettings#invitedPlayers property) are less than the minimum number of Players required to start the game (see the SFSGameSettings#minPlayersToStartGame property), the server will invite others automatically, searching for them in Rooms belonging to the Groups specified in this list, and filtering them by means of the SFSGameSettings#playerMatchExpression instance.

Type:
  • Array.<string>
Default Value
  • null

spectatorMatchExpression :MatchExpression

Matching expression to filter Spectators.

Filtering is applied when Users try to join a public Game Room as Spectators (their User Variables must match the matching criteria).

Default Value
  • null

variables :Array.<SFSRoomVariable>

Maximum number of Room Variables allowed for the Room.
Type:
Default Value
  • (empty array)