Edgegap Plugin - Automated Game Server Hosting - Unity Tutorial

In this video, we will cover how set up the Edgegap’s Unity plugin to deploy, and host, an automated game server directly from Unity’s editor. As to get your game online and playable, worldwide, in seconds.

Let’s get to it.

Chapter 1: Setup

Before using the plugin, there are three requirements to ensure everything works.

First, make sure you use the latest Edgegap plugin. It can be downloaded directly from the Unity asset store. A direct link is in the description.

Once you have installed the Edgegap plugin from the store, it should appear amongst the top navigation menu bar. If not, import it by selecting “Window” from the navigation menu, then chose “Package Manager”. From the drop down menu, click on “Package”, and select “My Assets” to find Edgegap’s plugin.  You have the option to re-download the plugin to update it, but in this case, we will select “Import” to install it in Unity. A standardized warning will appear, thus click on “Install slash Upgrade” to move ahead.

Second, within Unity, head over to Unity’s Hub to confirm you have installed the “Linux Dedicated Server Build Support” module in your project. If not, simply click on the package and install it.

The third and final prerequisite is to install and run Docker. It containerizes your game servers to help it deploy and run faster. If you haven’t yet, you can go watch our Docker installation video, or head over to Docket dot com and follow the installation procedure. It’s easy and takes just a few minutes. 

Now, let’s get started!

Chapter 2: Edgegap’s Unity Plugin

Load up your project. In our case, we are using the tank sample project from Mirror Networking that is already setup for dedicated game servers. Any project set up for dedicated server will work with Edgegap’s plugin.

From the top navigation menu, select “Edgegap” and then click on “Edgegap Hosting which will open the plugin window.

To function, you first have to generate a token.

To do so, you must create an Edgegap account. Click on the “Get a Token” button which will open up your browser.

Signing up is free and takes just a few seconds. First, select “Get Started” at the bottom, then from the login screen, input your email and a password and opt into our terms. You’ll then instantly get a verification email. Click on “Confirm Your Email” to validate your account. Finally, input your organization’s name and confirm.   

This is Edgegap application’s dashboard. We strongly recommend exploring it with the tour, but we’ll skip it for this video. Automatically, a pop up with your unique OneClick Token appears. Simply copy it by clicking on the clipboard icon and paste it directly in the plugin’s text box.

Then, select verify which confirms the token is valid. The “Application Info” tab now opens automatically.

Should you already have an application on our platform, input its name in the text box and load it as an existing app. If not, which is the case in this tutorial, simply enter your project’s name. It must be in lowercase, with no spaces.

The “Create Application” button is now enabled. Select it. This opens the “Container Registry” and the “Deployment” tabs.

Container registry is where your game server’s container is stored. All you need to do is make sure the port and protocol types are accurate to your netcode transport’s as to ensure the server adequately listens for connection.

This information can be found in the network manager’s inspector tab. Here is Mirror Network’s sample project port, found under “Transport Configuration”. As for the Prototol Type, is it accurate in this case as this particular sample project by Mirror uses UDP. If you are unsure, refer to your netcode’s documentation to confirm which transport it uses, or select the appropriate option based on your unique choice.  

“New Version Tag” refers to the unique version of your server. This field requires your manual input. We recommend changing the value whenever you proceed with updates to your game server.

For advanced users, Edgegap provides the option use a “Custom Container Registry”. For this tutorial, we will use the Edgegap’s default one.

The second to last step is to select “Build and Push”. This automatically compiles the project into a dedicated Linux server, then create a Docker container which is deployed to Edgegap’s registry.

The last step is to create a new deployment. Under “Status”, you will see it’s progress. Once ready, an URL appears. Copy it by clicking the clipboard button, then paste the information within the network manager’s inspector tab. Under “Network Information”, replace the current “Network Address” by pasting the URL. Make sure to remove the value of the port, which must be inputted in the “Port” field under the “Transport Configuration” section.

Unselect the “Auto Start Server Build” option, as this allows you to connect as a client directly from Unity’s editor.

Finally, start your game scene by clicking the play button atop the editor.

Congrats, your game is now online for the world to play!

Chapter 3: Testing

Evidently, test things first. In our case, using Mirror’s sample project, we confirm the client’s address is correct and can launch a session by selecting “Client”.

Once you are done testing, return to the Edgegap plugin to automatically stop the server instance by selecting “Stop Server”.

That is all for the Edgegap plugin for Unity, which empower game developers with automated game server and simple hosting.

The likely next step in your game development will be to connect players. For more information on Edgegap’s free, simple and fully automated matchmaker, you can check out our tutorial.