Difference between revisions of "Server Hosting"

From Holdfast: Nations At War
Jump to navigation Jump to search
Line 91: Line 91:
  
 
==Linux==
 
==Linux==
 +
===Docker===
 +
If your server is running [https://www.docker.com/ Docker], you can simply use:
 +
<pre>
 +
docker run -d --net=host --name=holdfastnaw-dedicated cm2network/holdfastnaw
 +
</pre>
 +
 +
The container will automatically update the game on startup, so if there is a game update just restart the container.
 +
 +
The config is located here: ''/home/steam/holdfastnaw-dedicated/''
 +
 +
If you want to launch another instance you can increment the environment variables, using -e (--env):
 +
<pre>
 +
docker run -d --net=host -e SERVER_PORT=20100 -e STEAM_COM_PORT=8700 -e STEAM_QUERY_PORT=27000 --name=holdfastnaw-dedicated cm2network/holdfastnaw
 +
</pre>
 +
 +
You can find the associated Docker Hub page here:
 +
[https://hub.docker.com/r/cm2network/holdfastnaw/ https://hub.docker.com/r/cm2network/holdfastnaw/]
 +
 +
===Manual Setup===
 
As there is no dedicated server and no Linux build, setting up a [[Holdfast: Nations At War]] game server requires the usage of [https://www.winehq.org/ Wine] or some other sort of library-level virtualization. This will always incur [https://www.phoronix.com/scan.php?page=article&item=wine_win7_2010&num=2 performance looses], so it's not recommended to use [https://www.winehq.org/ Wine] to host large player servers (> 60 players). One can observe such behaviour if players start continuously sliding and jittering on the server, this can't be observed on non-virtualized game servers
 
As there is no dedicated server and no Linux build, setting up a [[Holdfast: Nations At War]] game server requires the usage of [https://www.winehq.org/ Wine] or some other sort of library-level virtualization. This will always incur [https://www.phoronix.com/scan.php?page=article&item=wine_win7_2010&num=2 performance looses], so it's not recommended to use [https://www.winehq.org/ Wine] to host large player servers (> 60 players). One can observe such behaviour if players start continuously sliding and jittering on the server, this can't be observed on non-virtualized game servers
 
===Download Requirements===
 
===Download Requirements===
Line 96: Line 115:
 
Make sure no previous version of [https://www.winehq.org/ Wine] has been installed, if it has, uninstall it completely and don't forget to run apt-get autoremove to clean up the remaining files. This command will install all required packages and [https://www.winehq.org/ Wine] for you:
 
Make sure no previous version of [https://www.winehq.org/ Wine] has been installed, if it has, uninstall it completely and don't forget to run apt-get autoremove to clean up the remaining files. This command will install all required packages and [https://www.winehq.org/ Wine] for you:
 
<pre>
 
<pre>
$ dpkg --add-architecture i386 \
+
$ apt-get update \
        && apt-get update \
+
&& apt-get install -y \
        && apt-get install -y \
+
libsqlite3-0 \
            gnupg \
+
wget \
            gnupg1 \
+
ca-certificates
            gnupg2 \
 
            curl \
 
            unzip \
 
            xvfb \
 
        && curl -o Release.key https://dl.winehq.org/wine-builds/Release.key \
 
        && apt-key add Release.key \
 
        && echo "deb http://dl.winehq.org/wine-builds/debian stretch main" >> /etc/apt/sources.list \
 
        && apt-get update \
 
        && apt-get install -y --install-recommends winehq-stable \
 
        && rm Release.key \
 
        && curl http://dl.winehq.org/wine/wine-mono/4.7.1/wine-mono-4.7.1.msi | wine msiexec /i; exit 0
 
 
</pre>
 
</pre>
  
Line 125: Line 133:
 
The '''Steam Console Client''' or [https://developer.valvesoftware.com/wiki/SteamCMD '''SteamCMD'''] is a command-line version of the Steam client. Its primary use is to install and update various dedicated servers available on Steam using a command-line interface. It works with games that use the SteamPipe content system. All games have been migrated from the deprecated HLDSUpdateTool to [https://developer.valvesoftware.com/wiki/SteamCMD '''SteamCMD''']. This is usually required if you are forced to use a terminal for your server setup. You can find instructions on how to download [https://developer.valvesoftware.com/wiki/SteamCMD '''SteamCMD'''] here: https://developer.valvesoftware.com/wiki/SteamCMD#Linux
 
The '''Steam Console Client''' or [https://developer.valvesoftware.com/wiki/SteamCMD '''SteamCMD'''] is a command-line version of the Steam client. Its primary use is to install and update various dedicated servers available on Steam using a command-line interface. It works with games that use the SteamPipe content system. All games have been migrated from the deprecated HLDSUpdateTool to [https://developer.valvesoftware.com/wiki/SteamCMD '''SteamCMD''']. This is usually required if you are forced to use a terminal for your server setup. You can find instructions on how to download [https://developer.valvesoftware.com/wiki/SteamCMD '''SteamCMD'''] here: https://developer.valvesoftware.com/wiki/SteamCMD#Linux
  
The files can then be obtain using the following bash command:
+
The dedicated server can then be obtain using the following bash command:
 
<pre>
 
<pre>
 
$ steamcmd.sh \
 
$ steamcmd.sh \
        +@sSteamCmdForcePlatformType windows \
+
         +login anonymous \
         +login [LOGINNAME] [PASSWORD] \
 
 
         +force_install_dir /opt/holdfastserver \
 
         +force_install_dir /opt/holdfastserver \
         +app_update 589290 +quit
+
         +app_update 1424230 +quit
 
</pre>
 
</pre>
  
 
Notes:
 
Notes:
: This will download the Windows game files. Library-level virtualization is required to run them (e.g. [https://www.winehq.org/ Wine]).
+
: In case the server ever stops working you can run the command with ''+app_update 1424230 validate'' to verify the game files.
: ''+anonymous'' will fail because the account requires to own a copy of the game to download the game files!
 
: You might need to enter a ''2-Factor Auth Code'' during this step.
 
: In case the server ever stops working you can run the command with ''+app_update 589290 validate'' to verify the game files.
 
  
===Obtaining the server files===
 
You can obtain the server files, hosted [https://www.dropbox.com/sh/ppkfny3r9kcnz8x/AADiIXOrlAWPh-XbhPpimw0ja?dl=1 here], using the following command:
 
<pre>
 
$ cd /opt/holdfastserver \
 
        && curl -L -o holdfast_naw_public_servers.zip https://www.dropbox.com/sh/ppkfny3r9kcnz8x/AADiIXOrlAWPh-XbhPpimw0ja?dl=1 \
 
        && unzip -o holdfast_naw_public_servers.zip \
 
        && rm holdfast_naw_public_servers.zip
 
</pre>
 
This will place the server files in the install directory of the [[Holdfast: Nations At War|Holdfast]] game files.<br>
 
'''''Note:''' These files change from time to time but not necessarily every update, only reapply them if the server stops working after an update.''
 
  
 
===Basic Configuration & Starting the Server===
 
===Basic Configuration & Starting the Server===
The server files come with a selection of example serverconfigs that show off how to setup various maps and gamemodes. Consult the [[Server_Configuration|Server Configuration]] page to find out more about modifying the server config.
+
The dedicated server comes with an example server config that show off how to setup a basic game server. Consult the [[Server_Configuration|Server Configuration]] page to find out more about modifying server configs.
  
Duplicate one of the example configs using the following command:
+
Duplicate the example config using the following command:
  
 
<pre>
 
<pre>
$ cp serverconfig_server1_armybattlefield.txt serverconfig_server1_newserver.txt
+
$ cp serverconfig_default.txt serverconfig_myserver.txt
 
</pre>
 
</pre>
  
This will make sure that if you ever have to reapply the server files, the server config will not be overwritten. Open the new config file using your favorite ''vim, nano'' or ''emacs'' and configure the basic server settings:
+
'''It's strongly advised to duplicate the "serverconfig_default.txt" as a game update or validate might overwrite the file'''.  
 +
 
 +
Open the new config file using your favorite ''vim, nano'' or ''emacs'' and configure the basic server settings:
  
 
<pre>
 
<pre>
Line 175: Line 171:
 
Basic trivial variables:
 
Basic trivial variables:
 
<pre>
 
<pre>
server_name New Server - Army Battlefield
+
server_name My Server
server_welcome_message Welcome to my new game server!
+
server_region europe #
server_region europe
+
server_admin_password defaultAdminPWReplace
server_admin_password ChangeThisPassword
+
#server_password mypassword
#server_password ChangeThisPassword
 
 
</pre>
 
</pre>
  
Networking setup (loosely "low / high tick" settings):
+
Networking setup (loosely "server tick" settings):
 
<pre>
 
<pre>
 
# LowLatency = Reduced packet rate on close-range (high player count)
 
# LowLatency = Reduced packet rate on close-range (high player count)
 +
# Balanced = Balanced packet rate on close-range (medium-high player count)
 
# HighAccuracy = Increased packet rate on close-range (low player count)
 
# HighAccuracy = Increased packet rate on close-range (low player count)
network_broadcast_mode LowLatency
+
# Realtime = Increased packet rate on close-range (very low player count / competitive setting)
 +
network_broadcast_mode Balanced
 
</pre>
 
</pre>
  
Line 192: Line 189:
  
 
<pre>
 
<pre>
# Remove old screens
+
# Start holdfast server
rm /tmp/.X0-lock 2> /dev/null
+
"./Holdfast NaW" -startserver \
 
+
-batchmode \
# Create new screen
+
-nographics \
Xvfb :0 -screen 0 1024x768x16 &
+
-screen-width 640 \
 
+
-screen-height 480 \
# Start holdfast server on new display
+
-screen-quality "Fastest" \
DISPLAY=:0.0 WINEDEBUG=-all wine "Holdfast NaW.exe" \
+
-framerate "120" \
        -startserver \
+
--serverheadless \
        -batchmode \
+
-serverConfigFilePath "serverconfig_myserver.txt" \
        -screen-width 640 \
+
-logFile "logs_output/outputlog_server.txt" \
        -screen-height 480 \
+
-logArchivesDirectory "logs_archive/" \
        -screen-quality Fastest \
+
-p "20100"
        -framerate 120 \
 
        --serverheadless \
 
        --servercarbonplayers 0 \
 
        -serverConfigFilePath serverconfig_server1_newserver.txt \
 
        -logFile logs_output/outputlog_server.txt \
 
        -logArchivesDirectory logs_archive \
 
        -s [INSERTSERVERIP] \
 
        -p 20100 \
 
        -l "94.130.66.231" \
 
        -o 7101
 
 
</pre>
 
</pre>
 
Note:
 
:"94.130.66.231" - is the holdfast lobby server IP (masterserver).
 

Revision as of 11:21, 27 October 2020

The following documentation details how to host a public or private gameserver for Holdfast: Nations At War. The game only offers a dedicated server for Linux, however you can still host a Windows gameserver using a full copy of the game.

Windows

Obtaining the game files

Downloading using Steam Client

Holdfast game files folder structure

Obtaining the game files can be done via the regular Steam Client. Download the game and copy the files to another folder. It's not recommended to use the SteamApps location as a base for the gameserver, as this might lead to file corruption if a game update overwrites files whilst the server is running.

This is the default directory where the Holdfast: Nations At War game files are located:

C:\Steam\steamapps\common\Holdfast Nations At War

Copy the files to the following location:

C:\holdfastserver

Downloading using SteamCMD

The Steam Console Client or SteamCMD is a command-line version of the Steam client. Its primary use is to install and update various dedicated servers available on Steam using a command-line interface. It works with games that use the SteamPipe content system. All games have been migrated from the deprecated HLDSUpdateTool to SteamCMD. This is usually required if you are forced to use a terminal for your server setup. You can find instructions on how to download SteamCMD here: https://developer.valvesoftware.com/wiki/SteamCMD#Windows

The files can then be obtain using the following batch command:

$ steamcmd +login [LOGINNAME] [PASSWORD] +force_install_dir "C:\holdfastserver" +app_update 589290 +quit

Notes:

+anonymous will fail because the account requires to own a copy of the game to download the game files!
You might need to enter a 2-Factor Auth Code during this step.
In case the server ever stops working you can run the command with +app_update 589290 validate to verify the game files.

Obtaining the server files

Download the server files from the link below and extract them over to the ‘C:\holdfastserver’ folder on your server box.

From Dropbox

You can also download the folder from Baidu. This is especially useful for server hosts located in China were access to Dropbox might be blocked.This might not always be up to date with the latest version.

From Baidu

Note: These files change from time to time but not necessarily every update, only reapply them if the server stops working after an update.

Basic Configuration & Starting the Server

Holdfast merged server & game files folder structure

The server files come with a selection of example serverconfigs that show off how to setup various maps and gamemodes. Consult the Server Configuration page to find out more about modifying the server config.

Duplicate one of the example configs and one of the server .bats, for example:

serverconfig_server1_armybattlefield.txt -> serverconfig_server1_newserver.txt
start_server1_armybattlefield_headless.bat -> start_server1_newserver_headless.bat

This will make sure that if you ever have to reapply the server files, the server config will not be overwritten. Open the new config file using your favorite Notepad or Notepad++ and configure the basic server settings:

### Server & Steam Ports (All 3 ports must be unique per server instance).
server_port 20100
steam_communications_port 8700
steam_query_port 27000

Notes:

Make sure to open the appropriate firewall ports both for TCP and UDP!
Holdfast gameservers respond, when correctly configured, to A2S Queries on the steam_query_port. Returning map, player count and player information when requested.

Basic trivial variables:

server_name New Server - Army Battlefield
server_welcome_message Welcome to my new game server!
server_region europe
server_admin_password ChangeThisPassword
#server_password ChangeThisPassword

Networking setup (loosely "low / high tick" settings):

# LowLatency = Reduced packet rate on close-range (high player count)
# HighAccuracy = Increased packet rate on close-range (low player count)
network_broadcast_mode LowLatency

Edit the start_server1_newserver_headless.bat to mount your newly created config:

start "New Server" /affinity 3 "vapuriloadtester.exe" -s --serverConfigFilePath "serverconfig_server1_newserver.txt" --outputLog "logs_output\outputlog_server1_newserver.txt" --adminCommandLogFilePath "logs_adminactions\adminactions_server1_newserver.txt" --logArchivesDirectory "logs_archive" --framerate 120 --serverheadless

You can now launch gameserver by starting the start_server1_newserver_headless.bat.

Linux

Docker

If your server is running Docker, you can simply use:

docker run -d --net=host --name=holdfastnaw-dedicated cm2network/holdfastnaw

The container will automatically update the game on startup, so if there is a game update just restart the container.

The config is located here: /home/steam/holdfastnaw-dedicated/

If you want to launch another instance you can increment the environment variables, using -e (--env):

docker run -d --net=host -e SERVER_PORT=20100 -e STEAM_COM_PORT=8700 -e STEAM_QUERY_PORT=27000 --name=holdfastnaw-dedicated cm2network/holdfastnaw

You can find the associated Docker Hub page here: https://hub.docker.com/r/cm2network/holdfastnaw/

Manual Setup

As there is no dedicated server and no Linux build, setting up a Holdfast: Nations At War game server requires the usage of Wine or some other sort of library-level virtualization. This will always incur performance looses, so it's not recommended to use Wine to host large player servers (> 60 players). One can observe such behaviour if players start continuously sliding and jittering on the server, this can't be observed on non-virtualized game servers

Download Requirements

Ubuntu & Debian

Make sure no previous version of Wine has been installed, if it has, uninstall it completely and don't forget to run apt-get autoremove to clean up the remaining files. This command will install all required packages and Wine for you:

$ apt-get update \
	&& apt-get install -y \
		libsqlite3-0 \
		wget \
		ca-certificates

If you want to perform a cleanup run the following command (recommended if run inside of container):

$ apt-get clean autoclean \
	&& apt-get autoremove -y \
	&& rm -rf /var/lib/apt/lists/*

Obtaining the game files

Downloading using SteamCMD

The Steam Console Client or SteamCMD is a command-line version of the Steam client. Its primary use is to install and update various dedicated servers available on Steam using a command-line interface. It works with games that use the SteamPipe content system. All games have been migrated from the deprecated HLDSUpdateTool to SteamCMD. This is usually required if you are forced to use a terminal for your server setup. You can find instructions on how to download SteamCMD here: https://developer.valvesoftware.com/wiki/SteamCMD#Linux

The dedicated server can then be obtain using the following bash command:

$ steamcmd.sh \
        +login anonymous \
        +force_install_dir /opt/holdfastserver \
        +app_update 1424230 +quit

Notes:

In case the server ever stops working you can run the command with +app_update 1424230 validate to verify the game files.


Basic Configuration & Starting the Server

The dedicated server comes with an example server config that show off how to setup a basic game server. Consult the Server Configuration page to find out more about modifying server configs.

Duplicate the example config using the following command:

$ cp serverconfig_default.txt serverconfig_myserver.txt

It's strongly advised to duplicate the "serverconfig_default.txt" as a game update or validate might overwrite the file.

Open the new config file using your favorite vim, nano or emacs and configure the basic server settings:

### Server & Steam Ports (All 3 ports must be unique per server instance).
server_port 20100
steam_communications_port 8700
steam_query_port 27000

Notes:

Make sure to open the appropriate firewall ports both for TCP and UDP!
Holdfast gameservers respond, when correctly configured, to A2S Queries on the steam_query_port. Returning map, player count and player information when requested.

Basic trivial variables:

server_name My Server
server_region europe #
server_admin_password defaultAdminPWReplace
#server_password mypassword

Networking setup (loosely "server tick" settings):

# LowLatency = Reduced packet rate on close-range (high player count)
# Balanced = Balanced packet rate on close-range (medium-high player count)
# HighAccuracy = Increased packet rate on close-range (low player count)
# Realtime = Increased packet rate on close-range (very low player count / competitive setting)
network_broadcast_mode Balanced

You can then start the server using the following commands:

# Start holdfast server
"./Holdfast NaW" -startserver \
		-batchmode \
		-nographics \
		-screen-width 640 \
		-screen-height 480 \
		-screen-quality "Fastest" \
		-framerate "120" \
		--serverheadless \
		-serverConfigFilePath "serverconfig_myserver.txt" \
		-logFile "logs_output/outputlog_server.txt" \
		-logArchivesDirectory "logs_archive/" \
		-p "20100"