Techpod weekdays. Placement of the game server on VDS

Short description

Virtual Dedicated Servers (VDS) are often used for game servers, allowing for a more convenient and 24/7 option hosted on a virtual machine. System requirements for specific gaming projects vary, but a recommended minimum includes 4 CPU, 4 RAM, and an SSD to improve performance. Once a VDS is ordered, the server will install within a few minutes and can be connected to via RDP, allowing for further configuration, such as installing and configuring SteamCMD. The article provides step-by-step instructions for starting servers for two specific projects, V Rising and Valheim, including opening ports in the firewall and managing server settings.

Techpod weekdays. Placement of the game server on VDS

One of the popular areas in which VDS is used, and which our support clients are often interested in, are game servers. Most often we hear the question: “Is it possible?”, “Will friends and other users be able to connect to it?”, “And what parameters are suitable?”. And, of course, VDS-servers not only can, but also should be used for similar tasks. It is much more convenient to deploy a game server on a virtual machine that is independent of your PC and works 24/7.

Other articles of the “Weekdays of Techpod” series

▍ Creating a VDS to host a game server

Depending on the project, the system requirements for the server may vary. Somewhere 2 processor cores and 2 gigabytes of RAM will be enough, and somewhere 8 gigabytes will not be enough. Minimum requirements for my example projects: 4 CPU, 4 RAM, also recommended SSD. So I will use the following configuration:

“NVMe” was selected as the drive, and “Windows server 2022” as the operating system. The cost of such a configuration is 2,884 rubles per month, but with a promotional code

HABR15

you can get extra

15% discount

(The promo code is combined with other discounts).

After ordering, the server will be installed within a few minutes and will appear in the “My Servers” tab with all the data that is required for RDP connection.

We connect to the server via RDP and proceed with further configuration.

▍ Installing and configuring SteamCMD

Although the installation process is identical to all projects, the settings in different game servers differ and are primarily adjusted to the specifics of a particular game. In this article, I will give an example of starting a server for two projects: V Rising and Valheim.

First you need to download and install the “steamcmd” application. After downloading the archive, go to the root of the “C drive”, create a folder with the name “steamcmd” in it and unzip the program itself into it.

Now open the command line, go to the created folder and start installing the program. This is done by the following commands:

cd C:\steamcmd

steamcmd

We have gained access to the “steamcmd” program and can start installing the game server. First, we need to create a folder (I’ll use the name “v-rising”) to store our server. This is done by a team:

force_install_dir ./имя папки/

We also need to log in to our steam account to be able to download the apps we need. Authorization will be carried out under the login “anonymous”. Enter the command:

login anonymous

Next, we need to load the game server itself. To install a specific program, we will need its ID. We can view it on the website

steamdb.info

In the search on the site, we indicate the name of the game we need (in my example, it will be the games V Rising and Valheim), in the “App Type” field we select “tool” and in the list we find the application with the inscription “dedicated server”.

Enter one of the commands:

app_update 1829350 //для установки V Rising

app_update 896660 //для установки Valheim

The server will load and install, and then you can close steamcmd. Execute the command:

quit

From the next stage, differences appear in the configuration of projects, but their logic is similar and easy to understand. We will first look at an example with the V Rising project, and then with the Valheim project.

▍ Starting the server on the example of V Rising

Now, going to the created folder, we can see the game server files. First of all, we are interested in the file with the “bat” extension. It contains server startup options. In the case of V Rising, this is the “start_server_example.bat” file. Select it with the right mouse button and press “Change”.

“VRisingServer.exe” is the file that will be run when the bat file is run. “serverName” is the name that will be displayed in the list of all servers and by which our server can be found. saveName — the name of the file in which the saves of our game world will be stored. First of all, we are interested in the name “serverName”. We change it at our own discretion.

In some projects (for example, Valheim, which we will look at next), this file can also specify additional information, such as server password, port number, administrator password, etc., but in the case of V Rising, this information is edited in separate files. Save the changes and close the file. Go to the VRisingServer_Data – StreamingAssets – Settings folder and find the files ServerGameSettings.json and ServerHostSettings.json.

In the first file, you can configure the game parameters of the server (server type, amount of mined resources, etc.), and in the second, you can configure the host parameters (server port, server password, number of users, etc.). Let’s open the second file using any text editor (for example, notepad). The main information we are interested in here are the port numbers. We need to open them in the Windows firewall so that the server can be found and connected to it. The default is ports

9876

,

9877

and

25575

but you can specify others if you wish.

We remember these ports, if necessary, perform additional options and close the file.

▍ Opening ports in the firewall

Now we need to configure the firewall and open the ports that were specified in the host configuration file. Click on the keyboard

Win+R

(or right-click on the “Start” menu, select “Run”), enter

firewall.cpl

and in the window go to additional parameters.

We need to create rules for incoming and outgoing connections. Click “create rule”.

In the “Rule type” item, select “For port”.

Next, select the protocol and the required ports (we will open both TCP and UDP, so this procedure will have to be repeated). Select the protocol and enter the necessary ports through a comma.

Next, select “Allow connection”.

We agree with the next point, specify the name of the rule and click “Done”.

We perform the same actions for UDP, as well as for outgoing connections (in total, we added 4 rules: 2 for outgoing and 2 for incoming connections). Close the firewall window and start the server.

▍ Starting the V Rising server

The setup is complete, now we can start the server itself and then connect to it. The startup is done via the bat file (start_server_example) that we edited a few steps ago. Let’s start it.

The server is up and running and we can now connect to it. Let’s launch the game, go to the list of servers and try to find it. Enter the name of our server in the search and wait for the list to be updated.

Select our server and connect to it. You can play, other players can also connect to it.

▍ Server settings on the example of Valheim

Now let’s consider the option with setting up a server for the Valheim game. By analogy with V Rising, we already have a ready-made bat file that contains the settings for starting the server. In some projects, this file may not be available, but if necessary, it can be created manually. Just create a text file and specify the bat extension. Open it with a text editor by right-clicking and selecting “Change”.

In this file, we are interested in the last line. Like V Rising, it contains the name of the file that will be launched (valheim_server) and the name of our server (name). Also, here you can immediately specify the port that our server will use and the password from the server. The port is set by default

2456

and the recommended ports to open

2456-2458

(but this does not mean that other ports cannot be used).

We edit the file at our own discretion (change the port, password, etc.) and close it. Go to the firewall and, as in the previous example, create 4 rules (2 for outgoing and 2 for connecting). Specify the ports

2456-2458

.

Close the firewall and run the file

“start_headless_server”

.

The server is up and running and we can now connect to it. Start the game, go to the page with servers, select “Join the game” and press “Add server”. In the window, we enter the IP of our server (in our case, it is the IP of our VDS server, on which the game server is located) and, through a colon, we indicate the port that was written in the startup file (in our case, it is 2456).

Click “Add server” and it will appear in the list. Select it and click “Connect”. Then we enter the password that we specified in the startup file and press “Enter”.

Done! We have successfully connected to the server and can start the game.

▍ A couple of final words

As we have seen, there is nothing complicated about starting your game server, and you can do it in just 10-15 minutes. Unfortunately, it is impossible to make a completely universal guide for all game projects, because each of them has its own unique settings, but I hope that the examples described in this article will help you understand other projects as well.

Telegram channel with prize draws, IT news and posts about retro games 🕹️

Related posts