

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# Amazon GameLift Servers용 C\+\+(Unreal) 서버 SDK 5.x - 작업
<a name="integration-server-sdk5-unreal-actions"></a>

Amazon GameLift Servers Unreal 서버 SDK 5.x 참조를 사용하면 Amazon GameLift Servers와 함께 사용할 멀티플레이어 게임을 준비하는 데 도움이 됩니다. 통합 프로세스에 대한 자세한 내용은 [서버 SDK를 사용하여 게임 서버에 Amazon GameLift Servers를 추가합니다.](gamelift-sdk-server-api.md) 섹션을 참조하세요. 또한 Unreal용 Amazon GameLift Servers 플러그인을 사용하는 경우 [Unreal Engine용 Amazon GameLift Servers 플러그인](unreal-plugin.md) 페이지를 참조하세요.

**참고**  
이 주제에서는 Unreal Engine용으로 빌드할 때 사용할 수 있는 Amazon GameLift Servers C\+\+ API에 대해 설명합니다. 특히, 이 설명서는 `-DBUILD_FOR_UNREAL=1` 옵션을 사용하여 컴파일하는 코드에 적용됩니다.

[Amazon GameLift Servers용 C\+\+(Unreal) 서버 SDK 5.x - 데이터 유형](integration-server-sdk5-unreal-datatypes.md)

**Topics**
+ [Amazon GameLift Servers용 C\+\+(Unreal) 서버 SDK 5.x - 데이터 유형](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)
+ [Destroy()](#integration-server-sdk5-unreal-ref-destroy)

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

현재 서버 프로세스에 빌드된 SDK 버전 번호를 반환합니다.

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

```
FGameLiftStringOutcome GetSdkVersion();
```

### 반환 값
<a name="integration-server-sdk5-unreal-getsdkversion-return"></a>

성공하면 현재 SDK 버전을 [FGameLiftStringOutcome](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-awsstringoutcome) 객체로 반환합니다. 반환된 객체는 버전 번호(예: `5.0.0`)를 포함합니다. 실패하면 오류 메시지를 반환합니다.

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

관리형 EC2 플릿의 Amazon GameLift Servers SDK를 초기화합니다. Amazon GameLift Servers와 관련된 다른 초기화가 발생하기 전에 시작 시 이 메서드를 호출합니다. 이 메서드는 호스트 환경에서 서버 파라미터를 읽어 서버와 Amazon GameLift Servers 서비스 간의 통신을 설정합니다. 멱등성 토큰을 사용하므로 실패 시 이 호출을 안전하게 다시 시도할 수 있습니다.

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

```
FGameLiftGenericOutcome InitSDK()
```

### 반환 값
<a name="integration-server-sdk5-unreal-initsdk-return"></a>

성공하는 경우, 서버 프로세스가 [ProcessReady()](#integration-server-sdk5-unreal-processready)를 호출할 준비가 되었음을 나타내는 `InitSdkOutcome` 객체를 반환합니다.

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

Anywhere 플릿 또는 관리형 컨테이너 플릿용 Amazon GameLift Servers SDK를 초기화합니다. Amazon GameLift Servers와 관련된 다른 초기화가 발생하기 전에 시작 시 이 메서드를 호출합니다. 이 메서드는 명시적인 서버 파라미터를 통해 서버와 Amazon GameLift Servers 서비스 간의 통신을 설정합니다. 멱등성 토큰을 사용하므로 실패 시 이 호출을 안전하게 다시 시도할 수 있습니다.

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

```
FGameLiftGenericOutcome InitSDK(serverParameters)
```

### 파라미터
<a name="integration-server-sdk5-unreal-initsdk-anywhere-parameter"></a>

[FServerParameters](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-serverparameters)  
Amazon GameLift Servers Anywhere 플릿에서 게임 서버를 초기화하려면 다음 정보를 사용하여 `ServerParameters` 객체를 구성합니다.  
+ 게임 서버에 연결하는 데 사용되는 WebSocket의 URL입니다.
+ 게임 서버를 호스팅하는 데 사용되는 프로세스의 ID입니다.
+ 게임 서버 프로세스를 호스팅하는 컴퓨팅의 ID입니다.
+ Amazon GameLift Servers Anywhere 컴퓨팅이 포함된 Amazon GameLift Servers 플릿의 ID입니다.
+ Amazon GameLift Servers 작업을 통해 생성된 인증 토큰입니다.

### 반환 값
<a name="integration-server-sdk5-unreal-initsdk-anywhere-return"></a>

성공하는 경우, 서버 프로세스가 [ProcessReady()](#integration-server-sdk5-unreal-processready)를 호출할 준비가 되었음을 나타내는 `InitSdkOutcome` 객체를 반환합니다.

**참고**  
Anywhere 플릿에 배포된 게임 빌드에 대한 `InitSDK()`로의 호출이 실패하는 경우 빌드 리소스를 생성할 때 사용된 `ServerSdkVersion` 파라미터를 확인합니다. 명시적으로 이 값을 사용 중인 Server SDK 버전으로 설정해야 합니다. 이 파라미터의 기본값은 4.x이며 호환되지 않습니다. 이 문제를 해결하려면 새 빌드를 생성하여 새 플릿에 배포해야 합니다.

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

Amazon GameLift Servers에 서버 프로세스가 게임 세션을 호스팅할 준비가 되었음을 알립니다. [InitSDK()](#integration-server-sdk5-unreal-initsdk) 호출 후 이 메서드를 호출합니다. 이 메서드는 프로세스당 한 번만 호출해야 합니다.

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

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

### 파라미터
<a name="integration-server-sdk5-unreal-processready-parameter"></a>

**processParameters**  
다음 서버 프로세스 관련 정보를 전달하는 [FProcessParameters](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-process) 객체입니다.  
+ 게임 서버 코드에 구현되어 있는 콜백 메서드의 이름으로, 서버 프로세스와 통신할 수 있도록 Amazon GameLift Servers 서비스가 호출하는 메서드입니다.
+ 서버 프로세스가 수신하는 포트 번호입니다.
+ Amazon GameLift Servers가 캡처 및 저장하도록 하려는 모든 게임 세션별 파일에 대한 경로입니다.

### 반환 값
<a name="integration-server-sdk5-unreal-processready-return"></a>

성공 또는 실패와 함께 오류 메시지로 구성된 일반적인 결과를 반환합니다.

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

이 예에서는 [ProcessReady()](#integration-server-sdk5-unreal-processready) 호출 및 위임 함수 구현을 모두 보여줍니다.

```
//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>

서버 프로세스가 종료 중임을 Amazon GameLift Servers에 알립니다. 활성 게임 세션의 종료 등 다른 모든 정리 작업 이후 및 프로세스를 종료하기 전에 이 메서드를 호출합니다. `ProcessEnding()`의 결과에 따라 프로세스가 성공(0) 또는 오류(-1)로 종료되고 플릿 이벤트가 생성됩니다. 오류가 발생하여 프로세스가 종료되는 경우 생성되는 플릿 이벤트는 `SERVER_PROCESS_TERMINATED_UNHEALTHY`입니다.

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

```
FGameLiftGenericOutcome ProcessEnding()
```

### 반환 값
<a name="integration-server-sdk5-unreal-processending-return"></a>

성공 또는 실패와 함께 오류 메시지로 구성된 일반적인 결과를 반환합니다.

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

Amazon GameLift Servers에 서버 프로세스가 게임 세션을 활성화했으며 이제 플레이어 연결을 수신할 준비가 되었음을 알립니다. 이 작업은 모든 게임 세션 초기화 후 `onStartGameSession()` 콜백 함수의 일부로 호출되어야 합니다.

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

```
FGameLiftGenericOutcome ActivateGameSession()
```

### 반환 값
<a name="integration-server-sdk5-unreal-activategamesession-return"></a>

성공 또는 실패와 함께 오류 메시지로 구성된 일반적인 결과를 반환합니다.

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

이 예에서는 `onStartGameSession()` 위임 함수의 일부로 `ActivateGameSession()`이 호출되는 것을 보여줍니다.

```
//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>

현재 게임 세션의 새 플레이어 세션 수락 가능성을 업데이트합니다. 모든 새 플레이어 세션을 수락하거나 거부하도록 게임 세션을 설정할 수 있습니다.

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

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

### 파라미터
<a name="integration-server-sdk5-unreal-updateplayersessioncreationpolicy-parameter"></a>

**playerCreationSessionPolicy**  
게임 세션이 새 플레이어를 수락하는지 여부를 나타내는 문자열 값입니다.  
유효한 값으로는 다음이 포함됩니다.  
+ **ACCEPT\_ALL** - 모든 새 플레이어 세션을 수락합니다.
+ **DENY\_ALL** - 모든 새 플레이어 세션을 거부합니다.

### 반환 값
<a name="integration-server-sdk5-unreal-updateplayersessioncreationpolicy-return"></a>

성공 또는 실패와 함께 오류 메시지로 구성된 일반적인 결과를 반환합니다.

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

이 예는 모든 플레이어를 수락하도록 현재 게임 세션의 참여 정책을 설정합니다.

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

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

활성 서버 프로세스가 호스팅된 게임 세션의 ID를 가져옵니다.

게임 세션으로 활성화되지 않은 유휴 프로세스의 경우 호출은 [FGameLiftError](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-gamelifterror)를 반환합니다.

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

```
FGameLiftStringOutcome GetGameSessionId()
```

### 파라미터
<a name="integration-server-sdk5-unreal-getgamesessionid-parameter"></a>

이 작업에는 파라미터가 없습니다.

### 반환 값
<a name="integration-server-sdk5-unreal-getgamesessionid-return"></a>

성공하면 게임 세션 ID를 [FGameLiftStringOutcome](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-awsstringoutcome) 객체로 반환합니다. 실패하면 오류 메시지를 반환합니다.

게임 세션으로 활성화되지 않은 유휴 프로세스의 경우 호출은 `Success`=`True` 및 `GameSessionId`=`""`를 반환합니다.

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

종료 시간을 사용할 수 있는 경우 서버 프로세스가 종료되도록 예약된 시간을 반환합니다. 서버 프로세스는 Amazon GameLift Servers에서 `onProcessTerminate()` 콜백을 수신한 후 조치를 취합니다. Amazon GameLift Servers는 다음과 같은 이유로 `onProcessTerminate()`를 호출합니다.
+ 서버 프로세스가 상태 불량을 보고했거나 Amazon GameLift Servers에 응답하지 않은 경우
+ 스케일 다운 이벤트 중에 인스턴스를 종료하는 경우
+ [스팟 인스턴스 중단](spot-tasks.md)으로 인해 인스턴스가 종료되는 경우

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

```
AwsDateTimeOutcome GetTerminationTime()
```

### 반환 값
<a name="integration-server-sdk5-unreal-getterm-return"></a>

성공하면 종료 시간을 `AwsDateTimeOutcome` 객체로 반환합니다. 값은 종료 시간이며, `0001 00:00:00` 이후 경과된 틱 수로 표시됩니다. 예를 들어, 날짜 시간 값 `2020-09-13 12:26:40 -000Z`는 `637355968000000000` 틱 수와 같습니다. 사용 가능한 종료 시간이 없는 경우 오류 메시지를 반환합니다.

프로세스가 ` ProcessParameters.OnProcessTerminate()` 콜백을 받지 못한 경우 오류 메시지가 반환됩니다. 서버 프로세스 종료에 대한 자세한 내용은 [서버 프로세스 종료 알림에 응답](gamelift-sdk-server-api.md#gamelift-sdk-server-terminate) 섹션을 참조하세요.

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

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

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

Amazon GameLift Servers에 지정된 플레이어 세션 ID의 플레이어가 서버 프로세스에 연결되었고 검증이 필요함을 알립니다. Amazon GameLift Servers는 플레이어 세션 ID가 유효한지 확인합니다. 플레이어 세션이 검증된 후 Amazon GameLift Servers는 플레이어 슬롯의 상태를 RESERVED에서 ACTIVE로 변경합니다.

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

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

### 파라미터
<a name="integration-server-sdk5-unreal-acceptplayersession-parameter"></a>

playerSessionId  
새로운 플레이어 세션이 생성되었을 때 Amazon GameLift Servers가 발행한 고유 ID입니다.

### 반환 값
<a name="integration-server-sdk5-unreal-acceptplayersession-return"></a>

성공 또는 실패와 함께 오류 메시지로 구성된 일반적인 결과를 반환합니다.

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

이 예제는 유효하지 않은 플레이어 세션 ID의 검증 및 거부를 포함하는 연결 요청을 처리합니다.

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

플레이어가 서버 프로세스와의 연결이 끊겼음을 Amazon GameLift Servers에 알립니다. 이에 따라 Amazon GameLift Servers는 플레이어 슬롯을 사용 가능한 것으로 변경합니다.

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

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

### 파라미터
<a name="integration-server-sdk5-unreal-removeplayersession-parameter"></a>

**`playerSessionId`**  
새로운 플레이어 세션이 생성되었을 때 Amazon GameLift Servers가 발행한 고유 ID입니다.

### 반환 값
<a name="integration-server-sdk5-unreal-removeplayersession-return"></a>

성공 또는 실패와 함께 오류 메시지로 구성된 일반적인 결과를 반환합니다.

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

설정, 세션 메타데이터 및 플레이어 데이터 등의 플레이어 세션 데이터를 가져옵니다. 이 메서드를 사용하여 다음에 대한 정보를 얻을 수 있습니다.
+ 단일 플레이어 세션
+ 게임 세션의 모든 플레이어 세션
+ 단일 플레이어 ID와 연결된 모든 플레이어 세션

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

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

### 파라미터
<a name="integration-server-sdk5-unreal-describeplayersessions-parameter"></a>

**[FGameLiftDescribePlayerSessionsRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-playersessions)**  
검색할 플레이어 세션을 설명하는 [FGameLiftDescribePlayerSessionsRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-playersessions) 객체입니다.

### 반환 값
<a name="integration-server-sdk5-unreal-describeplayersessions-return"></a>

성공하는 경우, 요청 파라미터에 적합한 플레이어 세션 객체 집합이 들어 있는 [FGameLiftDescribePlayerSessionsOutcome](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-describeplayersessionsoutcome) 객체를 반환합니다.

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

다음은 지정된 게임 세션에 활성 상태로 연결되어 있는 모든 플레이어 세션을 요청하는 예입니다. *NextToken*을 생략하고 *Limit* 값을 10으로 설정하면, Amazon GameLift Servers가 요청과 일치하는 처음 10개의 플레이어 세션 레코드를 반환합니다.

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

FlexMatch를 통해 생성된 게임 세션에서 열린 슬롯에 참여할 새로운 플레이어를 찾는 요청을 보냅니다. 자세한 내용은 [FlexMatch 채우기 기능](https://docs.aws.amazon.com/gameliftservers/latest/flexmatchguide/match-backfill.html)을 참조하세요.

이 작업은 비동기식입니다. 새로운 플레이어가 매치되면 Amazon GameLift Servers는 콜백 함수 `OnUpdateGameSession()`을 사용하여 업데이트된 매치메이커 데이터를 전달합니다.

서버 프로세스는 한 번에 하나의 활성 매치 채우기 요청만 할 수 있습니다. 새 요청을 보내려면 먼저 [StopMatchBackfill()](#integration-server-sdk5-unreal-stopmatchbackfill)을 호출하여 원본 요청을 취소해야 합니다.

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

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

### 파라미터
<a name="integration-server-sdk5-unreal-startmatchbackfill-parameter"></a>

**[FStartMatchBackfillRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-startmatchbackfillrequest)**  
다음 정보를 전달하는 StartMatchBackfillRequest 객체입니다.  
+ 채우기 요청에 할당할 티켓 ID. 이 정보를 선택 사항입니다. ID를 제공하지 않으면 Amazon GameLift Servers가 자동으로 ID를 생성합니다.
+ 요청을 보낼 매치메이커. 전체 구성 ARN이 필요합니다. 이 값은 게임 세션의 매치메이커 데이터에 있습니다.
+ 채울 게임 세션의 ID입니다.
+ 게임 세션의 현재 플레이어에 대해 사용 가능한 매치메이킹 데이터입니다.

### 반환 값
<a name="integration-server-sdk5-unreal-startmatchbackfill-return"></a>

매치 채우기 티켓 ID와 함께 `StartMatchBackfillOutcome` 객체나 오류 메시지를 포함한 결함을 반환합니다.

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

활성 매치 채우기 요청을 취소합니다. 자세한 내용은 [FlexMatch 채우기 기능](https://docs.aws.amazon.com/gameliftservers/latest/flexmatchguide/match-backfill.html)을 참조하세요.

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

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

### 파라미터
<a name="integration-server-sdk5-unreal-stopmatchbackfill-parameter"></a>

**[FStopMatchBackfillRequest](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-stopmatchbackfillrequest)**  
다음은 취소할 매치메이킹 티켓을 식별하는 StopMatchBackfillRequest 객체입니다.  
+ 채우기 요청에 할당된 티켓 ID
+ 채우기 요청을 보낸 매치메이커
+ 채우기 요청과 연결된 게임 세션

### 반환 값
<a name="integration-server-sdk5-unreal-stopmatchbackfill-return"></a>

성공 또는 실패와 함께 오류 메시지로 구성된 일반적인 결과를 반환합니다.

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

Amazon GameLift Servers Anywhere 컴퓨팅 리소스 및 Amazon GameLift Servers 간의 네트워크 연결을 암호화하는 데 사용되는 TLS 인증서의 경로를 검색합니다. Amazon GameLift Servers Anywhere 플릿에 컴퓨팅 디바이스를 등록할 때 인증서 경로를 사용할 수 있습니다. 자세한 내용은 [RegisterCompute](https://docs.aws.amazon.com/gameliftservers/latest/apireference/API_RegisterCompute.html)을 참조하세요.

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

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

### 반환 값
<a name="integration-server-sdk5-unreal-getcomputecertificate-return"></a>

다음을 포함하는 `GetComputeCertificateResponse` 객체를 반환합니다.
+ CertificatePath: 컴퓨팅 리소스에 있는 TLS 인증서의 경로입니다.
+ HostName: 컴퓨팅 리소스의 호스트 이름입니다.

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

Amazon GameLift Servers가 다른 AWS 서비스와 상호 작용할 수 있도록 승인하는 IAM 역할 자격 증명을 검색합니다. 자세한 내용은 [Amazon GameLift Servers 호스팅 게임 서버를 다른 AWS 리소스에 연결](gamelift-sdk-server-resources.md) 단원을 참조하십시오.

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

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

### 파라미터
<a name="integration-server-sdk5-unreal-getfleetrolecredentials-parameters"></a>

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

### 반환 값
<a name="integration-server-sdk5-unreal-getfleetrolecredentials-return"></a>

[FGameLiftGetFleetRoleCredentialsOutcome](integration-server-sdk5-unreal-datatypes.md#integration-server-sdk5-unreal-dataypes-getfleetrolecredentialsoutcome) 객체를 반환합니다.

### 예제
<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
}
```

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

Amazon GameLift Servers Game Server SDK를 메모리에서 분리합니다. `ProcessEnding()` 이후 및 프로세스를 종료하기 전에 이 메서드를 호출하는 것이 가장 좋습니다. Anywhere 플릿을 사용 중이고 게임 세션 이후마다 서버 프로세스를 종료하지 않는 경우, `Destroy()` 및 `InitSDK()`를 차례로 호출하여 Amazon GameLift Servers가 게임 세션을 `ProcessReady()`로 호스팅할 준비가 되었음을 알리기 전에 다시 초기화합니다.

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

```
FGameLiftGenericOutcome Destroy();
```

### 파라미터
<a name="integration-server-sdk5-unreal-ref-destroy-parameter"></a>

파라미터는 없습니다.

### 반환 값
<a name="integration-server-sdk5-unreal-ref-destroy-return"></a>

성공 또는 실패와 함께 오류 메시지로 구성된 일반적인 결과를 반환합니다.

### 예제
<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);
    }
}
```