Server Hosting: Difference between revisions
m (link to ansible deployment) |
m (document locations of all configuration files) |
||
Line 71: | Line 71: | ||
== Configuration == | == Configuration == | ||
Configuration is split across several locations: | |||
* <code>autoconfig.ini</code> - basic settings like server name, password, player limit, bot count, lobby mode. | |||
* <code>Rules/</code> - each JSON file defines a game mode (eg CTF, DM, etc). In these files match duration, score limit, teams, default weapon selection, medkits, etcpp are defined. | |||
* <code>Levels/Custom</code> - contains custom maps. Get some maps from [[https://tms2.jrgp.org/ TMS2]] See also the [[Mapping | Mapping Guide]] | |||
* <code>Modifiers</code> - contains modifiers that customize some parameters of the game (and can be voted for by players in the lobby for each match). See [[Custom Modifiers]] for details. | |||
* <code>Scripts/</code> - C# scripts that define custom behaviour. See [[:Category:Scripting]] | |||
* <code>Cycles/</code> - map rotations (for when lobby is disabled) | |||
=== <code>autoconfig.ini</code> === | |||
_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. | _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. | ||
Line 86: | Line 96: | ||
Also, fill greet.txt with your own content - it is displayed at the beginning of each match | Also, fill greet.txt with your own content - it is displayed at the beginning of each match | ||
=== Manage bots === | ==== Manage bots ==== | ||
* FillBotsCount - the amount of bots added to an empty server. they will be replaced by human players. | * FillBotsCount - the amount of bots added to an empty server. they will be replaced by human players. | ||
* FillBotsDifficulty - 0 is stupid, 3 is butcher | * FillBotsDifficulty - 0 is stupid, 3 is butcher | ||
=== Set up admin commands === | ==== 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>) | * 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. | * RconPassword - if set, more than one player can send admin commands. | ||
=== Play pre-selected maps & game modes only === | ==== Play pre-selected maps & game modes only ==== | ||
* UseLobby = False | * UseLobby = False |
Revision as of 10:35, 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
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
Configuration is split across several locations:
autoconfig.ini
- basic settings like server name, password, player limit, bot count, lobby mode.Rules/
- each JSON file defines a game mode (eg CTF, DM, etc). In these files match duration, score limit, teams, default weapon selection, medkits, etcpp are defined.Levels/Custom
- contains custom maps. Get some maps from [TMS2] See also the Mapping GuideModifiers
- contains modifiers that customize some parameters of the game (and can be voted for by players in the lobby for each match). See Custom Modifiers for details.Scripts/
- C# scripts that define custom behaviour. See Category:ScriptingCycles/
- map rotations (for when lobby is disabled)
autoconfig.ini
_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
Also, fill greet.txt with your own content - it is displayed at the beginning of each match
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
1 YOUR_NAME joined the server [YOUR_PLAYFAB_ID]
) - 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:
nano Cycles/Custom/selected-maps.json
[{ "Rules": "Deathmatch", "Level": "dm_epitaph" }]
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
, thenrcon 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]