Add Dedicated Game Server to Fish-Networking's HashGrid Demo - Learn How to Host a Multiplayer Game

In this video, we will cover every step on how to easily deploy a game server to host Fish-Networking's "Hashgrid" multiplayer demo for two players directly from Unity's editor using Edgegap.

Let’s get started

Part 1 - Setup

Starting from an all-new project from Unity’s HUB, select "Install Editor" and select the latest version available. Which was Unity 6.1 at the time of recording, but functions from Unity 2021 onwards including Unity 6 LTS.

Create and start a new project.

Once the editor is open, use the link from our documentation to directly head over to Unity's Asset Store and, making your sure are logged in, download the Fish-Networking project by selecting "Add to My Assets". A direct link is also available in the description and in the comments.

Your "Package Manager" should open automatically. If not, in the editor select "Window" from the top navigation bar then "Package Manager".

Once opened, select "Import to Project" to add Fish-Networking to your project. Click on "Install/Upgrade"

Then, Unity prompts you to import it. Select "Import" once again.

Congrats, FishNet is now in your project and should be visible from your "Assets" navigation menu on the bottom left of the editor.

Part 2 - Edgegap: Game Server Hosting & Orchestration

The next step is to deploy a game server to have players connect to the host 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 Fish-Net’s Hashgrid demo. 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 "Fish-Net Hashgrid" button which automatically fills the application's metadata.

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

With your application created, the next step is to create a deployment which is the game server players will connect to.

From the navigation menu, select "Deployments". Then, click on the "Create a Deployment" button.

Your latest application and its version are set by default, here our Fish-Net Hashgrid demo. 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!

Click on the deployment to open its detail page, which highlights where the game server was deployed.

Please make sure to note the URL to which players must connect to, under the "Host" section. It is also important to note the External Port for testing.

Part 3 - Testing

To test multiplayer games, we will first open up the Hashgrid demo. At the bottom left, select Fish-Net, then “Demos”, now “Hashgrid” followed by “Scene” and click on the Hashgrid scene to open it.

To prepare the scene to connect to our server, select Fish-Net’s “Network Manager”. Scroll down to “Tugboat”, its transport protocol. If it isn’t set, select “Add Component” and chose “Tugboat”.

We will have to replace the client address from “Local Host” to the host’s URL from our deployment. Return to the deployment and copy it, then paste it in the Network Manager.

We also have to do the same for the “Port” using the deployment’s external port, here 31842.

Finally, head to Fish-Net’s “NetworkHudCanvas” and ensure the “Auto Start Type” is set to “Disabled”

Start the scene by selecting “play” and then click on “Client” which connects you to your deployment. Congrats, the Hashgrid demo is now connected to your game server!

Online multiplayer requires more than one player though!

To simulate this, you need the "Multiplayer Play Mode" package.

Return to Unity's Package Manager, select the "Unity Registry" tab and scroll down to find it. Or type "Multiplayer Play Mode". Install the package.

Once installed, return to your game scene. Then, from the top navigation bar, select "Window" and "Multiplayer Play Mode" to open the editor.

Under "Virtual Players" select the amount of players you need. In this tutorial, we'll have two. Select and save your selection.

The second to last step is to start the game scene in Unity.

Once loaded, both the game scene representing "Player 1" and the Multiplayer Play Mode window representing Player 2 should be functional.

We'll move each window to make things easier to see, but this is purely optional.

In both players' windows, select "Client" to have each player connect to the game server.

As you can see, both players are connected to the game server, and the game is synchronized with each player's input.

Congratulations, you are now using Fish-Net Hasgrid demo to play multiplayer online using Edgegap's game server hosting platform.

Part 3 - Next Steps

Fish-Net’s Hashgrid demo is a useful tool to learn networking.

The next step in your development journey will be to create a game server for your own 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 available here.