Skip to content

Integrating Dedicated Server Kit

CCG Kit works in LAN mode by default, meaning games are created on your local network. This is very convenient for development and testing purposes, but most users will eventually want to move their game to a dedicated server in order to provide online multiplayer capabilities. The kit provides a free integration with Dedicated Server Kit (please note the kit includes Dedicated Server Kit and there is no need for you to purchase it separately). You can find the official documentation of Dedicated Server Kit here.

Please note that, when using the kit with a dedicated server, you are fully responsible for the provision, maintenance and payment of the server. We do not provide technical support for server-specific and server deployment issues. A knowledge of server administration, Go and MySQL is therefore strictly required on your end if you intended to deploy the kit to a dedicated server of your own.

Dedicated Server Kit setup

  • Please make sure you run the dedicated server setup on your local development machine before attempting to deploy to an actual, remote server. As tempting as that might be, there are many parts to the kit's networking stack and it is fundamental that you understand how they all work and interact together before proceeding further. Testing things locally on your computer removes an entire class of potential issues unrelated to the kit, like firewall issues or third-party-specific issues.

  • Add the ENABLE_DEDICATED_SERVER scripting define symbol to your player settings. This will enable the registration/login popups and the matchmaking buttons in the lobby.

  • Select the Build All option located in the Tools/Dedicated Server Kit menu. This step will automatically generate all the Unity binaries needed by the dedicated server setup. By default, these binaries will be located at the root of your Unity project in a folder named Builds. The first binary is the game client, which you will use to play the game. The second binary is the game server, which you will not use directly. It will instead be used by the Go dedicated server, which will spawn a new game server instance for every new game created on the lobby. The spawned game server instance will authoritatively manage the state of that particular game.

  • Unzip the .zip file named that is available inside CCG Kit to a desired location on your machine. This folder contains the Go dedicated server that is the essential component to the dedicated server setup. The Go server is responsible for managing the registration/authentication of players and the matchmaking for creating and joining games. It is connected to a MySQL database that stores the player data.

  • Install Go and MySQL on your machine. There are many ways to do this depending on your platform of choice, so please refer to the available documentation of these tools.

  • Run the create_database.sql script to create the player database. This is only needed the first time.

  • Start the MySQL server on your machine.

  • Run go build on the uncompressed dsk folder to generate the Go server binary.

  • Make sure the game_server_bin_path property of your conf.json configuration file points to the Unity game server binary you generated earlier (via the Build All option located in the Tools/Dedicated Server Kit menu). This is needed so that the Go server can spawn game server instances dynamically. You can find more information about this configuration file here.

  • You can now launch the Go dedicated server 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.

A successful launch of the Go dedicated server will print the following text on the command line:

INFO    2022/09/06 13:25:19 ############################
INFO    2022/09/06 13:25:19 #   Dedicated Server Kit   #
INFO    2022/09/06 13:25:19 ############################
INFO    2022/09/06 13:25:19 
INFO    2022/09/06 13:25:19 Starting server at
  • You should now be able to play with CCG Kit using Dedicated Server Kit locally on your development machine. For more detailed information on how to deploy to a production server, please refer to the official documentation of Dedicated Server Kit available here.

You can find the complete source code of Dedicated Server Kit in the CCGKit/ThirdParty/DedicatedServerKit folder of the project.

Once you have completed all the previous steps successfully, the flow for local testing becomes much simpler:

  • Start the MySQL server.

  • Start the Go dedicated server.

  • Play the game, either from the Unity editor or using the automatically generated game client build. For example, you can have the first player use the Unity editor and the second player the game client build.