> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 로비 만들기

> 멀티플레이어 세션을 위해 최대 플레이어 수, 액세스 정책 및 초기 멤버 속성을 구성하여 클라이언트 소유 또는 서버 소유 PlayFab 로비 인스턴스를 만듭니다.

이 문서에서는 로비를 만드는 방법에 대해 설명합니다.

## 로비는 어떻게 만들어지나요?

로비를 만들 수 있는 몇 가지 방법이 있습니다.

* **플레이어에 의해**: 플레이어가 함께 플레이할 팀을 구성하기 위해 로비를 만들 수 있습니다. 이는 클라이언트 소유 로비입니다.
* **게임 서버에 의해**: 타이틀의 게임 서버는 로비를 만들고 플레이어가 참여하기를 기다릴 수 있습니다. 이는 서버 소유 로비입니다.
* **매치메이킹에 의해**: 매치메이킹 후 플레이어 그룹이 형성되면, 게임 시작 전에 대기 장소로 로비가 만들어집니다. 이는 클라이언트 소유 로비입니다.

기술적 관점에서, 모든 로비는 소유권에 따라 서버 소유 및 클라이언트 소유의 두 가지 주요 범주로 나뉩니다. 자세한 내용은 [Owner requirements and privileges](/services/playfab/multiplayer/lobby/owner-requirements-and-privileges)를 참조하세요.

PlayFab Lobby의 일반적인 사용법은 플레이어 그룹을 일시적으로 함께 유지하는 것입니다. Lobby의 일반적으로 사용되는 애플리케이션은 [PlayFab Lobby 개요](/services/playfab/multiplayer/lobby)를 참조하세요.

### 지원되는 엔티티 유형

로비를 만들 수 있으려면 먼저 타이틀이 PlayFab 엔티티로 로그인해야 합니다.

* 플레이어를 대신하여 클라이언트 소유 로비를 만들 때는 title\_player\_account 엔티티로 로그인하세요. 자세한 내용은 [Log in basics and best practices](/services/playfab/identity/player-identity/login/login-basics-best-practices)를 참조하세요.
* 게임 서버를 대신하여 서버 소유 로비를 만들 때는 game\_server 엔티티로 로그인하세요. 자세한 내용은 [AuthenticateGameServerWithCustomId](https://learn.microsoft.com/en-us/rest/api/playfab/authentication/authentication/authenticate-game-server-with-custom-id)를 참조하세요.

## 로비는 어떻게 구성되나요

로비의 몇 가지 중요한 설정은 생성 중에 구성됩니다: **maxMemberCount**, **accessPolicy**, **owner**, **ownerMigrationPolicy**.

* \_\_maxMemberCount\_\_는 로비가 수용할 수 있는 플레이어 수를 정의합니다.
* \_\_accessPolicy\_\_는 로비의 연결 문자열을 발견할 수 있는 대상을 정의합니다.
* \_\_owner\_\_는 로비의 데이터를 업데이트할 수 있는 특별한 권한이 있는 로비의 소유자를 정의합니다. 이 값은 암시적으로 로비를 만드는 클라이언트 또는 서버 엔티티입니다.
* \_\_ownerMigrationPolicy\_\_는 현재 소유자가 로비를 떠나거나 로비에 대한 연결을 유지하는 데 문제가 있는 경우 로비의 소유권이 어떻게 이전되어야 하는지에 대한 정책을 정의합니다.

또한, 생성 중에 로비 생성자는 사용자 지정 로비 속성 및 검색 속성을 정의하여 로비 세션에 사용자 지정 데이터를 추가할 수도 있습니다. 이러한 사용자 지정 속성은 로비의 수명 동안 로비 소유자가 수정할 수도 있습니다.

자세한 내용은 [Lobby properties](/services/playfab/multiplayer/lobby/lobby-properties)를 참조하세요.

## Lobby and Matchmaking SDK를 사용하여 클라이언트 소유 로비를 만드는 예제

이 예제는 [title\_player\_account](/services/playfab/live-service-management/game-configuration/entities/available-built-in-entity-types) 엔티티로 PlayFab에 로그인된 로컬 플레이어를 사용합니다.

이 코드 스니펫에서, 로비 속성은 \_\_lobbyConfiguration\_\_으로 전달되고 로비를 만드는 플레이어는 \_\_creatorMemberConfiguration\_\_을 통해 초기 멤버 속성을 전달합니다. 로컬 플레이어가 로비 소유자가 되므로 클라이언트 소유 로비입니다. 로비가 성공적으로 만들어진 후, \_\_PFLobbyHandle\_\_을 사용하여 [PFLobbySendInvite](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbysendinvite)로 다른 플레이어를 초대할 수 있습니다.

```cpp theme={null}
    // Retrieved elsewhere from SDK's PFMultiplayerInitialize API
    PFMultiplayerHandle apiHandle = g_pfmHandle;

    // Retrieved elsewhere from one of PlayFab's title_player_account login APIs
    const PFEntityKey* clientOwner = m_localPlayerTitlePlayerAccounts[0];

    // Initialize the lobby configuration
    const char* gameModePropertyKey = "GameMode";
    const char* gameModePropertyValue = "GameMode_Foo";

    PFLobbyCreateConfiguration lobbyConfiguration{};
    lobbyConfiguration.maxMemberCount = 16;
    lobbyConfiguration.ownerMigrationPolicy = PFLobbyOwnerMigrationPolicy::Automatic;
    lobbyConfiguration.accessPolicy = PFLobbyAccessPolicy::Private;
    lobbyConfiguration.lobbyPropertyCount = 1;
    lobbyConfiguration.lobbyPropertyKeys = &gameModePropertyKey;
    lobbyConfiguration.lobbyPropertyValues = &gameModePropertyValue;
    
    // Initialize the creator's member properties
    const char* playerColorPropertyKey = "PlayerColor";
    const char* playerColorPropertyValue = "Red";

    PFLobbyJoinConfiguration creatorMemberConfiguration{};
    creatorMemberConfiguration.memberPropertyCount = 1;
    creatorMemberConfiguration.memberPropertyKeys = &playerColorPropertyKey;
    creatorMemberConfiguration.memberPropertyValues = &playerColorPropertyValue;

    // Create a lobby using our first player
    PFLobbyHandle lobby;
    HRESULT error = PFMultiplayerCreateAndJoinLobby(
        apiHandle,
        clientOwner,
        &lobbyConfiguration,
        &creatorMemberConfiguration,
        nullptr,
        &lobby);
```

로비 생성 호출이 완료되면, [PFMultiplayerStartProcessingLobbyStateChanges](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pfmultiplayerstartprocessinglobbystatechanges)에 의해 [PFLobbyCreateAndJoinLobbyCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbycreateandjoinlobbycompletedstatechange)가 제공됩니다.

## Lobby and Matchmaking SDK를 사용하여 서버 소유 로비를 만드는 예제

이 예제는 [클라이언트 소유 로비 예제](#example-creating-a-client-owned-lobby-using-the-lobby-and-matchmaking-sdk)와 유사하지만, 로비를 [game\_server](/services/playfab/live-service-management/game-configuration/entities/available-built-in-entity-types) 엔티티로 생성하고 [PFMultiplayerCreateAndJoinLobby](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pfmultiplayercreateandjoinlobby) 대신 [PFMultiplayerCreateAndClaimServerLobby](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pfmultiplayercreateandclaimserverlobby)를 호출한다는 점이 다릅니다.

```cpp theme={null}
    // Retrieved elsewhere from SDK's PFMultiplayerInitialize API
    PFMultiplayerHandle apiHandle = g_pfmHandle;

    // Retrieved elsewhere from one of PlayFab's game_server login APIs
    const PFEntityKey* serverOwner = m_gameServerEntityKey;

    const char* gameModePropertyKey = "GameMode";
    const char* gameModePropertyValue = "GameMode_Foo";
    
    // Initialize the lobby configuration
    PFLobbyCreateConfiguration lobbyConfiguration{};
    lobbyConfiguration.maxMemberCount = 16;
    lobbyConfiguration.ownerMigrationPolicy = PFLobbyOwnerMigrationPolicy::Automatic;
    lobbyConfiguration.accessPolicy = PFLobbyAccessPolicy::Public;
    lobbyConfiguration.lobbyPropertyCount = 1;
    lobbyConfiguration.lobbyPropertyKeys = &gameModePropertyKey;
    lobbyConfiguration.lobbyPropertyValues = &gameModePropertyValue;
    
    // Create a lobby using our first player
    PFLobbyHandle lobby;
    HRESULT error = PFMultiplayerCreateAndClaimServerLobby(
        apiHandle,
        serverOwner,
        &lobbyConfiguration,
        nullptr,
        &lobby);
```

로비 생성 호출이 완료되면, [PFMultiplayerStartProcessingLobbyStateChanges](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pfmultiplayerstartprocessinglobbystatechanges)에 의해 [PFLobbyCreateAndClaimServerLobbyCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbycreateandclaimserverlobbycompletedstatechange)가 제공됩니다.

클라이언트 소유 로비와 서버 소유 로비의 차이점에 대한 자세한 내용은 [Game Servers and Lobbies](/services/playfab/multiplayer/lobby/lobby-server-overview)를 참조하세요.

<Note>
  PlayFab Multiplayer에서 게임 서버 API를 활성화하려면, PFLobby.h를 포함하기 전에 PFMULTIPLAYER\_INCLUDE\_SERVER\_APIS를 정의해야 합니다. 자세한 내용은 [Game Servers and Lobbies](/services/playfab/multiplayer/lobby/lobby-server-overview)를 참조하세요.
</Note>

## 참고

* [Lobby SDK 참조](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/pflobby_members)
* [검색 가능한 로비 만들기](/services/playfab/multiplayer/lobby/define-search-keywords)
* [로비에 플레이어 초대](/services/playfab/multiplayer/lobby/lobby-invites)
* [Lobby properties](/services/playfab/multiplayer/lobby/lobby-properties)
* [Lobby 및 matchmaking](/services/playfab/multiplayer/lobby/lobby-and-matchmaking)


## Related topics

- [Lobby SDK 빠른 시작](/ko/services/playfab/multiplayer/lobby/lobby-getting-started.md)
- [MPSD에서 PlayFab Multiplayer 및 MPA로 이동](/ko/services/xbox-services/multiplayer/mpsd/concepts/live-mpsd-to-mlp.md)
- [검색 가능한 로비 만들기](/ko/services/playfab/multiplayer/lobby/define-search-keywords.md)
- [로비 찾기](/ko/services/playfab/multiplayer/lobby/find-lobbies.md)
- [로비 참여](/ko/services/playfab/multiplayer/lobby/join-lobbies.md)
