Question

UNITY DEPLOYMENT ON DIGITAL OCEAN DROPLET

Hi All,

I made a unity Multiplayer Game similar to POKER Game. I have the game running on local machine with unity’s default local IP and port. I am able to create room,players can join room.

I am using Master Server Kit for managing Server side on local.

From my understanding i have use my droplet’s IP and Some open Port to access the server.

But as i don’t have server side understanding, i would be very thankful if some can give me reference material on how to :

  1. Open port in digital ocean Ubuntu 16.04.
  2. Where to put my ZoneServer.exe,RoomServer.exe,and WorldServer.exe in filesystem?
  3. How can i access suppose ip:port/Zoneserver.exe

So far, i have tried numerous solutions, but none worked.

Usually, i would create a game and test it on Local Machine only.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Ryan Quinn
DigitalOcean Employee
DigitalOcean Employee badge
April 18, 2018
Accepted Answer

Hi! While I haven’t worked with the Master Server Kit I just happen to have been playing with Unity networking, running a server for a game I’m building as a hobby. I think I can help clarify things for you:

Open port in digital ocean Ubuntu 16.04.

By default your ports will be open. When you are ready to set up a firewall this guide will walk you through the process.

Where to put my ZoneServer.exe,RoomServer.exe,and WorldServer.exe in filesystem?

You can place them anywhere. Personally I have two server systems for my game and store them in folders under /opt like /opt/gameserver1 and /opt/gameserver2 but that’s just my preference.

One thing to note is that you’ll need to build the server for Linux. On the build settings screen select Linux 64 bit and check the box for headless mode. This allows your server to start up from the command line without the need for a graphical environment.

How can i access suppose ip:port/Zoneserver.exe

You won’t have to direct your connection to the name of the executable. When you start your server it will bind to the port specified and all connections to that port would then go to your Zoneserver. Here is the connection string I am using in my project…

using UnityEngine;
using UnityEngine.Networking;

public class main_loader : MonoBehaviour {
   NetworkClient myClient;

   void Start() {
      if (SystemInfo.graphicsDeviceID == 0){
		if(true){
			isServer = true;
			startServer();
		}
		else {
			isServer = false;
			startClient();
		}
   }

   void startClient () {
      myClient = new NetworkClient();
      myClient.RegisterHandler(MsgType.Connect, OnConnected);
      myClient.Connect("server.example.org", 4242);
   }

   void startServer() {
      NetworkServer.Listen(4242);
   }

}

The Start() section will determine if the code is running as a client or a server by checking if there is a graphics device. Since only the server is built to run headless this is a reliable method. Then if the code determines it’s a server it will run startServer() which begins listening on port 4242. If it detects that it’s a client it will try and connect to the server at “server.example.org” on port 4242.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel