

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# Server C\+\+ (Unreal) SDK 5.x per -- Azioni Amazon GameLift Servers
<a name="integration-server-sdk5-unreal-actions"></a>

Usa il riferimento all'Amazon GameLift ServersUnreal Server SDK 5.x per aiutarti a preparare il tuo gioco multiplayer da utilizzare con. Amazon GameLift Servers Per i dettagli sul processo di integrazione, consulta. [Aggiungi Amazon GameLift Servers al tuo server di gioco con l'SDK del server](gamelift-sdk-server-api.md) Se stai usando il Amazon GameLift Servers plugin per Unreal, vedi anche[Amazon GameLift Serversplugin per Unreal Engine](unreal-plugin.md).

**Nota**  
Questo argomento descrive l'API Amazon GameLift Servers C\+\+ che puoi usare quando compili per Unreal Engine. In particolare, questa documentazione si applica al codice compilato con l'opzione. `-DBUILD_FOR_UNREAL=1` 

[Server C\+\+ (Unreal) SDK 5.x per Amazon GameLift Servers -- Tipi di dati](integration-server-sdk5-unreal-datatypes.md)

**Topics**
+ [Server C\+\+ (Unreal) SDK 5.x per Amazon GameLift Servers -- Tipi di dati](integration-server-sdk5-unreal-datatypes.md)
+ [GetSdkVersion()](#integration-server-sdk5-unreal-getsdkversion)
+ [InitSDK()](#integration-server-sdk5-unreal-initsdk)
+ [InitSDK()](#integration-server-sdk5-unreal-initsdk-anywhere)
+ [ProcessReady()](#integration-server-sdk5-unreal-processready)
+ [ProcessEnding()](#integration-server-sdk5-unreal-processending)
+ [ActivateGameSession()](#integration-server-sdk5-unreal-activategamesession)
+ [UpdatePlayerSessionCreationPolicy()](#integration-server-sdk5-unreal-updateplayersessioncreationpolicy)
+ [GetGameSessionId()](#integration-server-sdk5-unreal-getgamesessionid)
+ [GetTerminationTime()](#integration-server-sdk5-unreal-getterm)
+ [AcceptPlayerSession()](#integration-server-sdk5-unreal-acceptplayersession)
+ [RemovePlayerSession()](#integration-server-sdk5-unreal-removeplayersession)
+ [DescribePlayerSessions()](#integration-server-sdk5-unreal-describeplayersessions)
+ [StartMatchBackfill()](#integration-server-sdk5-unreal-startmatchbackfill)
+ [StopMatchBackfill()](#integration-server-sdk5-unreal-stopmatchbackfill)
+ [GetComputeCertificate()](#integration-server-sdk5-unreal-getcomputecertificate)
+ [GetFleetRoleCredentials()](#integration-server-sdk5-unreal-getfleetrolecredentials)
+ [Distruggi ()](#integration-server-sdk5-unreal-ref-destroy)

## GetSdkVersion()
<a name="integration-server-sdk5-unreal-getsdkversion"></a>

Restituisce il numero di versione corrente dell'SDK integrato nel processo del server.

### Sintassi
<a name="integration-server-sdk5-unreal-getsdkversion-syntax"></a>

```
FGameLiftStringOutcome GetSdkVersion();
```

### Valore restituito
<a name="integration-server-sdk5-unreal-getsdkversion-return"></a>

Se l'esito è positivo, restituisce la versione corrente dell'SDK come oggetto [FGameLiftStringOutcome](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-awsstringoutcome). L'oggetto restituito include il numero di versione (esempio`5.0.0`). Se l'esito è negativo, verrà restituito un messaggio di errore.

### Esempio
<a name="integration-server-sdk5-unreal-getsdkversion-example"></a>

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

## InitSDK()
<a name="integration-server-sdk5-unreal-initsdk"></a>

Inizializza l'Amazon GameLift ServersSDK per una flotta EC2 gestita. Richiama questo metodo all'avvio, prima che si verifichi qualsiasi altra inizializzazione correlata a. Amazon GameLift Servers Questo metodo legge i parametri del server dall'ambiente host per configurare la comunicazione tra il server e il Amazon GameLift Servers servizio. Utilizza un token di idempotenza, quindi puoi riprovare a eseguire questa chiamata in tutta sicurezza quando fallisce.

### Sintassi
<a name="integration-server-sdk5-unreal-initsdk-syntax"></a>

```
FGameLiftGenericOutcome InitSDK()
```

### Valore restituito
<a name="integration-server-sdk5-unreal-initsdk-return"></a>

In caso di successo, restituisce un `InitSdkOutcome` oggetto che indica che il processo del server è pronto per la chiamata. [ProcessReady()](#integration-server-sdk5-unreal-processready) 

### Esempio
<a name="integration-server-sdk5-unreal-initsdk-example"></a>

```
//Call InitSDK to establish a local connection with the Amazon GameLift Servers Agent to enable further communication.
FGameLiftGenericOutcome initSdkOutcome = GameLiftSdkModule->InitSDK();
```

## InitSDK()
<a name="integration-server-sdk5-unreal-initsdk-anywhere"></a>

Inizializza l'Amazon GameLift ServersSDK per una flotta Anywhere o una flotta di container gestita. Richiama questo metodo all'avvio, prima che si verifichi qualsiasi altra inizializzazione correlata a. Amazon GameLift Servers Questo metodo richiede parametri espliciti del server per configurare la comunicazione tra il server e il Amazon GameLift Servers servizio. Utilizza un token di idempotenza, quindi puoi riprovare a ripetere questa chiamata in tutta sicurezza quando fallisce.

### Sintassi
<a name="integration-server-sdk5-unreal-initsdk-anywhere-syntax"></a>

```
FGameLiftGenericOutcome InitSDK(serverParameters)
```

### Parameters
<a name="integration-server-sdk5-unreal-initsdk-anywhere-parameter"></a>

[FServerParametri](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-serverparameters)  
Per inizializzare un server di gioco su una flotta Amazon GameLift Servers Anywhere, costruisci un `ServerParameters` oggetto con le seguenti informazioni:  
+ L'URL WebSocket utilizzato per connettersi al server di gioco. 
+ L'ID del processo utilizzato per ospitare il server di gioco. 
+ L'ID del computer che ospita i processi del server di gioco. 
+ L'ID della Amazon GameLift Servers flotta contenente il tuo computer Amazon GameLift Servers Anywhere.
+ Il token di autorizzazione generato dall'Amazon GameLift Serversoperazione. 

### Valore restituito
<a name="integration-server-sdk5-unreal-initsdk-anywhere-return"></a>

In caso di successo, restituisce un `InitSdkOutcome` oggetto che indica che il processo del server è pronto per la chiamata[ProcessReady()](#integration-server-sdk5-unreal-processready). 

**Nota**  
Se le chiamate a non `InitSDK()` riescono per le build di gioco distribuite sulle flotte Anywhere, controlla il `ServerSdkVersion` parametro utilizzato durante la creazione della risorsa di compilazione. È necessario impostare esplicitamente questo valore sulla versione SDK del server in uso. Il valore predefinito per questo parametro è 4.x, che non è compatibile. Per risolvere questo problema, crea una nuova build e distribuiscila in una nuova flotta.

### Esempio
<a name="integration-server-sdk5-unreal-initsdk-anywhere-example"></a>

```
//Define the server parameters
FServerParameters serverParameters;
parameters.m_authToken = "1111aaaa-22bb-33cc-44dd-5555eeee66ff"; 
parameters.m_fleetId = "arn:aws:gamelift:us-west-1:111122223333:fleet/fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa";
parameters.m_hostId = "HardwareAnywhere"; 
parameters.m_processId = "PID1234";
parameters.m_webSocketUrl = "wss://us-west-1.api.amazongamelift.com"; 

//Call InitSDK to establish a local connection with the Amazon GameLift Servers Agent to enable further communication.
FGameLiftGenericOutcome initSdkOutcome = GameLiftSdkModule->InitSDK(serverParameters);
```

## ProcessReady()
<a name="integration-server-sdk5-unreal-processready"></a>

Notifica Amazon GameLift Servers che il processo del server è pronto per ospitare sessioni di gioco. Chiama questo metodo dopo averlo [InitSDK()](#integration-server-sdk5-unreal-initsdk) invocato. Questo metodo deve essere chiamato solo una volta per processo.

### Sintassi
<a name="integration-server-sdk5-unreal-processready-syntax"></a>

`GenericOutcome ProcessReady(const Aws::GameLift::Server::ProcessParameters &processParameters);`

### Parameters
<a name="integration-server-sdk5-unreal-processready-parameter"></a>

**processParameters**  
Un [FProcessParametri](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-process) oggetto che comunica le seguenti informazioni sul processo del server:  
+ Nomi dei metodi di callback implementati nel codice del server di gioco richiamato dal Amazon GameLift Servers servizio per comunicare con il processo del server.
+ Numero di porta sulla quale è in ascolto il processo del server.
+ Percorso verso qualsiasi file specifico di una sessione di gioco che Amazon GameLift Servers deve acquisire e archiviare.

### Valore restituito
<a name="integration-server-sdk5-unreal-processready-return"></a>

Restituisce un risultato generico composto da successo o fallimento con un messaggio di errore.

### Esempio
<a name="integration-server-sdk5-unreal-processready-example"></a>

Questo esempio illustra la chiamata [ProcessReady()](#integration-server-sdk5-unreal-processready) e le implementazioni della funzione delegata.

```
//Calling ProcessReady tells Amazon GameLift Servers this game server is ready to receive incoming game sessions!
UE_LOG(GameServerLog, Log, TEXT("Calling Process Ready"));
FGameLiftGenericOutcome processReadyOutcome = GameLiftSdkModule->ProcessReady(*params);
```

## ProcessEnding()
<a name="integration-server-sdk5-unreal-processending"></a>

Notifica Amazon GameLift Servers che il processo del server sta terminando. Chiama questo metodo dopo tutte le altre attività di pulizia (inclusa la chiusura della sessione di gioco attiva) e prima di terminare il processo. A seconda del risultato di`ProcessEnding()`, il processo termina con successo (0) o errore (-1) e genera un evento relativo alla flotta. Se il processo termina con un errore, l'evento di flotta generato è`SERVER_PROCESS_TERMINATED_UNHEALTHY`).

### Sintassi
<a name="integration-server-sdk5-unreal-processending-syntax"></a>

```
FGameLiftGenericOutcome ProcessEnding()
```

### Valore restituito
<a name="integration-server-sdk5-unreal-processending-return"></a>

Restituisce un risultato generico costituito da successo o fallimento con un messaggio di errore.

### Esempio
<a name="integration-server-sdk5-unreal-processending-example"></a>

```
//OnProcessTerminate callback. Amazon GameLift Servers will invoke this callback before shutting down an instance hosting this game server.
//It gives this game server a chance to save its state, communicate with services, etc., before being shut down.
//In this case, we simply tell Amazon GameLift Servers we are indeed going to shutdown.
params->OnTerminate.BindLambda([=]() {
  UE_LOG(GameServerLog, Log, TEXT("Game Server Process is terminating"));
  GameLiftSdkModule->ProcessEnding();
});
```

## ActivateGameSession()
<a name="integration-server-sdk5-unreal-activategamesession"></a>

Notifica Amazon GameLift Servers che il processo del server ha attivato una sessione di gioco ed è ora pronto a ricevere le connessioni dei giocatori. Questa azione dovrebbe essere richiamata come parte della funzione di `onStartGameSession()` callback, dopo l'inizializzazione di tutta la sessione di gioco.

### Sintassi
<a name="integration-server-sdk5-unreal-activategamesession-syntax"></a>

```
FGameLiftGenericOutcome ActivateGameSession()
```

### Valore restituito
<a name="integration-server-sdk5-unreal-activategamesession-return"></a>

Restituisce un risultato generico composto da successo o fallimento con un messaggio di errore.

### Esempio
<a name="integration-server-sdk5-unreal-activategamesession-example"></a>

Questo esempio mostra le `ActivateGameSession()` chiamate come parte della funzione `onStartGameSession()` delegata. 

```
//When a game session is created, Amazon GameLift Servers sends an activation request to the game server and passes along the game session object containing game properties and other settings.
//Here is where a game server should take action based on the game session object.
//Once the game server is ready to receive incoming player connections, it should invoke GameLiftServerAPI.ActivateGameSession()
auto onGameSession = [=](Aws::GameLift::Server::Model::GameSession gameSession)
{
  FString gameSessionId = FString(gameSession.GetGameSessionId());
  UE_LOG(GameServerLog, Log, TEXT("GameSession Initializing: %s"), *gameSessionId);
  GameLiftSdkModule->ActivateGameSession();
};
```

## UpdatePlayerSessionCreationPolicy()
<a name="integration-server-sdk5-unreal-updateplayersessioncreationpolicy"></a>

Aggiorna la capacità della sessione di gioco corrente di accettare nuove sessioni giocatore. Una sessione di gioco può essere configurata per accettare o rifiutare tutte le nuove sessioni giocatore.

### Sintassi
<a name="integration-server-sdk5-unreal-updateplayersessioncreationpolicy-syntax"></a>

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

### Parameters
<a name="integration-server-sdk5-unreal-updateplayersessioncreationpolicy-parameter"></a>

**playerCreationSessionPolitica**  
Valore della stringa che indica se la sessione di gioco accetta nuovi giocatori.   
I valori validi includono:  
+ **ACCEPT\_ALL**: accetta tutte le nuove sessioni giocatore.
+ **DENY\_ALL**: rifiuta tutte le nuove sessioni giocatore.

### Valore restituito
<a name="integration-server-sdk5-unreal-updateplayersessioncreationpolicy-return"></a>

Restituisce un risultato generico costituito da successo o fallimento con un messaggio di errore.

### Esempio
<a name="integration-server-sdk5-unreal-updateplayersessioncreationpolicy-example"></a>

Questo esempio definisce la policy di partecipazione alla sessione di gioco corrente per accettare tutti i giocatori.

```
FGameLiftGenericOutcome outcome = GameLiftSdkModule->UpdatePlayerSessionCreationPolicy(Aws::GameLift::Model::EPlayerSessionCreationPolicy::ACCEPT_ALL);
```

## GetGameSessionId()
<a name="integration-server-sdk5-unreal-getgamesessionid"></a>

Recupera l'ID della sessione di gioco ospitata dal processo del server attivo. 

Per i processi inattivi che non vengono attivati con una sessione di gioco, la chiamata restituisce un. [FGameLiftError](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-gamelifterror)

### Sintassi
<a name="integration-server-sdk5-unreal-getgamesessionid-syntax"></a>

```
FGameLiftStringOutcome GetGameSessionId()
```

### Parameters
<a name="integration-server-sdk5-unreal-getgamesessionid-parameter"></a>

Questa operazione non prevede parametri.

### Valore restituito
<a name="integration-server-sdk5-unreal-getgamesessionid-return"></a>

Se l'esito è positivo, l'ID della sessione di gioco verrà restituito come oggetto [FGameLiftStringOutcome](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-awsstringoutcome). Se non riesce, restituisce un messaggio di errore».

Per i processi inattivi che non vengono attivati con una sessione di gioco, la chiamata restituisce `Success` = `True` e `GameSessionId` =`""`.

### Esempio
<a name="integration-server-sdk5-unreal-getgamesessionid-example"></a>

```
//When a game session is created, Amazon GameLift Servers sends an activation request to the game server and passes along the game session object containing game properties and other settings.
//Here is where a game server should take action based on the game session object.
//Once the game server is ready to receive incoming player connections, it should invoke GameLiftServerAPI.ActivateGameSession()
auto onGameSession = [=](Aws::GameLift::Server::Model::GameSession gameSession)
{
  FString gameSessionId = FString(gameSession.GetGameSessionId());
  UE_LOG(GameServerLog, Log, TEXT("GameSession Initializing: %s"), *gameSessionId);
  GameLiftSdkModule->ActivateGameSession();
};
```

## GetTerminationTime()
<a name="integration-server-sdk5-unreal-getterm"></a>

Restituisce il tempo di arresto pianificato di un processo del server, se è disponibile un tempo di chiusura. Un processo server interviene dopo aver ricevuto una `onProcessTerminate()` richiamata da. Amazon GameLift Servers Amazon GameLift Serverschiama `onProcessTerminate()` per i seguenti motivi: 
+ Quando il processo del server ha segnalato problemi di salute o non ha risposto. Amazon GameLift Servers
+ Quando si termina l'istanza durante un evento di scale-down.
+ [Quando un'istanza viene terminata a causa di un'interruzione di un'istanza spot.](spot-tasks.md)

### Sintassi
<a name="integration-server-sdk5-unreal-getterm-syntax"></a>

```
AwsDateTimeOutcome GetTerminationTime()
```

### Valore restituito
<a name="integration-server-sdk5-unreal-getterm-return"></a>

In caso di successo, restituisce l'ora di terminazione come oggetto. `AwsDateTimeOutcome` Il valore è il tempo di terminazione, espresso in segni di spunta trascorsi da allora. `0001 00:00:00` Ad esempio, il valore della data e dell'ora è uguale ai segni di `2020-09-13 12:26:40 -000Z` spunta. `637355968000000000` Se non è disponibile alcun orario di terminazione, restituisce un messaggio di errore.

Se il processo non ha ricevuto una ` ProcessParameters.OnProcessTerminate()` richiamata, viene restituito un messaggio di errore. Per ulteriori informazioni sulla chiusura di un processo server, vedere. [Rispondi a una notifica di chiusura del processo del server](gamelift-sdk-server-api.md#gamelift-sdk-server-terminate)

### Esempio
<a name="integration-server-sdk5-unreal-getterm-example"></a>

```
AwsDateTimeOutcome TermTimeOutcome = GameLiftSdkModule->GetTerminationTime();
```

## AcceptPlayerSession()
<a name="integration-server-sdk5-unreal-acceptplayersession"></a>

Notifica Amazon GameLift Servers che un giocatore con l'ID di sessione specificato si è connesso al processo del server e deve essere convalidato. Amazon GameLift Serversverifica che l'ID della sessione del giocatore sia valido. Dopo la convalida della sessione di gioco, Amazon GameLift Servers modifica lo stato dello slot del giocatore da RISERVATO ad ATTIVO. 

### Sintassi
<a name="integration-server-sdk5-unreal-acceptplayersession-syntax"></a>

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

### Parameters
<a name="integration-server-sdk5-unreal-acceptplayersession-parameter"></a>

playerSessionId  
ID univoco rilasciato Amazon GameLift Servers quando viene creata una nuova sessione giocatore.

### Valore restituito
<a name="integration-server-sdk5-unreal-acceptplayersession-return"></a>

Restituisce un risultato generico composto da successo o fallimento con un messaggio di errore. 

### Esempio
<a name="integration-server-sdk5-unreal-acceptplayersession-example"></a>

Questo esempio gestisce una richiesta di connessione che include la convalida e il rifiuto di una sessione giocatore non valida. IDs

```
bool GameLiftManager::AcceptPlayerSession(const FString& playerSessionId, const FString& playerId)
{
  #if WITH_GAMELIFT
  UE_LOG(GameServerLog, Log, TEXT("Accepting GameLift PlayerSession: %s . PlayerId: %s"), *playerSessionId, *playerId);
  FString gsId = GetCurrentGameSessionId();
  if (gsId.IsEmpty()) {
    UE_LOG(GameServerLog, Log, TEXT("No GameLift GameSessionId. Returning early!"));
    return false;
  }
  
  if (!GameLiftSdkModule->AcceptPlayerSession(playerSessionId).IsSuccess()) {
    UE_LOG(GameServerLog, Log, TEXT("PlayerSession not Accepted."));
    return false;
  }

  // Add PlayerSession from internal data structures keeping track of connected players
  connectedPlayerSessionIds.Add(playerSessionId);
  idToPlayerSessionMap.Add(playerSessionId, PlayerSession{ playerId, playerSessionId });
  return true;
  #else
  return false;
  #endif
}
```

## RemovePlayerSession()
<a name="integration-server-sdk5-unreal-removeplayersession"></a>

Notifica Amazon GameLift Servers che un giocatore si è disconnesso dal processo del server. In risposta, Amazon GameLift Servers modifica lo slot del giocatore rendendolo disponibile. 

### Sintassi
<a name="integration-server-sdk5-unreal-removeplayersession-syntax"></a>

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

### Parameters
<a name="integration-server-sdk5-unreal-removeplayersession-parameter"></a>

**`playerSessionId`**  
ID univoco rilasciato Amazon GameLift Servers quando viene creata una nuova sessione di gioco.

### Valore restituito
<a name="integration-server-sdk5-unreal-removeplayersession-return"></a>

Restituisce un risultato generico composto da successo o fallimento con un messaggio di errore.

### Esempio
<a name="integration-server-sdk5-unreal-removeplayersession-example"></a>

```
bool GameLiftManager::RemovePlayerSession(const FString& playerSessionId)
{
  #if WITH_GAMELIFT
  UE_LOG(GameServerLog, Log, TEXT("Removing GameLift PlayerSession: %s"), *playerSessionId);

  if (!GameLiftSdkModule->RemovePlayerSession(playerSessionId).IsSuccess()) {
    UE_LOG(GameServerLog, Log, TEXT("PlayerSession Removal Failed"));
    return false;
  }

  // Remove PlayerSession from internal data structures that are keeping track of connected players
  connectedPlayerSessionIds.Remove(playerSessionId);
  idToPlayerSessionMap.Remove(playerSessionId);

  // end the session if there are no more players connected
  if (connectedPlayerSessionIds.Num() == 0) {
    EndSession();
  }

  return true;
  #else
  return false;
  #endif
}
```

## DescribePlayerSessions()
<a name="integration-server-sdk5-unreal-describeplayersessions"></a>

Recupera i dati della sessione del giocatore che includono impostazioni, metadati della sessione e dati del giocatore. Utilizzate questo metodo per ottenere informazioni su quanto segue:
+ Una sessione per giocatore singolo
+ Tutte le sessioni dei giocatori in una sessione di gioco
+ Tutte le sessioni dei giocatori sono associate a un ID giocatore singolo

### Sintassi
<a name="integration-server-sdk5-unreal-describeplayersessions-syntax"></a>

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

### Parameters
<a name="integration-server-sdk5-unreal-describeplayersessions-parameter"></a>

**[FGameLiftDescribePlayerSessionsRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-playersessions)**  
Un [FGameLiftDescribePlayerSessionsRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-playersessions) oggetto che descrive le sessioni dei giocatori da recuperare.

### Valore restituito
<a name="integration-server-sdk5-unreal-describeplayersessions-return"></a>

Se l'esito è positivo, restituisce un oggetto [FGameLiftDescribePlayerSessionsOutcome](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-describeplayersessionsoutcome) contenente un set di oggetti di sessione giocatore corrispondente ai parametri della richiesta.

### Esempio
<a name="integration-server-sdk5-unreal-describeplayersessions-example"></a>

Questo esempio richiede che tutte le sessioni dei giocatori siano connesse attivamente a una sessione di gioco specificata. Omettendo *NextToken*e impostando il valore *Limite* su 10, Amazon GameLift Servers restituisce i primi 10 record di sessione tra giocatori corrispondenti alla richiesta.

```
void GameLiftManager::DescribePlayerSessions()
{
  #if WITH_GAMELIFT
  FString localPlayerSessions;
  for (auto& psId : connectedPlayerSessionIds)
  {
    PlayerSession ps = idToPlayerSessionMap[psId];
    localPlayerSessions += FString::Printf(TEXT("%s : %s  ; "), *(ps.playerSessionId), *(ps.playerId));
  }
  UE_LOG(GameServerLog, Log, TEXT("LocalPlayerSessions: %s"), *localPlayerSessions);

  UE_LOG(GameServerLog, Log, TEXT("Describing PlayerSessions in this GameSession"));
  FGameLiftDescribePlayerSessionsRequest request;
  request.m_gameSessionId = GetCurrentGameSessionId();

  FGameLiftDescribePlayerSessionsOutcome outcome = GameLiftSdkModule->DescribePlayerSessions(request);
  LogDescribePlayerSessionsOutcome(outcome);
  #endif
}
```

## StartMatchBackfill()
<a name="integration-server-sdk5-unreal-startmatchbackfill"></a>

Invia una richiesta per trovare nuovi giocatori per gli slot aperti in una sessione di gioco creata con FlexMatch. Per ulteriori informazioni, consulta la funzione di [FlexMatchriempimento](https://docs.aws.amazon.com/gameliftservers/latest/flexmatchguide/match-backfill.html).

Questa operazione è asincrona. Se vengono abbinati nuovi giocatori, Amazon GameLift Servers fornisce dati aggiornati sul matchmaker utilizzando la funzione di callback. `OnUpdateGameSession()`

Un processo del server può avere un solo backfill degli abbinamenti attivo alla volta. Per inviare una nuova richiesta, chiama prima [StopMatchBackfill()](#integration-server-sdk5-unreal-stopmatchbackfill) per annullare la richiesta originale.

### Sintassi
<a name="integration-server-sdk5-unreal-startmatchbackfill-syntax"></a>

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

### Parameters
<a name="integration-server-sdk5-unreal-startmatchbackfill-parameter"></a>

**[FStartMatchBackfillRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-startmatchbackfillrequest)**  
Un StartMatchBackfillRequest oggetto che comunica le seguenti informazioni:  
+ ID del ticket da assegnare alla richiesta di backfill. Queste informazioni sono facoltative; se non viene fornito alcun ID, ne Amazon GameLift Servers genererà uno.
+ Matchmaker a cui inviare la richiesta. L'ARN di configurazione completo è obbligatorio. Questo valore si trova nei dati del matchmaker della sessione di gioco.
+ L'ID della sessione di gioco da riempire.
+ I dati di matchmaking disponibili per i giocatori attuali della sessione di gioco.

### Valore restituito
<a name="integration-server-sdk5-unreal-startmatchbackfill-return"></a>

Restituisce un `StartMatchBackfillOutcome` oggetto con l'ID del ticket match backfill, oppure restituisce un errore con un messaggio di errore. 

### Esempio
<a name="integration-server-sdk5-unreal-startmatchbackfill-example"></a>

```
FGameLiftStringOutcome FGameLiftServerSDKModule::StartMatchBackfill(const FStartMatchBackfillRequest& request) 
{
  #if WITH_GAMELIFT
  Aws::GameLift::Server::Model::StartMatchBackfillRequest sdkRequest;
  sdkRequest.SetTicketId(TCHAR_TO_UTF8(*request.m_ticketId));
  sdkRequest.SetGameSessionArn(TCHAR_TO_UTF8(*request.m_gameSessionArn));
  sdkRequest.SetMatchmakingConfigurationArn(TCHAR_TO_UTF8(*request.m_matchmakingConfigurationArn));
  for (auto player : request.m_players) {
    Aws::GameLift::Server::Model::Player sdkPlayer;
    sdkPlayer.SetPlayerId(TCHAR_TO_UTF8(*player.m_playerId));
    sdkPlayer.SetTeam(TCHAR_TO_UTF8(*player.m_team));
    for (auto entry : player.m_latencyInMs) {
      sdkPlayer.WithLatencyMs(TCHAR_TO_UTF8(*entry.Key), entry.Value);
    }

    std::map<std::string, Aws::GameLift::Server::Model::AttributeValue> sdkAttributeMap;
    for (auto attributeEntry : player.m_playerAttributes) {
      FAttributeValue value = attributeEntry.Value;
      Aws::GameLift::Server::Model::AttributeValue attribute;
      switch (value.m_type) {
        case FAttributeType::STRING:
          attribute = Aws::GameLift::Server::Model::AttributeValue(TCHAR_TO_UTF8(*value.m_S));
        break;
        case FAttributeType::DOUBLE:
          attribute = Aws::GameLift::Server::Model::AttributeValue(value.m_N);
        break;
        case FAttributeType::STRING_LIST:
          attribute = Aws::GameLift::Server::Model::AttributeValue::ConstructStringList();
          for (auto sl : value.m_SL) {
            attribute.AddString(TCHAR_TO_UTF8(*sl));
          };
        break;
        case FAttributeType::STRING_DOUBLE_MAP:
          attribute = Aws::GameLift::Server::Model::AttributeValue::ConstructStringDoubleMap();
          for (auto sdm : value.m_SDM) {
            attribute.AddStringAndDouble(TCHAR_TO_UTF8(*sdm.Key), sdm.Value);
          };
        break;
      }
      sdkPlayer.WithPlayerAttribute((TCHAR_TO_UTF8(*attributeEntry.Key)), attribute);
    }
    sdkRequest.AddPlayer(sdkPlayer);
  }
  auto outcome = Aws::GameLift::Server::StartMatchBackfill(sdkRequest);
  if (outcome.IsSuccess()) {
    return FGameLiftStringOutcome(outcome.GetResult().GetTicketId());
  }
  else {
    return FGameLiftStringOutcome(FGameLiftError(outcome.GetError()));
  }
  #else
  return FGameLiftStringOutcome("");
  #endif
}
```

## StopMatchBackfill()
<a name="integration-server-sdk5-unreal-stopmatchbackfill"></a>

Annulla una richiesta di match backfill attiva. Per ulteriori informazioni, consulta la funzione di [FlexMatchriempimento](https://docs.aws.amazon.com/gameliftservers/latest/flexmatchguide/match-backfill.html).

### Sintassi
<a name="integration-server-sdk5-unreal-stopmatchbackfill-syntax"></a>

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

### Parameters
<a name="integration-server-sdk5-unreal-stopmatchbackfill-parameter"></a>

**[FStopMatchBackfillRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-stopmatchbackfillrequest)**  
Un StopMatchBackfillRequest oggetto che identifica il ticket di matchmaking da annullare:   
+ L'ID del ticket assegnato alla richiesta di riempimento.
+ Il matchmaker a cui è stata inviata la richiesta di riempimento.
+ La sessione di gioco associata alla richiesta di riempimento.

### Valore restituito
<a name="integration-server-sdk5-unreal-stopmatchbackfill-return"></a>

Restituisce un risultato generico composto da successo o fallimento con un messaggio di errore.

### Esempio
<a name="integration-server-sdk5-unreal-stopmatchbackfill-example"></a>

```
FGameLiftGenericOutcome FGameLiftServerSDKModule::StopMatchBackfill(const FStopMatchBackfillRequest& request)
{
  #if WITH_GAMELIFT
  Aws::GameLift::Server::Model::StopMatchBackfillRequest sdkRequest;
  sdkRequest.SetTicketId(TCHAR_TO_UTF8(*request.m_ticketId));
  sdkRequest.SetGameSessionArn(TCHAR_TO_UTF8(*request.m_gameSessionArn));
  sdkRequest.SetMatchmakingConfigurationArn(TCHAR_TO_UTF8(*request.m_matchmakingConfigurationArn));
  auto outcome = Aws::GameLift::Server::StopMatchBackfill(sdkRequest);
  if (outcome.IsSuccess()) {
    return FGameLiftGenericOutcome(nullptr);
  }
  else {
    return FGameLiftGenericOutcome(FGameLiftError(outcome.GetError()));
  }
  #else
  return FGameLiftGenericOutcome(nullptr);
  #endif
}
```

## GetComputeCertificate()
<a name="integration-server-sdk5-unreal-getcomputecertificate"></a>

Recupera il percorso del certificato TLS utilizzato per crittografare la connessione di rete tra la risorsa di elaborazione Amazon GameLift Servers Anywhere e. Amazon GameLift Servers Puoi utilizzare il percorso del certificato quando registri il tuo dispositivo di elaborazione in una flotta Anywhere. Amazon GameLift Servers Per ulteriori informazioni, consultare [RegisterCompute](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_RegisterCompute.html).

### Sintassi
<a name="integration-server-sdk5-unreal-getcomputecertificate-syntax"></a>

```
FGameLiftGetComputeCertificateOutcome FGameLiftServerSDKModule::GetComputeCertificate()
```

### Valore restituito
<a name="integration-server-sdk5-unreal-getcomputecertificate-return"></a>

Restituisce un `GetComputeCertificateResponse` oggetto contenente quanto segue: 
+ CertificatePath: il percorso del certificato TLS sulla risorsa di calcolo. 
+ HostName: il nome host della risorsa di elaborazione.

### Esempio
<a name="integration-server-sdk5-unreal-getcomputecertificate-example"></a>

```
FGameLiftGetComputeCertificateOutcome FGameLiftServerSDKModule::GetComputeCertificate()
{
  #if WITH_GAMELIFT
  auto outcome = Aws::GameLift::Server::GetComputeCertificate();
  if (outcome.IsSuccess()) {
    auto& outres = outcome.GetResult();
    FGameLiftGetComputeCertificateResult result;
    result.m_certificate_path = UTF8_TO_TCHAR(outres.GetCertificatePath());
    result.m_computeName = UTF8_TO_TCHAR(outres.GetComputeName());
    return FGameLiftGetComputeCertificateOutcome(result);
  }
  else {
    return FGameLiftGetComputeCertificateOutcome(FGameLiftError(outcome.GetError()));
  }
  #else
  return FGameLiftGetComputeCertificateOutcome(FGameLiftGetComputeCertificateResult());
  #endif
}
```

## GetFleetRoleCredentials()
<a name="integration-server-sdk5-unreal-getfleetrolecredentials"></a>

Recupera le credenziali del ruolo IAM che autorizzano Amazon GameLift Servers a interagire con altri. Servizi AWS Per ulteriori informazioni, consulta [Connect il server di gioco Amazon GameLift Servers ospitato ad altre AWS risorse](gamelift-sdk-server-resources.md).

### Sintassi
<a name="integration-server-sdk5-unreal-getfleetrolecredentials-syntax"></a>

```
FGameLiftGetFleetRoleCredentialsOutcome FGameLiftServerSDKModule::GetFleetRoleCredentials(const FGameLiftGetFleetRoleCredentialsRequest &request)
```

### Parameters
<a name="integration-server-sdk5-unreal-getfleetrolecredentials-parameters"></a>

[FGameLiftGetFleetRoleCredentialsRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-getfleetrolecredentialsrequest)

### Valore restituito
<a name="integration-server-sdk5-unreal-getfleetrolecredentials-return"></a>

Restituisce un oggetto [FGameLiftGetFleetRoleCredentialsOutcome](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-getfleetrolecredentialsoutcome).

### Esempio
<a name="integration-server-sdk5-unreal-getfleetrolecredentials-example"></a>

```
FGameLiftGetFleetRoleCredentialsOutcome FGameLiftServerSDKModule::GetFleetRoleCredentials(const FGameLiftGetFleetRoleCredentialsRequest &request)
{
  #if WITH_GAMELIFT
  Aws::GameLift::Server::Model::GetFleetRoleCredentialsRequest sdkRequest;
  sdkRequest.SetRoleArn(TCHAR_TO_UTF8(*request.m_roleArn));
  sdkRequest.SetRoleSessionName(TCHAR_TO_UTF8(*request.m_roleSessionName));

  auto outcome = Aws::GameLift::Server::GetFleetRoleCredentials(sdkRequest);

  if (outcome.IsSuccess()) {
    auto& outres = outcome.GetResult();
    FGameLiftGetFleetRoleCredentialsResult result;
    result.m_assumedUserRoleArn = UTF8_TO_TCHAR(outres.GetAssumedUserRoleArn());
    result.m_assumedRoleId = UTF8_TO_TCHAR(outres.GetAssumedRoleId());
    result.m_accessKeyId = UTF8_TO_TCHAR(outres.GetAccessKeyId());
    result.m_secretAccessKey = UTF8_TO_TCHAR(outres.GetSecretAccessKey());
    result.m_sessionToken = UTF8_TO_TCHAR(outres.GetSessionToken());
    result.m_expiration = FDateTime::FromUnixTimestamp(outres.GetExpiration());
    return FGameLiftGetFleetRoleCredentialsOutcome(result);
  }
  else {
    return FGameLiftGetFleetRoleCredentialsOutcome(FGameLiftError(outcome.GetError()));
  }
  #else
  return FGameLiftGetFleetRoleCredentialsOutcome(FGameLiftGetFleetRoleCredentialsResult());
  #endif
}
```

## Distruggi ()
<a name="integration-server-sdk5-unreal-ref-destroy"></a>

Libera l'SDK del server di Amazon GameLift Servers gioco dalla memoria. È consigliabile chiamare questo metodo dopo `ProcessEnding()` e prima di terminare il processo. Se utilizzi una flotta Anywhere e non interrompi i processi del server dopo ogni sessione di gioco, chiama `Destroy()` e poi `InitSDK()` reinizializza prima di notificare Amazon GameLift Servers che il processo è pronto per ospitare una sessione di gioco. `ProcessReady()`

### Sintassi
<a name="integration-server-sdk5-unreal-ref-destroy-syntax"></a>

```
FGameLiftGenericOutcome Destroy();
```

### Parameters
<a name="integration-server-sdk5-unreal-ref-destroy-parameter"></a>

Non ci sono parametri.

### Valore restituito
<a name="integration-server-sdk5-unreal-ref-destroy-return"></a>

Restituisce un risultato generico costituito da successo o fallimento con un messaggio di errore.

### Esempio
<a name="integration-server-sdk5-unreal-ref-destroy-example"></a>

```
// First call ProcessEnding()
FGameLiftGenericOutcome processEndingOutcome = GameLiftSdkModule->ProcessEnding();
  
// Then call Destroy() to free the SDK from memory
FGameLiftGenericOutcome destroyOutcome = GameLiftSdkModule->Destroy();
  
// Exit the process with success or failure
if (processEndingOutcome.IsSuccess() && destroyOutcome.IsSuccess()) 
    {
    UE_LOG(GameServerLog, Log, TEXT("Server process ending successfully"));
}
else {
    if (!processEndingOutcome.IsSuccess()) {
        const FGameLiftError& error = processEndingOutcome.GetError();
        UE_LOG(GameServerLog, Error, TEXT("ProcessEnding() failed. Error: %s"),
        error.m_errorMessage.IsEmpty() ? TEXT("Unknown error") : *error.m_errorMessage);
    }
    if (!destroyOutcome.IsSuccess()) {
        const FGameLiftError& error = destroyOutcome.GetError();
        UE_LOG(GameServerLog, Error, TEXT("Destroy() failed. Error: %s"),
        error.m_errorMessage.IsEmpty() ? TEXT("Unknown error") : *error.m_errorMessage);
    }
}
```