Difference between revisions of "Server Hosting"

From Holdfast: Nations At War
Jump to navigation Jump to search
(→‎Download using SteamCMD: Adds support information for A2S queries.)
Line 1: Line 1:
 +
{{DISPLAYTITLE:Server Hosting}}
 +
{{ContentTemplateModernInline
 +
| welcome            = [[File:Forum Logo.png|link=|left|alt=Server Hosting]]
 +
| blurb              = How to host a public or private Holdfast server on Windows or Linux (Steam client, SteamCMD, Docker)
 +
| sections_title    = On this page
 +
| sections_content  =
 +
* [[#Quick Start Guide|Quick Start Guide]]
 +
* [[#Windows|Windows]]
 +
** [[#Obtaining the game files|Obtaining the game files]]
 +
*** [[#Download using Steam Client|Download using Steam Client]]
 +
*** [[#Download using SteamCMD|Download using SteamCMD]]
 +
** [[#Basic Configuration & Starting the Server|Basic Configuration & Starting the Server]]
 +
* [[#Linux|Linux]]
 +
** [[#Docker|Docker]]
 +
** [[#Manual Setup|Manual Setup]]
 +
*** [[#Downloading using SteamCMD|Downloading using SteamCMD]]
 +
*** [[#Basic Configuration & Starting the Server (Linux)|Basic Configuration & Starting the Server (Linux)]]
 +
 +
| featured_title    = Server Hosting
 +
| featured_content  =
 +
 
The following documentation details how to host a public or private game server for [[Holdfast: Nations At War]]. The game offers an anonymous dedicated server for both Linux and Windows.
 
The following documentation details how to host a public or private game server for [[Holdfast: Nations At War]]. The game offers an anonymous dedicated server for both Linux and Windows.
  
Line 4: Line 25:
 
Quick start guide for local testing:
 
Quick start guide for local testing:
  
# Download <code>Holdfast: Nations At War - Dedicated Server</code> from Steam (<code>Tools</code> Section)
+
# Download <code>Holdfast: Nations At War - Dedicated Server</code> from Steam (<code>Tools</code> section).
 
# Change the map rotation file (<code>serverconfig_default.txt</code>) and add mods or change maps.
 
# Change the map rotation file (<code>serverconfig_default.txt</code>) and add mods or change maps.
# Launch the server using the <code>LaunchServer.ps1</code> (Windows) or <code>LaunchServer.sh</code> (Linux) file
+
# Launch the server using <code>LaunchServer.ps1</code> (Windows) or <code>LaunchServer.sh</code> (Linux).
 
 
* In Holdfast's server browser click on "Join Custom Server", then click on the top "Connect" (leave localhost and change the port if required).
 
* If you want other players to be able to connect, you likely have to setup port forwarding on your router and open the ports in your local firewall.
 
'''Warning: Game updates will overwrite the changes to the <code>LaunchServer</code> script and <code>serverconfig_default.txt</code>. If you want to prevent this, create copies of both files and change the arguments of your custom <code>LaunchServer</code> script to point to your <code>serverconfig</code> file.'''
 
  
==Windows==
+
* In Holdfast’s server browser click **Join Custom Server**, then click the top **Connect** (leave localhost; change the port if required).
===Obtaining the game files===
+
* If you want other players to connect, you’ll likely need to set up port forwarding on your router and open the ports in your local firewall.
====Download using Steam Client====
 
The easiest way to get access to server files would be to download though Steam, using the <code>Holdfast: Nations at War - Dedicated Server</code> app that will be in your Steam library.
 
  
To get started, navigate to your Steam library in the Steam Client.
+
'''Warning: Game updates will overwrite the changes to the <code>LaunchServer</code> script and <code>serverconfig_default.txt</code>. To prevent this, create copies of both files and change the arguments of your custom <code>LaunchServer</code> script to point to your custom <code>serverconfig</code> file.'''
  
Select either Tools in the drop down list, or simply search <code>holdfast</code> into the search box (you might need to Tick "Tools" at the top of the list for the dedicated server to become visible), and you will be presented with three options.
+
== Windows ==
 +
=== Obtaining the game files ===
 +
==== Download using Steam Client ====
 +
The easiest way is through Steam using the <code>Holdfast: Nations At War - Dedicated Server</code> app in your library.
  
Download the application named <code>Holdfast: Nations at War - Dedicated Server</code>
+
1. Open your Steam Library.
 +
2. Choose **Tools** in the library filter (or search for <code>holdfast</code> and tick **Tools**).
 +
3. Install **Holdfast: Nations At War - Dedicated Server**.
 +
4. After install, right-click the app → **Manage** → **Browse local files**.
  
Once downloading is complete, right click on the list in Steam > Manage > Browse local files.
+
{|style="margin:0 auto;"
{|style="margin: 0 auto;"
+
| [[File:ServerSteamLocation.png|thumb|Steam application to download]]
| [[File:ServerSteamLocation.png|thumb|Steam Application you need to download]]
+
| [[File:ServerBrowseLocalFiles.png|thumb|Browse local files in Steam]]
| [[File:ServerBrowseLocalFiles.png|thumb|Browse local files on Steam client]]
 
 
|}
 
|}
  
====Download using SteamCMD====
+
==== Download using SteamCMD ====
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#Windows
+
The '''Steam Console Client''' or [https://developer.valvesoftware.com/wiki/SteamCMD SteamCMD] is a command-line Steam client used to install/update dedicated servers.
  
The files can then be obtain using the following batch command:
+
Download and set up SteamCMD (see Valve’s guide). Then run:
 
<pre>
 
<pre>
$ steamcmd +login [LOGINNAME] [PASSWORD] +force_install_dir "C:\holdfastserver" +app_update 589290 +quit
+
steamcmd +login [LOGINNAME] [PASSWORD] +force_install_dir "C:\holdfastserver" +app_update 589290 +quit
 
</pre>
 
</pre>
  
 
Notes:
 
Notes:
: ''+anonymous'' will fail because the account requires to own a copy of the game to download the game files!
+
: ''+anonymous'' will fail here; the account must own the game to download these files.
: You might need to enter a ''2-Factor Auth Code'' during this step.
+
: You may be prompted for a two-factor code.
: In case the server ever  stops working you can run the command with ''+app_update 589290 validate'' to verify the game files.
+
: If the server stops working, run with ''+app_update 589290 validate'' to verify files.
  
===Basic Configuration & Starting the Server===
+
=== Basic Configuration & Starting the Server ===
 
[[File:FolderStructure.jpg|thumb|Holdfast merged server & game files folder structure]]
 
[[File:FolderStructure.jpg|thumb|Holdfast merged server & game files folder structure]]
  
The server files come with a selection of example server configs that show off how to setup various maps and game modes. Consult the [[Server_Configuration|Server Configuration]] page to find out more about modifying the server config.
+
The server files include example configs. See [[Server_Configuration|Server Configuration]] for all options.
 
 
Duplicate the example config <code>serverconfig_server_default.txt</code> and the launch script <code>LaunchServer.ps1</code>
 
  
 +
Duplicate the defaults:
 
<pre>
 
<pre>
 
serverconfig_default.txt -> serverconfig_newserver.txt
 
serverconfig_default.txt -> serverconfig_newserver.txt
LaunchServer.ps1 -> LaunchServer_newserver.ps1
+
LaunchServer.ps1         -> LaunchServer_newserver.ps1
 
</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 ''Notepad'' or ''Notepad++'' and configure the basic server settings:
+
Edit the new config:
 
 
 
<pre>
 
<pre>
 
### Server & Steam Ports (Both ports must be unique per server instance).
 
### Server & Steam Ports (Both ports must be unique per server instance).
Line 63: Line 81:
  
 
'''Notes:'''
 
'''Notes:'''
:Make sure to open the appropriate firewall ports for UDP!
+
: Open the corresponding UDP ports in your firewall.
:Holdfast game servers respond, when correctly configured, to [https://developer.valvesoftware.com/wiki/Server_queries A2S Queries] on the ''steam_query_port''. Returning map, player count and player information when requested.
+
: Properly configured servers respond to [https://developer.valvesoftware.com/wiki/Server_queries A2S queries] on ''steam_query_port'' (map, player count, etc.). Official servers do not respond to A2S; community servers do.
:Official Holdfast game servers are not configured to respond to A2S Queries. This feature is only supported by community game servers.
 
  
Basic trivial variables:
+
Basic variables:
 
<pre>
 
<pre>
 
server_name My Server
 
server_name My Server
Line 75: Line 92:
 
</pre>
 
</pre>
  
Edit the <code>LaunchServer_newserver.ps1</code> to use your newly created config:
+
Update the launch script to use your config:
 
<pre>
 
<pre>
 +
# LaunchServer_newserver.ps1
 
$args = '-s -r --serverConfigFilePath "serverconfig_newserver.txt" --outputLog "logs_output\outputlog_newserver.txt" --logArchivesDirectory "logs_archive" --framerate 120 --serverheadless --adminCommandLogFilePath "logs_adminactions\adminlog_newserver.txt" --chatLogFilePath "logs_chat\chatlog_newserver.txt" --playersLogFilePath "logs_playerlogin\playerlogin_newserver.txt" --scoreboardLogFilePath "logs_score\scorelog_newserver.txt"'
 
$args = '-s -r --serverConfigFilePath "serverconfig_newserver.txt" --outputLog "logs_output\outputlog_newserver.txt" --logArchivesDirectory "logs_archive" --framerate 120 --serverheadless --adminCommandLogFilePath "logs_adminactions\adminlog_newserver.txt" --chatLogFilePath "logs_chat\chatlog_newserver.txt" --playersLogFilePath "logs_playerlogin\playerlogin_newserver.txt" --scoreboardLogFilePath "logs_score\scorelog_newserver.txt"'
 
 
Start-Process -FilePath "vapuriloadtester.exe" -Verb RunAs -ArgumentList $args
 
Start-Process -FilePath "vapuriloadtester.exe" -Verb RunAs -ArgumentList $args
 
</pre>
 
</pre>
  
You can now launch gameserver by starting the <code>LaunchServer_newserver.ps1</code>.
+
Run <code>LaunchServer_newserver.ps1</code> to start the server.
  
==Linux==
+
== Linux ==
===Docker===
+
=== Docker ===
If your server is running [https://www.docker.com/ Docker], you can simply use:
+
If you use [https://www.docker.com/ Docker]:
 
<pre>
 
<pre>
 
docker run -d --net=host --name=holdfastnaw-dedicated cm2network/holdfastnaw
 
docker run -d --net=host --name=holdfastnaw-dedicated cm2network/holdfastnaw
 
</pre>
 
</pre>
  
The container will automatically update the game on startup, so if there is a game update just restart the container.  
+
The container auto-updates on start—restart it after a game update.
  
The config is located here: ''/home/steam/holdfastnaw-dedicated/''
+
Config path: <code>/home/steam/holdfastnaw-dedicated/</code>
  
If you want to launch another instance you can increment the environment variables, using -e (--env):
+
Another instance (adjust ports):
 
<pre>
 
<pre>
 
docker run -d --net=host -e SERVER_PORT=20100 -e STEAM_QUERY_PORT=27000 --name=holdfastnaw-dedicated cm2network/holdfastnaw
 
docker run -d --net=host -e SERVER_PORT=20100 -e STEAM_QUERY_PORT=27000 --name=holdfastnaw-dedicated cm2network/holdfastnaw
 
</pre>
 
</pre>
  
You can find the associated Docker Hub page here:
+
Docker Hub:
 
[https://hub.docker.com/r/cm2network/holdfastnaw/ https://hub.docker.com/r/cm2network/holdfastnaw/]
 
[https://hub.docker.com/r/cm2network/holdfastnaw/ https://hub.docker.com/r/cm2network/holdfastnaw/]
  
===Manual Setup===
+
=== Manual Setup ===
 
+
==== Downloading using SteamCMD ====
===Obtaining the game files===
+
Install [https://developer.valvesoftware.com/wiki/SteamCMD SteamCMD], then:
====Downloading using SteamCMD====
 
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 dedicated server can then be obtain using the following bash command:
 
 
<pre>
 
<pre>
$ steamcmd.sh \
+
steamcmd.sh +login anonymous +force_install_dir /opt/holdfastserver +app_update 1424230 +quit
        +login anonymous \
 
        +force_install_dir /opt/holdfastserver \
 
        +app_update 1424230 +quit
 
 
</pre>
 
</pre>
  
 
Notes:
 
Notes:
: In case the server ever stops working you can run the command with ''+app_update 1424230 validate'' to verify the game files.
+
: To verify files later: ''+app_update 1424230 validate''.
 
 
===Basic Configuration & Starting the Server===
 
The dedicated server comes with an example server config that shows off how to setup a basic game server. Consult the [[Server_Configuration|Server Configuration]] page to find out more about modifying server configs.
 
 
 
Duplicate the example config using the following command:
 
  
 +
==== Basic Configuration & Starting the Server (Linux) ====
 +
Duplicate the default config:
 
<pre>
 
<pre>
$ cd /opt/holdfastserver
+
cd /opt/holdfastserver
$ cp serverconfig_default.txt serverconfig_myserver.txt
+
cp serverconfig_default.txt serverconfig_myserver.txt
 
</pre>
 
</pre>
  
'''It's strongly advised to duplicate the "serverconfig_default.txt" as a game update or validate might overwrite the file'''.
+
Configure ports:
 
 
Open the new config file using your favorite ''vim, nano'' or ''emacs'' and configure the basic server settings:
 
 
 
 
<pre>
 
<pre>
 
### Server & Steam Ports (Both ports must be unique per server instance).
 
### Server & Steam Ports (Both ports must be unique per server instance).
Line 141: Line 145:
  
 
Notes:
 
Notes:
:Make sure to open the appropriate firewall ports for UDP!
+
: Open the UDP ports in your firewall.
:Holdfast gameservers respond, when correctly configured, to [https://developer.valvesoftware.com/wiki/Server_queries A2S Queries] on the ''steam_query_port''. Returning map, player count and player information when requested.
+
: Properly configured servers respond to A2S on ''steam_query_port''.
  
Basic trivial variables:
+
Basic variables:
 
<pre>
 
<pre>
 
server_name My Server
 
server_name My Server
Line 152: Line 156:
 
</pre>
 
</pre>
  
You can then start the server using the following commands:<pre>
+
Start the server:
# Start holdfast server
+
<pre>
 
"./Holdfast NaW" -startserver \
 
"./Holdfast NaW" -startserver \
-batchmode \
+
  -batchmode \
-nographics \
+
  -nographics \
-screen-width 640 \
+
  -screen-width 640 \
-screen-height 480 \
+
  -screen-height 480 \
-screen-quality "Fastest" \
+
  -screen-quality "Fastest" \
-framerate "120" \
+
  -framerate "120" \
--serverheadless \
+
  --serverheadless \
-serverConfigFilePath "serverconfig_myserver.txt" \
+
  -serverConfigFilePath "serverconfig_myserver.txt" \
-logFile "logs_output/outputlog_server.txt" \
+
  -logFile "logs_output/outputlog_server.txt" \
-logArchivesDirectory "logs_archive/" \
+
  -logArchivesDirectory "logs_archive/" \
-p "20100"
+
  -p "20100"
 
</pre>
 
</pre>
 +
 +
| image_content      =
 +
| layout            = auto
 +
| left_width        = 320px
 +
| aside_width        = 320px
 +
| gap                = 0.5rem
 +
| show_toc          = no
 +
| show_section_edit  = yes
 +
}}

Revision as of 08:45, 19 September 2025


Server Hosting

How to host a public or private Holdfast server on Windows or Linux (Steam client, SteamCMD, Docker)

Navigation menu