Difference between revisions of "Dedicated Server Kit Digital Ocean Setup"
(→Configure the game client on the Unity side) |
|||
Line 73: | Line 73: | ||
With the remote server properly configured, you can now test the game client from within the Unity editor. You will need to create a new configuration that points to your droplet's IP address instead of localhost. Make sure to update the ''Client'' object in the client's ''Home'' and ''Lobby'' scenes so that they point to this configuration. | With the remote server properly configured, you can now test the game client from within the Unity editor. You will need to create a new configuration that points to your droplet's IP address instead of localhost. Make sure to update the ''Client'' object in the client's ''Home'' and ''Lobby'' scenes so that they point to this configuration. | ||
+ | |||
+ | = Appendix: Generating the Linux game server build = | ||
+ | |||
+ | You can generate the game server builds that you will upload to your droplet either manually via the ''Build Settings'' window in Unity, or programmatically via the included editor script. The most important thing to note is that the build needs to contain the ''GameServer'' and '''Game''' scenes (with the ''GameServer'' scene being the first one). | ||
|} | |} |
Revision as of 10:35, 28 December 2020
ContentsBefore proceedingIt is highly recommended that you test the kit locally on your machine first, before trying to deploy it to a remote server. It is also highly recommended that you have a basic knowledge of server administration before attempting to deploy the kit to a remote server. Please note:
In this section, we include a step-by-step tutorial on how to deploy the kit to a remote server on Digital Ocean. This serves two purposes: to demonstrate the kit has been successfully deployed to an actual, remote server and to serve as a helpful reference for your own deployments. There is an infinite variety of service providers available on the market and we could never possibly cover them all, but the main steps should be similar across all of them. Creating a new dropletAfter creating your account on Digital Ocean, go to the Droplets section and create a new droplet (a droplet is the term used by Digital Ocean to refer to one of their remote servers). Feel free to use the configuration most suited to your needs, but please note this tutorial assumes a Ubuntu 20.04 (LTS) x64 server. Installing the required dependenciesOnce your droplet is created, you can log into it via SSH with the following command: ssh root@YOUR_IP_ADDRESS Once connected to the droplet, you need to install Go and MySQL. You can install Go with the following command: snap install go --classic And MySQL with the following command: sudo apt install mysql-server We highly recommend studying the official guide on MySQL from Digital Ocean available here, as your setup can go from very simple for a quick test to more complex and secure for production purposes. Create the MySQL databaseWith MySQL properly configured, you can now send the database creation script via the following command: scp create_database.sql root@YOUR_IP_ADDRESS:~/create_database.sql You can run the script by entering into the MySQL console in your droplet and typing the following command: mysql> source create_database.sql Setup and launch the Go serverWith the database properly configured, you can now send the Go server and the Linux game server build files via the following commands: scp dsk.zip root@YOUR_IP_ADDRESS:~/dsk.zip scp ServerBuild.zip root@YOUR_IP_ADDRESS:~/ServerBuild.zip You can unzip these files with the unzip command. Before launching the Go server, you will need to tweak the conf.json file so that it contains valid information for your server. Specifically, you want to make sure the following properties are correct: "ip_address": "YOUR_IP_ADDRESS" "db_connection_string": "YOUR_MYSQL_USER:YOUR_MYSQL_PASSWORD@tcp(127.0.0.1:3306)/dsk" "game_server_bin_path": "YOUR_ABSOLUTE_PATH_TO_THE_GAME_SERVER_BINARY" Now, you can finally build the Go server via the following command: go build And launch it in the background via the following command: ./dsk & Configure the game client on the Unity sideWith the remote server properly configured, you can now test the game client from within the Unity editor. You will need to create a new configuration that points to your droplet's IP address instead of localhost. Make sure to update the Client object in the client's Home and Lobby scenes so that they point to this configuration. Appendix: Generating the Linux game server buildYou can generate the game server builds that you will upload to your droplet either manually via the Build Settings window in Unity, or programmatically via the included editor script. The most important thing to note is that the build needs to contain the GameServer and Game scenes (with the GameServer scene being the first one). |