Amazon GameLift Server API Reference for
Unreal Engine: Actions

This Amazon GameLift Server API reference can help you prepare your Unreal Engine
game projects
for use with Amazon GameLift. For details on the integration process, see Add Amazon GameLift to Your Game Server.

This API is defined in GameLiftServerSDK.h and
GameLiftServerSDKModels.h.

AcceptPlayerSession()

Notifies the Amazon GameLift service that a player with the specified player session
ID has
connected to the server process and needs validation. Amazon GameLift verifies that
the player
session ID is valid—that is, that the player ID has reserved a player slot in the
game session. Once validated, Amazon GameLift changes the status of the player slot
from RESERVED
to ACTIVE.

Syntax

Parameters

playerSessionId

Unique ID issued by the Amazon GameLift service in response to
a call to the AWS SDK Amazon GameLift API action
CreatePlayerSession.
The game client references this ID when connecting to the server process.

Type: FString

Required: No

Return
Value

Returns a generic outcome consisting of success or failure with an error message.

ActivateGameSession()

Notifies the Amazon GameLift service that the server process has activated a game
session and is
now ready to receive player connections. This action should be called as part of the
onStartGameSession() callback function, after all game session
initialization has been completed.

Syntax

FGameLiftGenericOutcome ActivateGameSession()

Parameters

This action has no parameters.

Return Value

Returns a generic outcome consisting of success or failure with an error message.

GetGameSessionId()

Retrieves the ID of the game session currently being hosted by the server process,
if
the server process is active.

Syntax

FGameLiftStringOutcome GetGameSessionId()

Parameters

This action has no parameters.

Return Value

If successful, returns the game session ID as an FGameLiftStringOutcome object.
If not successful, returns an error message.

GetSdkVersion()

Returns the current version number of the SDK built into the server process.

Syntax

FGameLiftStringOutcome GetSdkVersion();

Parameters

This action has no parameters.

Return Value

If successful, returns the current SDK version as an
FGameLiftStringOutcome object. The returned string includes the
version number only (ex. "3.1.5"). If not successful, returns an error
message.

Example

InitSDK()

Initializes the Amazon GameLift SDK. This method should be called on launch, before
any other
Amazon GameLift-related initialization occurs.

Syntax

FGameLiftGenericOutcome InitSDK()

Parameters

This action has no parameters.

Return Value

Returns a generic outcome consisting of success or failure with an error message.

ProcessEnding()

Notifies the Amazon GameLift service that the server process is shutting down. This
method
should be called after all other cleanup tasks, including shutting down all active
game
sessions. This method should exit with an exit code of 0; a non-zero exit code results
in an event message that the process did not exit cleanly.

Syntax

FGameLiftGenericOutcome ProcessEnding()

Parameters

This action has no parameters.

Return Value

Returns a generic outcome consisting of success or failure with an error message.

ProcessReady()

Notifies the Amazon GameLift service that the server process is ready to host game
sessions.
This method should be called after successfully invoking InitSDK() and completing any
setup tasks required before the server process can host a game session.

Return Value

Example

RemovePlayerSession()

Notifies the Amazon GameLift service that a player with the specified player session
ID has
disconnected from the server process. In response, Amazon GameLift changes the player
slot to
available, which allows it to be assigned to a new player.

Syntax

Parameters

playerSessionId

Unique ID issued by the Amazon GameLift service in response to
a call to the AWS SDK Amazon GameLift API action
CreatePlayerSession.
The game client references this ID when connecting to the server process.

Type: FString

Required: No

Return Value

Returns a generic outcome consisting of success or failure with an error message.

StartMatchBackfill()

Sends a request to find new players for open slots in a game session created with
FlexMatch. See also the AWS SDK action StartMatchBackfill(). With this action, match backfill requests can be
initiated by a game server process that is hosting the game session. Learn more about
the FlexMatch backfill feature in Backfill Existing Games with FlexMatch.

A server process can have only one active match backfill request at a time. To send
a
new request, first call StopMatchBackfill() to cancel the
original request.

Parameters

A ticket ID to assign to the backfill request. This
information is optional; if no ID is provided, Amazon GameLift will
autogenerate one.

The matchmaker to send the request to. The full configuration
ARN is required. This value can be acquired from the game
session's matchmaker data.

The ID of the game session that is being backfilled.

Available matchmaking data for the game session's current
players.

Required: Yes

Return
Value

If successful, returns the match backfill ticket as a
FGameLiftStringOutcome object. If not successful, returns an error
message. Ticket status can be tracked using the AWS SDK action DescribeMatchmaking().

Return Value

Returns a generic outcome consisting of success or failure with an error message.

TerminateGameSession()

Notifies the Amazon GameLift service that the server process has shut down the game
session.
(Currently, each server process hosts only one game session at a time, so there's
no
need to specify which session.) This action should be called at the end of the game
session shutdown process. After calling this action, the server process can call ProcessReady() to signal its
availability to host a new game session. Alternatively, it can call ProcessEnding() to shut down the
server process and terminate the instance.

Syntax

FGameLiftGenericOutcome TerminateGameSession()

Parameters

This action has no parameters.

Return Value

Returns a generic outcome consisting of success or failure with an error message.

UpdatePlayerSessionCreationPolicy()

Updates the current game session's ability to accept new player sessions. A game
session can be set to either accept or deny all new player sessions. (See also the
UpdateGameSession() action in the Amazon GameLift Service API Reference).