メインコンテンツまでスキップ

Set up session - Quick match with peer-to-peer - (Unity module)

Last updated on November 25, 2024
備考

Browsing P2P sessions is not supported in WebGL builds due to the AccelByte Gaming Services (AGS) SDK for Unity lacking the P2P functionality for WebGL.

About

This tutorial will show you how to set up the configurations for peer-to-peer (P2P) matchmaking in the AGS Admin Portal.

Create session template

A session template is a configuration template that defines your game session. In this section, you will learn how to create a session template.

  1. Log in to the AGS Admin Portal and go to your game namespace dashboard.

  2. Go to Multiplayer > Matchmaking > Session Configuration. On the Session Template tab, click Add Session Template.

  3. Fill in the new window using the configuration below for the Elimination game mode.

    • Session Template Name: the unique name to identify your session template. Set it to unity-elimination-p2p.
    • Min Players: the minimum number of players required in the session. Set it to 1.
    • Max Players: the maximum number of players in the session. Set it to 4.
    • Joinability: the joinability of the session. Set it to Open.
    • Server: the session connection type. Set it to Peer to Peer (P2P).
  4. Click Next until you arrive at the Summary tab where you can review your session template configurations. Then, click Create.

  5. Repeat the steps above to create a new session template for the Team Deathmatch game mode by using the configuration below.

    • Session Template Name: set it to unity-teamdeathmatch-p2p.
    • Min Players: set it to 1.
    • Max Players: set it to 8.
    • Joinability: set it to Open.
    • Server: set it to Peer to Peer (P2P).

Create a Match Ruleset

A match ruleset is a configuration that defines how your players will be matched. It is a set of rules for how your matchmaking should work. This section will guide you through creating a match ruleset in the Admin Portal.

  1. Log in to the AGS Admin Portal and go to your game namespace dashboard.

  2. Go to Multiplayer > Matchmaking > Matchmaking Configuration. On the Match Ruleset tab, click Create Rulesets.

  3. Replace the preexisting JSON with the JSON below and name the new match ruleset as elimination. Once finished, click Create.

    {
    "alliance": {
    "max_number": 4,
    "min_number": 1,
    "player_max_number": 1,
    "player_min_number": 1
    },
    "auto_backfill": true
    }
    備考
    • alliance is the attribute to define your match members, such as how many teams and players are in a match. This attribute should contain the following fields:

      • max_number is the maximum number of teams. Set it to 4.
      • min_number is the minimum number of teams. Set it to 1.
      • player_max_number is the maximum number of players in a team. Set it to 1.
      • player_min_number is the minimum number of players in a team. Set it to 1.
    • auto_backfill is a flag for whether the game's server should use backfill or not. You will learn more about it later. For now, set it to true.

  4. Repeat the steps above to create a new match ruleset for Team Deathmatch named teamdeathmatch using the configurations below.

    {
    "alliance": {
    "max_number": 2,
    "min_number": 2,
    "player_max_number": 1,
    "player_min_number": 4
    },
    "auto_backfill": true
    }

Create a match pool

A match pool is a configuration that connects your match ruleset to your session template. It will perform matchmaking based on your match ruleset and create a game session based on your session template. This section will guide you through setting up match pools in the Admin Portal.

  1. Log in to the AGS Admin Portal and go to your game namespace dashboard.

  2. Go to Multiplayer > Matchmaking > Matchmaking Configuration. On the Match Pools tab, click New Match Pool.

  3. Fill out the window that appears using the configuration below to create a match pool for the Elimination game mode. Once done, click Add.

    • Match Pool Name: the name of the match pool. Set it to unity-elimination-p2p.
    • Match Ruleset: the match rule to use. Set it to elimination.
    • Session Template: the session template to use. Set it to unity-elimination-p2p.
  4. Repeat the steps above to create a match pool for Team Deathmatch using the configuration below.

    • Match Pool Name: set it to unity-teamdeathmatch-p2p.
    • Match Ruleset: set it to teamdeathmatch.
    • Session Template: set it to unity-teamdeathmatch-p2p.