

# Server SDK (Unreal) for Amazon GameLift Servers -- Actions
Server SDK for Unreal: Actions

Use the server SDK for Unreal to integrate your multiplayer game for hosting with Amazon GameLift Servers. For guidance about the integration process, see [Add Amazon GameLift Servers to your game server with the server SDK](gamelift-sdk-server-api.md).

**Note**  
This reference is for an earlier version of the server SDK for Amazon GameLift Servers. For the latest version, see [C\$1\$1 (Unreal) server SDK 5.x for Amazon GameLift Servers -- Actions](integration-server-sdk5-unreal-actions.md).

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

To set up the Unreal Engine plugin and see code examples [Integrate Amazon GameLift Servers into an Unreal Engine project](integration-engines-setup-unreal.md).

# Server SDK (Unreal) for Amazon GameLift Servers -- Data types
Data types

Use the Amazon GameLift Servers server SDK for Unreal reference to integrate your multiplayer game for hosting with Amazon GameLift Servers. For guidance about the integration process, see [Add Amazon GameLift Servers to your game server with the server SDK](gamelift-sdk-server-api.md).

**Note**  
This reference is for an earlier version of the server SDK for Amazon GameLift Servers. For the latest version, see [C\$1\$1 (Unreal) server SDK 5.x for Amazon GameLift Servers -- Data types](integration-server-sdk5-unreal-datatypes.md).

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

To set up the Unreal Engine plugin and see code examples [Integrate Amazon GameLift Servers into an Unreal Engine project](integration-engines-setup-unreal.md).

[Server SDK (Unreal) for Amazon GameLift Servers -- Actions](integration-server-sdk-unreal-ref-actions.md)

**Topics**
+ [

## FDescribePlayerSessionsRequest
](#integration-server-sdk-unreal-ref-dataypes-playersessions)
+ [

## FProcessParameters
](#integration-server-sdk-unreal-ref-dataypes-process)
+ [

## FStartMatchBackfillRequest
](#integration-server-sdk-unreal-ref-dataypes-startmatchbackfillrequest)
+ [

## FStopMatchBackfillRequest
](#integration-server-sdk-unreal-ref-dataypes-stopmatchbackfillrequest)

## FDescribePlayerSessionsRequest


This data type is used to specify which player session(s) to retrieve. You can use it as follows: 
+ Provide a PlayerSessionId to request a specific player session.
+ Provide a GameSessionId to request all player sessions in the specified game session.
+ Provide a PlayerId to request all player sessions for the specified player.

For large collections of player sessions, use the pagination parameters to retrieve results in sequential blocks.

### Contents


**GameSessionId**  
Unique game session identifier. Use this parameter to request all player sessions for the specified game session. Game session ID format is as follows: `arn:aws:gamelift:<region>::gamesession/fleet-<fleet ID>/<ID string>`. The value of <ID string> is either a custom ID string or (if one was specified when the game session was created) a generated string.   
Type: String  
Required: No

**Limit**  
Maximum number of results to return. Use this parameter with *NextToken* to get results as a set of sequential pages. If a player session ID is specified, this parameter is ignored.  
Type: Integer  
Required: No

**NextToken**  
Token indicating the start of the next sequential page of results. Use the token that is returned with a previous call to this action. To specify the start of the result set, do not specify a value. If a player session ID is specified, this parameter is ignored.  
Type: String  
Required: No

**PlayerId**  
Unique identifier for a player. Player IDs are defined by the developer. See [Generate player IDs](player-sessions-player-identifiers.md).  
Type: String  
Required: No

**PlayerSessionId**  
Unique identifier for a player session.  
Type: String  
Required: No

**PlayerSessionStatusFilter**  
Player session status to filter results on. Possible player session statuses include the following:  
+ RESERVED – The player session request has been received, but the player has not yet connected to the server process and/or been validated.
+ ACTIVE – The player has been validated by the server process and is currently connected.
+ COMPLETED – The player connection has been dropped.
+ TIMEDOUT – A player session request was received, but the player did not connect and/or was not validated within the time-out limit (60 seconds).
Type: String  
Required: No

## FProcessParameters


This data type contains the set of parameters sent to the Amazon GameLift Servers service in a [ProcessReady()](integration-server-sdk-unreal-ref-actions.md#integration-server-sdk-unreal-ref-processready) call.

### Contents


**port**  
Port number the server process will listen on for new player connections. The value must fall into the port range configured for any fleet deploying this game server build. This port number is included in game session and player session objects, which game sessions use when connecting to a server process.   
Type: Integer   
Required: Yes

**logParameters**  
Object with a list of directory paths to game session log files.   
Type: TArray<FString>  
Required: No

**onStartGameSession**  
Name of callback function that the Amazon GameLift Servers service invokes to activate a new game session. Amazon GameLift Servers calls this function in response to the client request [CreateGameSession](https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreateGameSession.html). The callback function takes a [GameSession](https://docs.aws.amazon.com/gamelift/latest/apireference/API_GameSession.html) object (defined in the *Amazon GameLift Servers Service API Reference*).   
Type: FOnStartGameSession   
Required: Yes

**onProcessTerminate**  
Name of callback function that the Amazon GameLift Servers service invokes to force the server process to shut down. After calling this function, Amazon GameLift Servers waits five minutes for the server process to shut down and respond with a [ProcessEnding()](integration-server-sdk-unreal-ref-actions.md#integration-server-sdk-unreal-ref-processending) call before it shuts down the server process.  
Type: FSimpleDelegate  
Required: No

**onHealthCheck**  
Name of callback function that the Amazon GameLift Servers service invokes to request a health status report from the server process. Amazon GameLift Servers calls this function every 60 seconds. After calling this function Amazon GameLift Servers waits 60 seconds for a response, and if none is received. records the server process as unhealthy.  
Type: FOnHealthCheck  
Required: No

**onUpdateGameSession**  
Name of callback function that the Amazon GameLift Servers service invokes to pass an updated game session object to the server process. Amazon GameLift Servers calls this function when a [ match backfill](https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-backfill.html) request has been processed in order to provide updated matchmaker data. It passes a [GameSession](https://docs.aws.amazon.com/gamelift/latest/apireference/API_GameSession.html) object, a status update (`updateReason`), and the match backfill ticket ID.   
Type: FOnUpdateGameSession   
Required: No

## FStartMatchBackfillRequest


This data type is used to send a matchmaking backfill request. The information is communicated to the Amazon GameLift Servers service in a [StartMatchBackfill()](integration-server-sdk-unreal-ref-actions.md#integration-server-sdk-unreal-ref-startmatchbackfill) call.

### Contents


**GameSessionArn**  
 Unique game session identifier. The API action [GetGameSessionId()](integration-server-sdk-unreal-ref-actions.md#integration-server-sdk-unreal-ref-getgamesessionid) returns the identifier in ARN format.  
Type: FString  
Required: Yes

**MatchmakingConfigurationArn**  
Unique identifier, in the form of an ARN, for the matchmaker to use for this request. To find the matchmaker that was used to create the original game session, look in the game session object, in the matchmaker data property. Learn more about matchmaker data in [ Work with matchmaker data](https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-server.html#match-server-data).   
Type: FString  
Required: Yes

**Players**  
A set of data representing all players who are currently in the game session. The matchmaker uses this information to search for new players who are good matches for the current players. See the *Amazon GameLift Servers API Reference Guide* for a description of the Player object format. To find player attributes, IDs, and team assignments, look in the game session object, in the matchmaker data property. If latency is used by the matchmaker, gather updated latency for the current region and include it in each player's data.   
Type: TArray[<FPlayer>](https://docs.aws.amazon.com/gamelift/latest/apireference/API_Player.html)  
Required: Yes

**TicketId**  
Unique identifier for a matchmaking or match backfill request ticket. If no value is provided here, Amazon GameLift Servers will generate one in the form of a UUID. Use this identifier to track the match backfill ticket status or cancel the request if needed.   
Type: FString  
Required: No

## FStopMatchBackfillRequest


This data type is used to cancel a matchmaking backfill request. The information is communicated to the Amazon GameLift Servers service in a [StopMatchBackfill()](integration-server-sdk-unreal-ref-actions.md#integration-server-sdk-unreal-ref-stopmatchbackfill) call.

### Contents


**GameSessionArn**  
Unique game session identifier associated with the request being canceled.   
Type: FString  
Required: Yes

**MatchmakingConfigurationArn**  
Unique identifier of the matchmaker this request was sent to.   
Type: FString  
Required: Yes

**TicketId**  
Unique identifier of the backfill request ticket to be canceled.  
Type: FString  
Required: Yes

[Server SDK (Unreal) for Amazon GameLift Servers -- Data types](integration-server-sdk-unreal-ref-datatypes.md)

**Topics**
+ [

# Server SDK (Unreal) for Amazon GameLift Servers -- Data types
](integration-server-sdk-unreal-ref-datatypes.md)
+ [

## AcceptPlayerSession()
](#integration-server-sdk-unreal-ref-acceptplayersession)
+ [

## ActivateGameSession()
](#integration-server-sdk-unreal-ref-activategamesession)
+ [

## DescribePlayerSessions()
](#integration-server-sdk-unreal-ref-describeplayersessions)
+ [

## GetGameSessionId()
](#integration-server-sdk-unreal-ref-getgamesessionid)
+ [

## GetInstanceCertificate()
](#integration-server-sdk-unreal-ref-getinstancecertificate)
+ [

## GetSdkVersion()
](#integration-server-sdk-unreal-ref-getsdk)
+ [

## InitSDK()
](#integration-server-sdk-unreal-ref-initsdk)
+ [

## ProcessEnding()
](#integration-server-sdk-unreal-ref-processending)
+ [

## ProcessReady()
](#integration-server-sdk-unreal-ref-processready)
+ [

## RemovePlayerSession()
](#integration-server-sdk-unreal-ref-removeplayersession)
+ [

## StartMatchBackfill()
](#integration-server-sdk-unreal-ref-startmatchbackfill)
+ [

## StopMatchBackfill()
](#integration-server-sdk-unreal-ref-stopmatchbackfill)
+ [

## TerminateGameSession()
](#integration-server-sdk-unreal-ref-terminategamesession)
+ [

## UpdatePlayerSessionCreationPolicy()
](#integration-server-sdk-unreal-ref-updateplayersessioncreationpolicy)

## AcceptPlayerSession()


Notifies the Amazon GameLift Servers service that a player with the specified player session ID has connected to the server process and needs validation. Amazon GameLift Servers 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 Servers changes the status of the player slot from RESERVED to ACTIVE. 

### Syntax


```
FGameLiftGenericOutcome AcceptPlayerSession(const FString& playerSessionId)
```

### Parameters


**playerSessionId**  
Unique ID issued by the Amazon GameLift Servers service in response to a call to the AWS SDK Amazon GameLift Servers API action [CreatePlayerSession](https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreatePlayerSession.html). The game client references this ID when connecting to the server process.  
Type: FString  
Required: Yes

### Return value


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

## ActivateGameSession()


Notifies the Amazon GameLift Servers 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.

## DescribePlayerSessions()


Retrieves player session data, including settings, session metadata, and player data. Use this action to get information for a single player session, for all player sessions in a game session, or for all player sessions associated with a single player ID.

### Syntax


```
FGameLiftDescribePlayerSessionsOutcome DescribePlayerSessions(const FGameLiftDescribePlayerSessionsRequest &describePlayerSessionsRequest)
```

### Parameters


**describePlayerSessionsRequest**  
A [FDescribePlayerSessionsRequest](integration-server-sdk-unreal-ref-datatypes.md#integration-server-sdk-unreal-ref-dataypes-playersessions) object describing which player sessions to retrieve.  
Required: Yes

### Return value


If successful, returns a [FDescribePlayerSessionsRequest](integration-server-sdk-unreal-ref-datatypes.md#integration-server-sdk-unreal-ref-dataypes-playersessions) object containing a set of player session objects that fit the request parameters. Player session objects have a structure identical to the AWS SDK Amazon GameLift Servers API [PlayerSession](https://docs.aws.amazon.com/gamelift/latest/apireference/API_PlayerSession.html) data type.

## 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.

## GetInstanceCertificate()


Retrieves the file location of a pem-encoded TLS certificate that is associated with the fleet and its instances. AWS Certificate Manager generates this certificate when you create a new fleet with the certificate configuration set to GENERATED. Use this certificate to establish a secure connection with a game client and to encrypt client/server communication. 

### Syntax


```
FGameLiftGetInstanceCertificateOutcome GetInstanceCertificate()
```

### Parameters


This action has no parameters.

### Return value


If successful, returns a `GetInstanceCertificateOutcome` object containing the location of the fleet's TLS certificate file and certificate chain, which are stored on the instance. A root certificate file, extracted from the certificate chain, is also stored on the instance. If not successful, returns an error message. 

For more information about the certificate and certificate chain data, see [GetCertificate Response Elements](https://docs.aws.amazon.com/acm/latest/APIReference/API_GetCertificate.html#API_GetCertificate_ResponseElements) in the AWS Certificate Manager API Reference.

## 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


```
Aws::GameLift::AwsStringOutcome SdkVersionOutcome = 
    Aws::GameLift::Server::GetSdkVersion();
```

## InitSDK()


Initializes the Amazon GameLift Servers SDK. This method should be called on launch, before any other Amazon GameLift Servers-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 Servers 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 Servers service that the server process is ready to host game sessions. Call this method after successfully invoking [InitSDK()](#integration-server-sdk-unreal-ref-initsdk) and completing setup tasks that are required before the server process can host a game session. This method should be called only once per process.

### Syntax


```
FGameLiftGenericOutcome ProcessReady(FProcessParameters &processParameters)
```

### Parameters


**FProcessParameters**  
A [FProcessParameters](integration-server-sdk-unreal-ref-datatypes.md#integration-server-sdk-unreal-ref-dataypes-process) object communicating the following information about the server process:  
+ Names of callback methods, implemented in the game server code, that the Amazon GameLift Servers service invokes to communicate with the server process.
+ Port number that the server process is listening on.
+ Path to any game session-specific files that you want Amazon GameLift Servers to capture and store.
Required: Yes

### Return value


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

### Example


See the sample code in [Using the Unreal Engine Plugin](integration-engines-setup-unreal.md#integration-engines-setup-unreal-code).

## RemovePlayerSession()


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

### Syntax


```
FGameLiftGenericOutcome RemovePlayerSession(const FString& playerSessionId)
```

### Parameters


**playerSessionId**  
Unique ID issued by the Amazon GameLift Servers service in response to a call to the AWS SDK Amazon GameLift Servers API action [CreatePlayerSession](https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreatePlayerSession.html). The game client references this ID when connecting to the server process.  
Type: FString  
Required: Yes

### 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()](https://docs.aws.amazon.com/gamelift/latest/apireference/API_StartMatchBackfill.html). 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](https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-backfill.html).

This action is asynchronous. If new players are successfully matched, the Amazon GameLift Servers service delivers updated matchmaker data using the callback function `OnUpdateGameSession()`.

A server process can have only one active match backfill request at a time. To send a new request, first call [StopMatchBackfill()](#integration-server-sdk-unreal-ref-stopmatchbackfill) to cancel the original request.

### Syntax


```
FGameLiftStringOutcome StartMatchBackfill (FStartMatchBackfillRequest &startBackfillRequest);
```

### Parameters


**FStartMatchBackfillRequest**  
A [FStartMatchBackfillRequest](integration-server-sdk-unreal-ref-datatypes.md#integration-server-sdk-unreal-ref-dataypes-startmatchbackfillrequest) object that communicates the following information:  
+ A ticket ID to assign to the backfill request. This information is optional; if no ID is provided, Amazon GameLift Servers 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()](https://docs.aws.amazon.com/gamelift/latest/apireference/API_DescribeMatchmaking.html).

## StopMatchBackfill()


Cancels an active match backfill request that was created with [StartMatchBackfill()](#integration-server-sdk-unreal-ref-startmatchbackfill). See also the AWS SDK action [StopMatchmaking()](https://docs.aws.amazon.com/gamelift/latest/apireference/API_StopMatchmaking.html). Learn more about the [FlexMatch backfill feature](https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-backfill.html).

### Syntax


```
FGameLiftGenericOutcome StopMatchBackfill (FStopMatchBackfillRequest &stopBackfillRequest);
```

### Parameters


**StopMatchBackfillRequest**  
A [FStopMatchBackfillRequest](integration-server-sdk-unreal-ref-datatypes.md#integration-server-sdk-unreal-ref-dataypes-stopmatchbackfillrequest) object identifying the matchmaking ticket to cancel:   
+ ticket ID assigned to the backfill request being canceled
+ matchmaker the backfill request was sent to
+ game session associated with the backfill request
Required: Yes

### Return value


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

## TerminateGameSession()


**This method is deprecated with version 4.0.1. Instead, the server process should call [ProcessEnding()](#integration-server-sdk-unreal-ref-processending) after a game session has ended.**

Notifies the Amazon GameLift Servers service that the server process has ended the current game session. This action is called when the server process will remain active and ready to host a new game session. It should be called only after your game session termination procedure is complete, because it signals to Amazon GameLift Servers that the server process is immediately available to host a new game session. 

This action is not called if the server process will be shut down after the game session stops. Instead, call [ProcessEnding()](#integration-server-sdk-unreal-ref-processending) to signal that both the game session and the server process are ending. 

### 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 [https://docs.aws.amazon.com/gamelift/latest/apireference/API_UpdateGameSession.html](https://docs.aws.amazon.com/gamelift/latest/apireference/API_UpdateGameSession.html) action in the *Amazon GameLift Servers Service API Reference*).

### Syntax


```
FGameLiftGenericOutcome UpdatePlayerSessionCreationPolicy(EPlayerSessionCreationPolicy policy)
```

### Parameters


**Policy**  
Value indicating whether the game session accepts new players.   
Type: `EPlayerSessionCreationPolicy` enum. Valid values include:  
+ **ACCEPT\$1ALL** – Accept all new player sessions.
+ **DENY\$1ALL** – Deny all new player sessions.
Required: Yes

### Return value


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