SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
Loading...
Searching...
No Matches
sfs3::requests::GameSettings Struct Reference

The settings specific to a Game Room, passed to CreateSFSGameRequest through RoomSettings::game. More...

#include <RoomSettings.h>

Public Attributes

bool isPublic = true
 Whether the game is public or private.
int32_t minPlayersToStartGame = 2
 The minimum number of players required to start the game.
int32_t invitationExpiryTime = 15
 In private games, the number of seconds the invited users have to reply to the invitation.
bool leaveLastJoinedRoom = true
 In private games, whether the players must leave their previous Room when joining the game.
bool notifyGameStarted = false
 Whether a game state change must be notified when the minimum number of players is reached.
std::optional< entities::match::MatchExpressionplayerMatchExpression
 The matching expression filtering the players.
std::optional< entities::match::MatchExpressionspectatorMatchExpression
 The matching expression filtering the spectators.
std::vector< InviteeinvitedPlayers
 In private games, the players to invite to join the game.
std::vector< std::string > searchableRooms
 In private games, the names of the Groups where the server should look for further players to invite, when invitedPlayers holds fewer users than minPlayersToStartGame.
std::shared_ptr< entities::SFSObjectinvitationParams
 In private games, additional custom parameters to send along with the invitation, such as a message for the recipient, the game details or the inviter's details.

Detailed Description

The settings specific to a Game Room, passed to CreateSFSGameRequest through RoomSettings::game.

On the server side a Game Room is an SFSGame, a Room subclass adding player matching, game invitations, public and private games and quick game joining. On the client side Game Rooms are regular Rooms whose isGame property is true.

NOTE: setting RoomSettings::isGame has no effect here. The server builds an SFSGame with its game flag already set and ignores the one carried by the request, so the flag matters only to a plain CreateRoomRequest.

See also
CreateSFSGameRequest

Member Data Documentation

◆ isPublic

bool sfs3::requests::GameSettings::isPublic = true

Whether the game is public or private.

A public game can be joined by any player whose User Variables match the playerMatchExpression. A private game can be joined by the users invited by the game creator through the invitedPlayers list.

◆ minPlayersToStartGame

int32_t sfs3::requests::GameSettings::minPlayersToStartGame = 2

The minimum number of players required to start the game.

When notifyGameStarted is true, reaching this number notifies the game start. It cannot be greater than RoomSettings::maxUsers.

◆ invitationExpiryTime

int32_t sfs3::requests::GameSettings::invitationExpiryTime = 15

In private games, the number of seconds the invited users have to reply to the invitation.

Must be within the 5 to 300 range; the suggested range is 10 to 40 seconds.

◆ leaveLastJoinedRoom

bool sfs3::requests::GameSettings::leaveLastJoinedRoom = true

In private games, whether the players must leave their previous Room when joining the game.

This applies to private games only, because users join the Game Room automatically when they accept the invitation, while public games are entered through a JoinRoomRequest which decides this on its own.

◆ notifyGameStarted

bool sfs3::requests::GameSettings::notifyGameStarted = false

Whether a game state change must be notified when the minimum number of players is reached.

When true the game state is carried by a reserved Room Variable, so listening to the ROOM_VARIABLES_UPDATE event tells a client that the game can start. The variable is created as global, so its updates are broadcast outside the Room too — useful, for example, to show the game state in a list of available games.

◆ playerMatchExpression

std::optional<entities::match::MatchExpression> sfs3::requests::GameSettings::playerMatchExpression

The matching expression filtering the players.

It is applied when users try to join a public Game Room as players (their User Variables must match the criteria), and when the server picks additional users to invite to a private game (see searchableRooms). It is not applied to the users the creator invited explicitly through invitedPlayers.

◆ spectatorMatchExpression

std::optional<entities::match::MatchExpression> sfs3::requests::GameSettings::spectatorMatchExpression

The matching expression filtering the spectators.

Applied when users try to join a public Game Room as spectators.

◆ invitedPlayers

std::vector<Invitee> sfs3::requests::GameSettings::invitedPlayers

In private games, the players to invite to join the game.

If they are fewer than minPlayersToStartGame, the server sends further invitations on its own, looking for users in the Room Groups listed in searchableRooms and filtering them through playerMatchExpression.

No more than 8 players can be invited from the client side.


The documentation for this struct was generated from the following file:
  • requests/RoomSettings.h