Package | com.smartfoxserver.v2.requests.game |
Class | public class SFSGameSettings |
Inheritance | SFSGameSettings RoomSettings Object |
On the server-side, a Game Room is represented by the SFSGame Java class which extends the Room class
providing new advanced features such as player matching, game invitations, public and private games, quick game joining, etc.
On the client side Game Rooms are regular Rooms with their isGame property set to true
.
See also
Property | Defined By | ||
---|---|---|---|
allowOwnerOnlyInvitation : Boolean
Specifies if the Room allows "Join Room" invitations to be sent by any user or just by its owner. | RoomSettings | ||
events : RoomEvents
Defines the flags indicating which events related to the Room are dispatched by the SmartFox client. | RoomSettings | ||
extension : RoomExtension
Defines the Extension that must be attached to the Room on the server-side, and its settings. | RoomSettings | ||
groupId : String
Defines the id of the Group to which the Room should belong. | RoomSettings | ||
invitationExpiryTime : int
In private games, defines the number of seconds that the users invited to join the game have to reply to the invitation. | SFSGameSettings | ||
invitationParams : ISFSObject
In private games, defines an optional object containing additional custom parameters to be sent together with the invitation. | SFSGameSettings | ||
invitedPlayers : Array
In private games, defines a list of User objects representing players to be invited to join the game. | SFSGameSettings | ||
isGame : Boolean
Indicates whether the Room is a Game Room or not. | RoomSettings | ||
isPublic : Boolean
Indicates whether the game is public or private. | SFSGameSettings | ||
leaveLastJoinedRoom : Boolean
In private games, indicates whether the players must leave the previous Room when joining the game or not. | SFSGameSettings | ||
maxSpectators : int
Defines the maximum number of spectators allowed in the Room (only for Game Rooms). | RoomSettings | ||
maxUsers : int
Defines the maximum number of users allowed in the Room. | RoomSettings | ||
maxVariables : int
Defines the maximum number of Room Variables allowed for the Room. | RoomSettings | ||
minPlayersToStartGame : int
Defines the minimum number of players required to start the game. | SFSGameSettings | ||
name : String
Defines the name of the Room. | RoomSettings | ||
notifyGameStarted : Boolean
Indicates if a game state change must be notified when the minimum number of players is reached. | SFSGameSettings | ||
password : String
Defines the password of the Room. | RoomSettings | ||
permissions : RoomPermissions
Defines the flags indicating which operations are permitted on the Room. | RoomSettings | ||
playerMatchExpression : MatchExpression
Defines the game matching expression to be used to filters players. | SFSGameSettings | ||
searchableRooms : Array
In private games, defines a list of Groups names where to search players to invite. | SFSGameSettings | ||
spectatorMatchExpression : MatchExpression
Defines the game matching expression to be used to filters spectators. | SFSGameSettings | ||
variables : Array
Defines a list of RooomVariable objects to be attached to the Room. | RoomSettings |
Method | Defined By | ||
---|---|---|---|
SFSGameSettings(name:String)
Creates a new SFSGameSettings instance. | SFSGameSettings |
invitationExpiryTime | property |
invitationExpiryTime:int
In private games, defines the number of seconds that the users invited to join the game have to reply to the invitation. The suggested range is 10 to 40 seconds.
The default value is 15
.
public function get invitationExpiryTime():int
public function set invitationExpiryTime(value:int):void
invitationParams | property |
invitationParams:ISFSObject
In private games, defines an optional object containing additional custom parameters to be sent together with the invitation.
This object must be an instance of SFSObject. Possible custom parameters to be transferred to the invitees are a message for the recipient, the game details (title, type...), the inviter details, etc.
The default value is null
.
public function get invitationParams():ISFSObject
public function set invitationParams(value:ISFSObject):void
See also
invitedPlayers | property |
invitedPlayers:Array
In private games, defines a list of User objects representing players to be invited to join the game.
If the invitations are less than the minimum number of players required to start the game (see the minPlayersToStartGame property), the server will send additional invitations automatically, searching users in the Room Groups specified in the searchableRooms list and filtering them by means of the object passed to the playerMatchExpression property.
The game matching criteria contained in the playerMatchExpression property do not apply to the users specified in this list.
The default value is null
.
public function get invitedPlayers():Array
public function set invitedPlayers(value:Array):void
See also
isPublic | property |
isPublic:Boolean
Indicates whether the game is public or private.
A public game can be joined by any player whose User Variables match the playerMatchExpression assigned to the Game Room. A private game can be joined by users invited by the game creator by means of invitedPlayers list.
The default value is true
.
public function get isPublic():Boolean
public function set isPublic(value:Boolean):void
See also
leaveLastJoinedRoom | property |
leaveLastJoinedRoom:Boolean
In private games, indicates whether the players must leave the previous Room when joining the game or not.
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.
The default value is true
.
public function get leaveLastJoinedRoom():Boolean
public function set leaveLastJoinedRoom(value:Boolean):void
minPlayersToStartGame | property |
minPlayersToStartGame:int
Defines the minimum number of players required to start the game.
If the notifyGameStarted property is set to true
, when this number is reached, the game start is notified.
The default value is 2
.
public function get minPlayersToStartGame():int
public function set minPlayersToStartGame(value:int):void
See also
notifyGameStarted | property |
notifyGameStarted:Boolean
Indicates if a game state change must be notified when the minimum number of players is reached.
If this setting is true
, the game state (started or stopped) is handled by means of the reserved Room Variable
represented by the ReservedRoomVariables.RV_GAME_STARTED constant. Listening to the roomVariablesUpdate event for this variable
allows clients to be notified when the game can start due to 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 games.
The default value is false
.
public function get notifyGameStarted():Boolean
public function set notifyGameStarted(value:Boolean):void
See also
playerMatchExpression | property |
playerMatchExpression:MatchExpression
Defines the game matching expression to be used to filters players.
Filtering is applied when:
Filtering is not applied to users invited by the creator to join a private game (see the invitedPlayers property).
The default value is null
.
public function get playerMatchExpression():MatchExpression
public function set playerMatchExpression(value:MatchExpression):void
See also
searchableRooms | property |
searchableRooms:Array
In private games, defines a list of Groups names where to search players to invite.
If the users invited to join the game (specified through the invitedPlayers property) are less than the minimum number of players required to start the game (see the minPlayersToStartGame property), the server will invite others automatically, searching them in Rooms belonging to the Groups specified in this list and filtering them by means of the object passed to the playerMatchExpression property.
The default value is null
.
public function get searchableRooms():Array
public function set searchableRooms(value:Array):void
See also
spectatorMatchExpression | property |
spectatorMatchExpression:MatchExpression
Defines the game matching expression to be used to filters spectators.
Filtering is applied when users try to join a public Game Room as spectators (their User Variables must match the matching criteria).
The default value is null
.
public function get spectatorMatchExpression():MatchExpression
public function set spectatorMatchExpression(value:MatchExpression):void
See also
SFSGameSettings | () | Constructor |
public function SFSGameSettings(name:String)
Creates a new SFSGameSettings instance. The instance must be passed to the CreateSFSGameRequest class constructor.
Parametersname:String — The name of the Game Room to be created.
|
See also