The downside to this method is that it does technically cost money. You may have to provide a payment method with Google. However, there is a one-year trial which gives $300 in credits, and the smallest instance is only about $5 a month.
The first step in this process is setting up your client files. You will need a Lego Universe 1.10.64 client before continuing. Note that a link to a client cannot be provided in this guide for legal reasons, but Google should be able to help you.
Once you've obtained a client, [make sure it is good by validating the checksum](verify-my-client.md).
## Unpack Client Files
If you downloaded an unpacked client, you may skip this section and move onto [creating the server 'res' directory](#setup-resource-directory).
Darkflame Universe requires an unpacked client, both for setup and for play. An unpacked client can be distinguished by containing extra files and folders in the `res` folder in the client, such as the `macros`, `names`, `maps`, and `scripts`.
If these folders are missing, you will need to extract them from the client resource data.
Once you have an unpacked client, you will need to retrieve several files from it, that the DLU server needs in order for it to work. Create a folder called `server-resources` somewhere easy to remember, and follow these steps:
Finally, right click your `server-resources` folder, and select 'Send to...' > 'Compressed Folder'. This will compress the folder into a single ZIP file. You will need this ZIP file later.
Google makes it very easy to set up a server instance in the cloud. First, [sign up for an account with Google Cloud](https://cloud.google.com/). You should see this popup to let you know you've received $300 in trial credits:
Then, you can access your cloud account from the [Google Cloud Console](https://console.cloud.google.com/). Google has a LOT of powerful tools and resources, but most of them are designed for larger businesses and not relevant to this guide, so don't get overwhelmed.
Click on the `Compute Engine` tab, and then click on the `Create Instance` button to create a new VM instance.
* Name it if you like. The default regon and zone are fine.
* Select the machine type. The default is a 2-core, 4GB memory machine, which is way overkill for what we want. Select the series N1, machine type `f1-micro`, which at time of writing is currently priced at $4.88/month or $0.01/hour. Even this is more than what you need for a DLU server but smaller instances aren't available.
* Scroll to the bottom and click Create.
Once the instance is ready, click it, then click SSH to connect to your instance. You will then see a browser window containing a terminal.
Congratulations! What you've essentially done is reserve a tiny spot on Google's massive server farm, and created a Linux computer in it. We're going to build and install Darkflame Universe on here, and you and your friends will be able to connect and play the game.
# Allocate swap space so we don't run out of memory while building.
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
sudo mysql -u root
```
The last command will start a MariaDB shell. Enter the following commands one at a time (be sure to change the password on the first line to something more secure):
Next, we're going to upload the resources folder [we created earlier](#setup-resource-directory) to the proper location. In order to do this in a way that doesn't differ between computers, we're going to create a Google Cloud Storage bucket and upload the files to it.
* Click 'Google Cloud Platform' at the top to move to the Google Cloud homepage.
* Click 'Cloud Storage' on the left.
* Click 'Create Bucket' at the top.
* Pick a name that is easy to remember and easy to type. It needs to be GLOBALLY unique apparently.
* Stick with the defaults for region, storage class, access control, and protection.
Now the bucket is created, you will see the details page for that bucket and a list of objects (i.e. files) in it.
Click 'Upload File', select your `server-resources` ZIP, and click upload. This process should take just a second.
## Configuring the Server's Firewall
Before we get started building the server, we need to configure the server's firewall. Follow these steps:
* Click 'Compute Engine' to move back to the Compute Engine homepage.
* Under Related Actions, click 'Set up Firewall rules'
* Click 'Create Firewall Rule' at the top.
We're going to create a set of Firewall rules that allow access to the server.
* Set the name to `darkflame-server`.
* Add `darkflame-server` to the list of target tags. We're going to assign this tag to our server later.
* Set the Source IPv4 ranges to `0.0.0.0/0`. This represents all IP addresses, meaning this rule will allow any incoming IP.
* Under Protocols and ports, check `TCP` and enter the string `1001, 2000, 2005, 3000-4000, 3306, 5000`. This will allow access to the auth server, master server, chat server, world servers, database, and account manager.
* Under Protocols and ports, check `UDP` and enter the string `1001, 2000, 2005, 3000-4000, 3306, 5000`.
First run the following command; you will be prompted to create a username and password. Make this secure, as it will be the credentials for a Mythran account with full server operator access.
Now that you are running a server, you should follow these steps:
* Go to your web browser, and navigate to `http://<IP-ADDRESS>:5000/dashboard`, where `<IP-ADDRESS>` is the IP address of your server.
* You will see a login. Enter the Mythran credentials you entered earlier.
* You will be redirected to the dashboard. Enter a number of keys to generate, and click `Generate`.
* You will see a list of CD keys. Give one of these keys to each player you want to join.
To allow a player to join, give them one of these CD keys, and tell them to go to `http://<IP-ADDRESS>:5000/activate` and create an account.
Once they have an account, the player should be able to change their client's `boot.cfg` to use your IP address, and login with the account they just made, and play the game.
<!-- At the top of the dashboard, you will also see a `Name Approval` button. Click it to switch to a new tab where you can approve custom minifigure usernames. -->
In the future, updates will be release to DarkflameServer that will include bug fixes and potentially even new features. To update the server, you can run the following commands, in order: