GOG GALAXY SDK Documentation
GameServer
Collaboration diagram for GameServer:

Functions

GALAXY_DLL_EXPORT void GALAXY_CALLTYPE InitGameServer (const InitOptions &initOptions)
 Initializes the Galaxy Game Server with specified credentials. More...
 
GALAXY_DLL_EXPORT void GALAXY_CALLTYPE ShutdownGameServer ()
 Shuts down the Galaxy Game Server. More...
 
GALAXY_DLL_EXPORT void GALAXY_CALLTYPE ShutdownGameServerEx (const ShutdownOptions &shutdownOptions)
 Shuts down the Galaxy Game Server. More...
 
GALAXY_DLL_EXPORT IUser *GALAXY_CALLTYPE GameServerUser ()
 Returns an instance of IUser interface for the Game Server entity. More...
 
GALAXY_DLL_EXPORT IMatchmaking *GALAXY_CALLTYPE GameServerMatchmaking ()
 Returns an instance of IMatchmaking interface for the Game Server entity. More...
 
GALAXY_DLL_EXPORT INetworking *GALAXY_CALLTYPE GameServerNetworking ()
 Returns an instance of INetworking interface for the Game Server entity that allows to communicate as the lobby host. More...
 
GALAXY_DLL_EXPORT IUtils *GALAXY_CALLTYPE GameServerUtils ()
 Returns an instance of IUtils interface for the Game Server entity. More...
 
GALAXY_DLL_EXPORT ITelemetry *GALAXY_CALLTYPE GameServerTelemetry ()
 Returns an instance of ITelemetry. More...
 
GALAXY_DLL_EXPORT ILogger *GALAXY_CALLTYPE GameServerLogger ()
 Returns an instance of ILogger interface for the Game Server entity. More...
 
GALAXY_DLL_EXPORT void GALAXY_CALLTYPE ProcessGameServerData ()
 Makes the Game Server process its input and output streams. More...
 
GALAXY_DLL_EXPORT IListenerRegistrar *GALAXY_CALLTYPE GameServerListenerRegistrar ()
 Returns an instance of IListenerRegistrar interface the for Game Server entity. More...
 

Detailed Description

Overview

Game Server API is structured in the same way as Galaxy Peer API, providing global functions called GameServerUser(), GameServerMatchmaking(), GameServerNetworking() e.t.c. defined in GalaxyGameServerApi.h header file.

Objects, methods, or combinations of parameters that are not supposed to be used with Game Server, such as IUser::SetUserData(), IFriends::RequestFriendList(), IMatchmaking::SetLobbyMemberData() cause either IInvalidStateError or IInvalidArgumentError errors.

Since Game Server is a separate object, and in fact operates in a separate thread, separate methods are provided to control it: InitGameServer(), ProcessGameServerData(), and ShutdownGameServer().

Listeners

Corresponding global self-registering listeners are provided for all interfaces supported by the Game Server prefixed with 'GameServer': GameServerGlobalAuthListener(), GameServerGlobalLobbyEnteredListener() e.t.c.

Authentication

Game Server is authenticated anonymously using the IUser::SignInAnonymous(). This method is not available for the Galaxy Peer.

Matchmaking and networking

The Game Server is only allowed to create public non-host-migrating lobbies. Joining a specific lobby is not possible for the Game Server.

While in a lobby, the Game Server operates on the server INetworking interface, so incoming packets may be handled by the GameServerGlobalNetworkingListener.

Function Documentation

◆ GameServerListenerRegistrar()

GALAXY_DLL_EXPORT IListenerRegistrar* GALAXY_CALLTYPE galaxy::api::GameServerListenerRegistrar ( )

Returns an instance of IListenerRegistrar interface the for Game Server entity.

Returns
An instance of IListenerRegistrar.

◆ GameServerLogger()

GALAXY_DLL_EXPORT ILogger* GALAXY_CALLTYPE galaxy::api::GameServerLogger ( )

Returns an instance of ILogger interface for the Game Server entity.

Returns
An instance of ILogger.

◆ GameServerMatchmaking()

GALAXY_DLL_EXPORT IMatchmaking* GALAXY_CALLTYPE galaxy::api::GameServerMatchmaking ( )

Returns an instance of IMatchmaking interface for the Game Server entity.

Returns
An instance of IMatchmaking.

◆ GameServerNetworking()

GALAXY_DLL_EXPORT INetworking* GALAXY_CALLTYPE galaxy::api::GameServerNetworking ( )

Returns an instance of INetworking interface for the Game Server entity that allows to communicate as the lobby host.

Returns
An instance of INetworking.

◆ GameServerTelemetry()

GALAXY_DLL_EXPORT ITelemetry* GALAXY_CALLTYPE galaxy::api::GameServerTelemetry ( )

Returns an instance of ITelemetry.

Returns
An instance of ITelemetry.

◆ GameServerUser()

GALAXY_DLL_EXPORT IUser* GALAXY_CALLTYPE galaxy::api::GameServerUser ( )

Returns an instance of IUser interface for the Game Server entity.

Returns
An instance of IUser.

◆ GameServerUtils()

GALAXY_DLL_EXPORT IUtils* GALAXY_CALLTYPE galaxy::api::GameServerUtils ( )

Returns an instance of IUtils interface for the Game Server entity.

Returns
An instance of IUtils.

◆ InitGameServer()

GALAXY_DLL_EXPORT void GALAXY_CALLTYPE galaxy::api::InitGameServer ( const InitOptions initOptions)

Initializes the Galaxy Game Server with specified credentials.

Remarks
When you do not need the Game Server anymore, you should call ShutdownGameServer() in order to deactivate it and free its resources.
This method can succeed partially, in which case it leaves Game Server partially functional, hence even in case of an error, be sure to call ShutdownGameServer() when you do not need the Game Server anymore. See the documentation of specific interfaces on how they behave.
Parameters
[in]initOptionsThe group of the init options.

◆ ProcessGameServerData()

GALAXY_DLL_EXPORT void GALAXY_CALLTYPE galaxy::api::ProcessGameServerData ( )

Makes the Game Server process its input and output streams.

During the phase of processing data, Game Server recognizes specific events and casts notifications for callback listeners immediately.

This method should be called in a loop, preferably every frame, so that Galaxy is able to process input and output streams.

Remarks
When this method is not called, any asynchronous calls to Galaxy API cannot be processed and any listeners will not be properly called.

◆ ShutdownGameServer()

GALAXY_DLL_EXPORT void GALAXY_CALLTYPE galaxy::api::ShutdownGameServer ( )

Shuts down the Galaxy Game Server.

The Game Server is deactivated and brought to the state it had when it was created and before it was initialized.

Precondition
Delete all self-registering listeners before calling ShutdownGameServer().

◆ ShutdownGameServerEx()

GALAXY_DLL_EXPORT void GALAXY_CALLTYPE galaxy::api::ShutdownGameServerEx ( const ShutdownOptions shutdownOptions)

Shuts down the Galaxy Game Server.

The Game Server is deactivated and brought to the state it had when it was created and before it was initialized.

Precondition
Delete all self-registering listeners before calling ShutdownGameServerEx().
Parameters
[in]shutdownOptionsThe group of the shutdown options.