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

Creates a new public or private game, including player matching criteria, invitation settings and more. More...

#include <CreateSFSGameRequest.h>

Inheritance diagram for sfs3::requests::CreateSFSGameRequest:
[legend]

Public Member Functions

 CreateSFSGameRequest (RoomSettings settings)

Detailed Description

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));
See also
GameSettings
RoomSettings
CreateRoomRequest
inv::InvitationReplyRequest

Constructor & Destructor Documentation

◆ CreateSFSGameRequest()

sfs3::requests::CreateSFSGameRequest::CreateSFSGameRequest ( RoomSettings settings)
inline
Parameters
settingsthe settings describing the game to create; their game member must be set

The documentation for this class was generated from the following files:
  • requests/game/CreateSFSGameRequest.h
  • requests/game/CreateSFSGameRequest.cpp