|
SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
|
Creates a new public or private game, including player matching criteria, invitation settings and more. More...
#include <CreateSFSGameRequest.h>
Public Member Functions | |
| CreateSFSGameRequest (RoomSettings settings) | |
Creates a new public or private game, including player matching criteria, invitation settings and more.
A game is created by instantiating an SFSGame on the server side, a specialized Room type providing advanced features during the creation phase of a game. The game specific configuration travels in the GameSettings carried by RoomSettings::game, which must be set: the request is rejected without it.
If the creation succeeds, a ROOM_ADD event is dispatched to all the users who subscribed the Group the Room is associated with, including the game creator. Otherwise the creator gets a ROOM_CREATION_ERROR event.
NOTE: a private game makes the server send invitations to join it. The invitees receive them as INVITATION events and answer with an InvitationReplyRequest; the creator is notified of each answer by an INVITATION_REPLY event.
requests::RoomSettings settings { "chess-42" }; settings.maxUsers = 2; requests::GameSettings game; game.minPlayersToStartGame = 2; game.playerMatchExpression = entities::match::MatchExpression("rank", NumberMatch::GREATER_THAN, 5); settings.game = std::move(game); sfs.send(requests::CreateSFSGameRequest(settings));
|
inline |
| settings | the settings describing the game to create; their game member must be set |