Difference between revisions of "Dedicated Server Kit Demo Setup"

From gamevanilla wiki
Jump to: navigation, search
(Setup)
(Setup)
Line 33: Line 33:
 
* Start the [https://dev.mysql.com/doc/mysql-startstop-excerpt/8.0/en/ MySQL service] on your machine.
 
* Start the [https://dev.mysql.com/doc/mysql-startstop-excerpt/8.0/en/ MySQL service] 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.
+
* 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 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.
 
* Build the game client and game server binaries by selecting the ''Build all'' option in the ''Tools/Dedicated Server Kit'' menu option.

Revision as of 01:59, 28 July 2020

Introduction

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).

Setup

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 2019.4.0 LTS or higher.
  • Download and import the Mirror 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 dsk.zip 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.
  • 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 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.