Server Hosting: Difference between revisions

From Soldat2 Wiki
Jump to navigation Jump to search
mNo edit summary
m (simplify configuration section, refer to new page 'Server Configuration)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Dedicated Server]]
A dedicated server can be hosted on linux x86_64 systems - not on windows currently (running on WSL appears to be working [citation needed]).
A dedicated server can be hosted on linux x86_64 systems - not on windows currently (running on WSL appears to be working [citation needed]).


Line 16: Line 18:


The following guide was originally written by Maz on [https://steamcommunity.com/sharedfiles/filedetails/?id=2793260281 steam] for a Ubuntu 20.04 system.
The following guide was originally written by Maz on [https://steamcommunity.com/sharedfiles/filedetails/?id=2793260281 steam] for a Ubuntu 20.04 system.
If you are familiar with Ansible, the easiest setup could be to use [https://codeberg.org/norwin/soldat2-ansible this playbook] instead.


=== Preamble ===
=== Preamble ===
Line 56: Line 60:


=== Init.d ===
=== Init.d ===
TODO


=== Multiple Servers on the same machine ===
=== Multiple Servers on the same machine ===
Line 81: Line 87:
* Name - sets the server name
* Name - sets the server name
* MaxPlayers - set the maximum of players on the server
* MaxPlayers - set the maximum of players on the server
* VisibleInGamesList - set to false, if you host in LAN only, to not confuse external players with your server in the server listing


Also, fill greet.txt with your own content - it is displayed at the beginning of each match
For more details regarding configuration see [[Server Configuration]].
 
=== Manage bots ===
 
* FillBotsCount - the amount of bots added to an empty server. they will be replaced by human players.
* FillBotsDifficulty - 0 is stupid, 3 is butcher
 
=== Set up admin commands ===
 
* AdminPlayfabID - your Playfab ID to be admin automatically (To find your Playfab ID, start the server and join with your client. Your Playfab ID will show up in the server logs as <code>1 YOUR_NAME joined the server [YOUR_PLAYFAB_ID]</code>)
* RconPassword - if set, more than one player can send admin commands.
 
=== Play pre-selected maps & game modes only ===
 
* UseLobby = False
* AllowVoting = False
* GamesCycleFile = Cycles/Custom/selected-maps.json
 
Having this, list the maps you want in your game cycle:
<pre>
nano Cycles/Custom/selected-maps.json
</pre>
<pre>
[{
  "Rules": "Deathmatch",
  "Level": "dm_epitaph"
}]
</pre>


== Usage ==
== Usage ==

Latest revision as of 10:57, 10 June 2023


A dedicated server can be hosted on linux x86_64 systems - not on windows currently (running on WSL appears to be working [citation needed]).

The most recent version can be downloaded from soldat2.com/downloads.

System requirements

For up to 8 players the following resources are enough:

  • some Linux distro with glibc
  • 1 vCPU (x86_64)
  • 512MB RAM

With more players, occasional lags start happening, you should provide more CPU in that case.

Setup

The following guide was originally written by Maz on steam for a Ubuntu 20.04 system.

If you are familiar with Ansible, the easiest setup could be to use this playbook instead.

Preamble

For this guide, understanding of the Linux-based operating system you're using, specifically the command line, is highly advised. This is not a noob-friendly guide, one may or may not be created by the community. This is a simplified, barebones guide to serve as a guideline for Soldat 2 server hosting. If you run into any major issues or errors, related to for example a specific OS or library support, please post below so it can be looked at. If you need personal (real-time) assistance, you're better off joining the official Discord instead of asking around in the #help channel: https://discord.gg/T8ejr5u

Port forwarding

The default port for Soldat 2 is 33073. If you are running the server behind a firewall (e.g. a server at home, rather than an external dedicated server or VPS) make sure to port-forward this port for TCP & UDP. If you wish to use another port, you set this in the config later in the guide.

Installing the server

You should create a new user for Soldat 2 and NOT run the following commands as root. If you're root, this might work:

useradd soldat2
sudo -i soldat2

You can run a server on the release version or on the beta version. Choose one of the packages below.

wget https://dl.thd.vg/soldat2-linuxserver-release.tar.gz
wget https://dl.thd.vg/soldat2-linuxserver-test.tar.gz

The following commands assume you've downloaded the release version. If you downloaded the test version, change the file naming accordingly.

Decompress the package:

tar -zxf soldat2-linuxserver-release.tar.gz

Navigate to the server folder, and run the server once to generate the configuration file autoconfig.ini:

cd soldat2-linuxserver-release
./soldat2

Once the server has started, you may stop the server again (CTRL+C), so you should modify the newly-generated config file (see blow).

Init.d

TODO

Multiple Servers on the same machine

You can technically start multiple servers, each with their own configuraion

Common issues

SSL errors

sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

Configuration

_Note_: only ever write changes to autoconfig.ini after the server has stopped - your changes will be lost as the file is rewritten when the server stops.

Open the config file with your preferred text editor:

nano autoconfig.ini

Most relevant options are fairly self-explanatory. You should *change at least the following options*:

  • Name - sets the server name
  • MaxPlayers - set the maximum of players on the server
  • VisibleInGamesList - set to false, if you host in LAN only, to not confuse external players with your server in the server listing

For more details regarding configuration see Server Configuration.

Usage

See also Command Line Arguments.

Admin Commands

To wield admin power on your server:

  • Set up admin access in configuration (see above)
  • Join the server
  • Open the console by pressing Alt+~. There you can enter commands (use Tab to see available commands. syntax is not case sensitive).
  • Gain admin rights: If you entered a AdminPlayfabID in autoconfig.ini, you should have a red [Admin] tag on the scoreboard. Other players can also gain admin privileges by running the command rcon [password] in the console.
  • To apply a command to the server, prefix them with rcon. Apparently, the commands are not case sensitive.

Available commands

copied from faq.txt in the 0.8.60 server tarball:

        Vote
        Info
        AddBot
        RemBot
        Restart
        NextMap
        LoadMap [mapname] [gamemode]
        AddModifier [modifier] (Restart or LoadMap to apply)
        RemoveModifier [modifier]
        Ban [id] - bans for a couple days
        Kick [id]
        Kick [id] "reason" (use parenthesis eg. kick 13 "for being mean")
        KickAll
        KickAll "reason"
        SetTeam [id] [team] (will disable autobalance for the duration of the match)
        ListPlayers
        ListMaps
        Say [optional-id] "" (use parenthesis eg. say "hello world")
        LoadCycle [Cycles/filename.json]
        Rcon [command]
        Rcon [password] (first, if not admin)
        Reload (recompiles scripts)
        Info (useful info)
        Vote (starts map vote)
        RestartServer (reloads the map cycle and restarts)
        Version (prints game version)

        Set [variable] [value] 
                - use proper casing
                - works for config vars (autoconfig.json) eg. "Set ServerPassword bla"
                - rules components (eg. Rules/CaptureTheFlag.json) eg. "Set Match.MinimumPlayers 4"
                - client settings (client.json) eg. "Set GameSettings.SoundsVolume 0.75"
        Get [variable]

Examples

  • dynamically change the amount of bots on the server to 5 - numPlayers: rcon set fillbotscount 5
  • restart the match with a modifier added: rcon addmodifier Amputation, then rcon restart
  • kick all players with a reason: rcon kickall "restarting the server to fix disconnect issues. will be back in a minute"
  • manually balance teams: rcon listplayers, rcon setteam [playerid] [0|1]