Free Matchmaker for Unity - Tutorial for Edgegap's Low Code & Automated Matchmaker

Chapter 1 - Introduction

This step-by-step tutorial video covers how to use Edgegap’s Automated Matchmaker. The low code matchmaker, free when using Edgegap, automates the process of grouping players together within your game, and then instantly deploys a game server so your players can play online.

Edgegap also offers a deeply customizable matchmaker for advanced users who need in-depth control.

Chapter 2 - Requirements

This tutorial assumes you have already set up a game server for your multiplayer on Edgegap.

If not, we have playlists with tutorial videos. A direct link is available in the comments.

Chapter 3 - Matchmaker: Creating the Configuration

Here is a preview of the final matchmaker we will code in this step-by-step video.

Now, let’s get started from zero.

The only component you need to code a matchmaker with Edgegap is either a JSON or YAML configuration file, which uses a specific set of attributes to group players.

The very first step is to create a new file using your code editor of choice, and give it a name. Then, to add “dot JSON” to name the file extension like in this example.

The configuration file has two main sections: the authentication settings, and the list of profiles.

Additionally, it includes a breakdown of all configuration profiles possible with the matchmaker, to help you decide on how you want to connect your players. 

Chapter 4 - Matchmaker: Authentication Settings

The authentication settings let you select the type of authentication for the matchmaker requests.

There are two possible values for the type. The first is simply “No Auth” while the second is “Token”.

“No Auth”, as the name implies, doesn’t require any authentication. This could open the door for cheaters and users who have illegally downloaded the game. During development, however, it makes things easier. Choose accordingly.

The “Token” type needs some additional attributes to set its value. Add “configuration,” then “token” as shown on screen, and finally add any string to set the value. This string can be set to anything, here “Auth Value Here”. It is the equivalent of the password to query your matchmaker.

When using this setting option, the token value needs to be included as an authorization header in the requests sent to the matchmaker, otherwise it won’t be accepted.

Chapter 5 - Matchmaker: Profiles

The “profiles” attribute contains the logic for pairing players together.

Each attribute tells the matchmaker which variables to group players, such as skill levels, locations, or game modes. Think of each profile as your matchmaker’s ruleset. In this example, we will limit ourselves to a single profile with a selector for game type, and filter that will be a sort of ELO rating.

Before we work on the matchmaker’s rule set, the first section is used to identify each matchmaking “profile”. This ensures the matchmaker’s configuration to be valid and thus, functional on Edgegap’s platform.

The “profile” mandatorily needs each of the following seven attributes to be set:

The first is a unique “profile id” to identify the ruleset’s profile with. Here, we name it “Game Example.”

The second is “name” to use to display in-game.

Third is which application on the Edgegap dashboard will be used by this profile to deploy a server, using the “app” and “version” attributes. If you are unsure of where to find this information, head over to Edgegap’s platform, select “Application” from the menu on the left. Every application you have uploaded will be available, with the version also viewable when you click on an application.

Fourth is the “game port” attribute. As the name implies, it is your transport’s port, which you’ll find in your netcode documentation, alongside the one used in Unity’s network manager. In this example, it is our netcode transport’s default port, which is 7770. Alternatively, use the given port from your application settings that the players use to connect to the server if you already gave it a name on Edgegap’s platform, which is the value used when creating an app version.

The fifth attribute, “Delay_to_start”, is the number of seconds before the matchmaker starts to help with player preparation and synchronization. The recommended value for this attribute is between 2 and 10 seconds.

The sixth attribute is “refresh”, which refers to how long the matchmaker will wait in seconds between attempts to group players together by refreshing the list of available matches. The recommended value is between 5 and 10 seconds to balance players wait time and optimizing synchronization intervals.

The seventh and final mandatory attribute is “match_player_count” which indicates how many players need to be paired together for a match to begin.

This technically would be enough to group players randomly, but to ensure an ideal matchmaking experience, both “selectors” and “filters” should be added.

Chapter 6 - Matchmaker: Selectors

“Selectors” are attributes that tells the matchmaker which variables to group players together and, critically, represents a list of options chosen by players within your game.

Each “selector” has the following six requirements.

First, it needs a unique “key” to identify it as an attribute within a given profile.

Second, it needs a “name” used within your game to display it as an option. In this example, we will use the self-explanatory “Game Mode”.

Third, a “default” value to ensure players don’t have to select the option every time they start a match. It is optional but recommended.

The fourth is whether the attribute is mandatory for the matchmaker to make a decision, by inputting “required” in this query. If the player did not send data, meaning they did not actively select the option for this required query, the matchmaker will either use the default value if specified or deny the player’s request.

The fifth, entirely optional, attribute is to inject the variable into the deployment. A useful attribute if you need to specify the assets to load such as a map to spawn players in. 

The sixth and final attribute is the list of every option for this selector grouped under the “items” field, with a mandatory minimum of one. In this example, we use the list of game mode types.

Again, we encourage you to look at our prebuilt configuration example in our documentation to pick and choose the attributes best tailored for your game. 

Chapter 7 - Matchmaker: Filters

“Filters” are another type of attribute to help developers group players even more precisely. In contrast to “selectors” that are player input, “filters” are acceptable range between two numerical values set by developers, for example player scores for an ELO ranking.

They are entirely optional and limited to one for the Automated Matchmaker. In early development, we strongly recommend skipping them altogether. Only once you want to fine-tune the matchmaker do we recommend you use them.

Each filter has the following six requirements.

First, a unique “key” to identify it within a given profile. In this example, we’ll give players a “score” as a sort of “ELO” ranking.

Second, a “name” used in to display in-game.

Third, is “required” which, as the name suggests, highlights if it’s mandatory for the matchmaker’s decision.

The fourth and fifth attributes respectively are “maximum” and “minimum” values, included in the range. 

The sixth and final attribute is the “difference” allowed by the range. This attribute contains two sub-attributes; the “positive” difference value and the “negative” difference value.

For example, if a player has a score of 200 and the filter has a negative difference of 40 and a positive difference of 20, then this player can be matched with others who have a score of at least 160 and at most 220.

And that’s it, you have successfully coded your matchmaker!

Chapter 8 - Edgegap: Hosting the Automated Matchmaker

For your automated matchmaker to work, it must be hosted on Edgegap. The process is easy and intuitive through only five simple steps.

First, log on to the Edgegap dashboard and navigate to the Matchmaker tab from the menu on the left.

Second, from the “Matchmaker” section at the top, scroll down to the “Matchmaker Configurations” section. Select “Create Configuration”, and a prompt will ask you for a name. Input one. Then, chose the format your coded your configuration, namely JSON or YAML. Then, copy and paste your configuration file into the text box.

With the pop-up closed, the third step has you scroll up to the “Matchmaker” section, and select “Create Matchmaker”. Enter a name and click on the “Create” button.

The fourth is to select the matchmaker that was just added, click on the “Create Release” button within the “Matchmaker Releases” section. A pop-up appears. Make sure the “Managed” option is selected, name your release, then select the appropriate configuration from the drop-down menu before selecting “Create Release”.

The fifth and final step is to enable the matchmaker’s state. Select the currently disabled option, and a pop-up appears. Select “Confirm” to enable, or disable, your Matchmaker. Once enabled, a URL appears at the top to which you use to send to your matchmaker requests from your game.

Chapter 9 - Testing

Congrats, your matchmaker is now available and fully managed by Edgegap!

As always, test things first.

Here, we will use the Edgegap’s Fish-Net game sample, which is available on our GitHub. Open the sample project from Unity’s HUB.

Once opened, you first need to add the matchmaker URL to your project. In this example, select the “Space Edge” folder, then “script”, followed by “Edgegap Matchmaker” and finally “Matchmaker”.

This opens up your code editor, which is where you will change the “Matchmaker URL” to the one provided from our platform.

Back in Unity, start the project.

Here, we add a player name and ELO score for this test. Then select “Create Ticket”. What this means is your players each create a ticket via this URL, then periodically check for updates on its status using their ticket's ID.

Once a match has been found, the matchmaker updates the status with the accurate information for players to connect to a server that is then automatically deployed on Edgegap. This allows your players to play your multiplayer online!

That is all for the Edgegap Managed Matchmaker tutorial. Thanks for watching! 

Check out our Discord for questions or comments with our developers. Or continue watching our other video tutorials!