Add Dedicated Game Server to Photon Fusion 2 through the Asteroids Sample - Learn How to Host a Multiplayer Copy

In this video, we will cover every step on how to easily deploy a game server to host Unity Engine’s Boss Room sample which uses Netcode for Game Objects (NGO) as for two players to play online directly from Unity's editor using Edgegap.

Let’s get to it.

Part 1 - Setup

Alongside this video, we recommend following our documentation, a link is available in the description and the comments. 

First, either by using the link in the description, or comments, or the documentation itself as shown on screen, make sure to download Edgegap’s modified Boss Room sample available on GitHub. From the GitHub page, select the “Code” button and then copy the Git’s URL. On Windows-based computer, open the sample’s destination folder and type “CMD” in the title bar to open the Command Prompt. Type “git clone” and paste the URL you just copied. This automatically downloads the project in the folder. This ensures the sample doesn’t have error once loaded in Unity. For Mac, open a new terminal, use the “cd [PATH]” command to navigate to where you want to put the project folder in, then use “git clone” and paste the URL.  

Then, starting from an all-new project from Unity’s HUB, select "Install Editor" and select the latest “Unity 6 LTS” version. As of recording, Unity 6.0 is the current “long term release” or LTS.

Newer version may have incremental improvements but are very likely to break certain functionalities. As such, we strongly recommend using the main latest LTS version to ensure that compatibility works on this sample, and your development project in general.

Now, back to the project’s menu, select “Add” and then “Add from Disk”. Locate the sample and select its main folder.

Here, Unity is likely going to warn you about a missing Unity version. As previously stated, the latest LTS as of recording is “6000.0.56.f1”. Ignore this warning and select the latest LTS version. While you can use the latest recommended version, be aware it could break the project.

Part 2 - Edgegap: Game Server Hosting & Orchestration

The next step is to deploy a game server as to have players connect to it and play online.

Edgegap is a game server orchestration platform tailored for multiplayer games that helps you host your multiplayer easily.

First, create a free Edgegap account.

Either head to "Edgegap.com" and select "Start for Free” or use the direct link in the documentation. Input your email and a password and opt in to 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.

Edgegap has automated the process of creating an app version using Unity NGO’s Boss Room sample. While you can create a version manually, simply head over to our documentation and select the "Create a new app version for your application" link, which is also available in the description and comments.

The "Create an Application" prompt is now pre-filled. Select "Create an Application", then select the "NGO Boss Room Unity" button which automatically fills the application's metadata.

Then, scroll down and select "Submit". The "Create a Port" prompt highlights the port and the protocol, in this case UDP. Scroll down and select "Deploy".

Port editing is successful. Scroll up once again and select “deploy” in the top right corner.

Your latest application and its version are set by default, here our Boss Room sample. Select the ideal region for you, in our case Americas, scroll down and click on "Deploy".

After a few seconds, the deployment of the game server changes its status from “Waiting” to "Ready".

Congratulations, you've deployed your first game server!

Please make sure to note the “external port” for testing. Then, head over the “logs” tab and make sure to copy the public IP highlighted here next to “ARBITRIUM_PUBLIC_IP” in this list.  

Part 3 - Testing

To test multiplayer games, we will first open Unity’s editor with using Edgegap’s Boss Room sample Select “Main Menu” to open up the sample’s main scene.

We’ll need two players to connect to the game server. While Unity’s “Multiplayer Play Mode” can be used here, we’ll use ParrelSync to simulate these two players.

Using the link in the description, comments or documentation, download ParrelSync from GitHub. Back within Unity, select “Window”, then “Package Manager” and click on the “+” button.

Finally, select “Install Package from Disk” and open ParrelSync to add it to your project.

Once installed, it will appear in the top navigation bar.

Select “ParrelSync”, then “Clones Manager” and finally “Create a New Clone”.

After some loading time, select “Open in New Editor”.

Now, an entirely new project, cloned from the initial one, opens. This window is your simulated, second player.

Within both windows, start the “MainMenu” game scene by clicking the “play” button.

Then, select “Start with Public IP”, then open the “Join with IP” tab an paste the public IP from your deployment copied earlier, and input the external port noted before. Here in this example, 31432.

Select “Join” which sends the first players to the player selection screen.

Repeat these steps for the second player.

There you have it, both players are connected to your game server. Congratulations!

Finish your characters selection, and you’ll see both players replicate each of your actions on screen. Which confirms both players are connected to the same game server your deployed. Congrats!

Part 3 - Next Steps

Unity’s Boss Room sample using Netcode for Game Object is a useful tool to learn networking.

The next step in your development journey will be to create a game server for your own, unique, Unity project.

Our game server tutorial for Unity is viewable here on YouTube and highlights every step to get your game online and have players connect to it.

Edgegap also offers a matchmaker whose tutorial is also linked here.

Thanks for watching!