Skip to content

Demo setup


Dedicated Server Kit has four main components:

  • The Go server.
  • The MySQL database.
  • The Unity game server (using Mirror).
  • The Unity game client (using Mirror).

How do these components interact between each other? It all starts with the Unity game client, which is your actual game. Upon starting the game, your player will register a new account with the system (if he does not have one yet) and log into it. Once logged in, he can create new games and join existing ones as well. Communication with the Go server happens via REST calls. The Go server is responsible for spawning new instances of the Unity game server as players create new games. The player's data is safely stored in a MySQL database (passwords are hashed using Argon2 encryption and clients do not have access to the database; only the Go server does).


In order to play the Dedicated Server Kit demo, please follow these steps:

  • Open the Unity Hub and create a new, empty 2D project with Unity 2021.3.19 LTS or higher.

  • Download and import the Mirror networking asset into your project.

  • Download and import the Dedicated Server Kit networking asset into your project.

  • Install the latest version of the MySQL database on your machine.

  • Install the latest version of the Go programming language on your machine.

  • Unzip the contents of the file located in the DedicatedServerKit/Core/Go folder on your machine.

  • Run the create_database.sql script to create the database (this is only needed the first time). We highly recommend installing MySQL Workbench on your computer to make sure the dsk database is correctly installed on your machine.

  • Start the MySQL server on your machine.

  • Run go build on the uncompressed dsk folder to generate the Go server binary. Finally, you can launch the Go server binary on the command line. Make sure to leave it running for as long as you want the server to be available. Always run the Go binary from the command line and not by double-clicking over it, so that you can see the output on the command line in case there is an error.

  • Build the game client and game server binaries by selecting the Build all option in the Tools/Dedicated Server Kit menu option.

  • At this point, you should be able to run the demo by launching the game client build.

Go server's configuration file

The Go server is the heart of the Dedicated Server Kit. You can easily configure it via the conf.json configuration file:

    "ip_address": "",
    "port": 8000,
    "db_connection_string": "root:@tcp(",
    "game_server_port": 9000,
    "jwt_key": "my_secret_key"

This is the meaning of each field:

  • ip_address: The IP address of the dedicated server.
  • port: The port number of the dedicated server.
  • db_connection_string: The MySQL database connection string. We use the default one for MySQL, which should work on any default installation of the database. Make sure to change the username:password part of the string to match your MySQL installation.
  • game_server_bin_path: The absolute path to your game server binary. If you are on Windows, make sure to use / as your separator character or, alternatively, escape the \ characters in your path so they look like this \. The default configuration file we provide was written on a Mac OS machine, so it uses \ as the separator character.
  • game_server_port: The starting port number for every spawned game server instance. For example, if you use 9000 here, spawned game server instances will use ports 9000, 9001, 9002 and so on.
  • jwt_key: The encryption key used to generate the hashed passwords for your users. Make sure to use a unique, private value here.

Opening your server ports

Make sure your Go server port is open (TCP port 8000 by default and as specified in the conf.json configuration file) and your game server binary ports are open as well (TCP port 9000 and so on by default and as specified in the conf.json configuration file). Please note Mirror's default transport Telepathy uses TCP; if you use a UDP transport you need to make sure the ports you open on the game server binary side are the UDP ones instead of the TCP ones.