Dedicated Servers

From The KillerJim Mod Wiki

Linux - Dedicated Server Hosting

If you are interested in hosting a dedicated server you must contact an @moderator, @admin or @dedicatedServerAdmins role on discord to gain access to the server binaries. We may push this onto stream at a later date, but for now you need to go through this process.

We support Linux dedicated servers; if you require a windows server build please contact us on Discord.

SteamCMD

The Linux dedicated server has been tested on Ubuntu 18.04, but should work on 16.04 and 20.04.

You should have steamcmd installed and logged in anonymously; please see this external guide - [Linux Guide]

The login process should result in the following display (Note: The client may pull several updates prior to allowing you to login).

   steamcmd
   login anonymous

SteamCmdLogin.png

It is recommended you provide a directory for your installation, in this case I'm using the folder "Modiverse_1" under the local users' home directory. For multiple server installations please select a new directory, given that each server will have it's own unique set of configuration and log files.

  force_install_dir /home/james/Modiverse_1

ForiceDir.png

Next we must install the Linux dedicated server; this has a unique steam app ID for it of 1549820;

   app_update 1549820 validate

Installation.png

After this has completed the Linux server will be installed, but not configured in /home/james/Modiverse_1. The installation structure should look as follows (or very similar):

InstallationDir.png

Finally, but very importantly you need to create a symbolic link so Modiverse can find the steamclient.so; you should replace the "/home/james/" with the correct directory for your installation:

   mkdir -p /home/james/.steam/sdk64; cp /home/james/.steam/steamcmd/linux64/steamclient.so /home/james/.steam/sdk64
Ports

Modiverse requires two ports per server instance, a "port" and "queryport". Whilst these options are specified in the command line options (see below) we recommend for "port" you use 7777+ and for "queryport" 27015+ - you must forward on both TCP and UDP to these ports.

You should also make sure any Linux firewall is letting these packets through.

Configuration

The configuration options are divided into two parts; the command-line and JSON configuration files. The command-line options provide most of the configuration that should be done prior to the server starting; whilst the JSON provides the run-time operation of the server.

Please note; Modiverse was historically called KJMod and therefore executables and options are named so.

Command Line Options

The command line options are detailed below; a normal command line would look like this:

   ./KJModServer.sh -log -port=7778 -queryport=27016 -SteamServerName="Modiverse Ireland #1 (Sandbox)" -KJModBaseUGCFolder=/home/james/Documents/ServerData1 -DoNotRestartOnEmpty -InitUGCs -maxplayers=32

Note: this assumes you are in the "/home/james/Modiverse_1" directory already.

-log

This options results in Modiverse writing logs to the InstallDir/KJMod/Saved/Logs/ usually under the name "KJMod.log" - this is open useful to see what is wrong with the configuration, or in particular is a certain mod is causing problems.

Warning - If a mod has some bug, which more often than not does not affect the operation of the server, the resulting data files can get very large as the log message is repeated.

-port and -queryport

These are the same ports that you can confirmed to flow from your firewall; these ports need to be open and both TCP and UDP forwarded.

-SteamServerName

This is the server name as shown to players in the various server browsing windows; it has a limited of 32 characters.

-KJModBaseUGCFolder

All 'mods' that the server requires (as supplied in the map cycling section of the configuration.json file) need to be stored at a location on the server. This option provides that directory and will be updated/synced by the server upon starting (we plan to do further validation checks for when content updates every time the server changes map, but for now a manual restart is required to pick up changes).

You can point multiple server's to the same directory but in general we advice keeping each server in a separate directory to avoid any issues.

-DoNotRestartOnEmpty

A server configured with this option will close automatically if not players exist on the server for 60 seconds. This option can be used for sandbox server's to effectively clear out the server of any user created content when the last player leaves; otherwise over the course of many days or weeks the server can exceed the (TODO) max spawned item limits.

-InitUGCs

This options should be specified for your server; it prompts it to, on starting, validate and download any missing UGC (workshop user generated content) into the -KJModBaseUGCFolder via the steam workshop. If you can guarantee that the server will always have valid content on the UGC folder you can remove this option; but it's unlikely given mod's often change (unless you have full control of the mod)


-maxplayers

This option defines how many players slots the server should advertise, this should be between 2 and 128.

ServerConfiguration.json

The run-time configuration is supplied as a JSON file contained in the path:

   /InstallDir/KJMod/Binaries/Linux/ServerData

Note : You will have to create the ServerData folder, it won't exist as part of the initial installation. When created the file and folder should look as follows (given our installation directory of '/home/james/Modiverse_1')

ServerConfigPath.png

A new file called "ServerConfiguration.json" should be created, the following default JSON can be used:

   {
       "version": 1,
       "pin": "0000",
       "motdURL": "http://modiverse.io/killerjim_motd.html",
       "motdDelay": 5,
       "rconPassword" : "admin",
       "mapCycle": 
       [
               {"gameMode":"2258403789","comment":"Der Riese (CODz), N/A - Game-mode includes map, ","map":"","assets":["2229481041"],"duration":1800},
               {"gameMode":"0","comment":"Sandbox, The Forest, Zombie NPC Pack","map":"2306144554","assets":["2369133675","2367962587","2229481041","2115764043","2134504480","2342034582","2336045922","2349758790","2223124581","2281370083","2353033793"],"duration":1800},
               {"gameMode":"2249813701","comment":"EvilGuys Gamemode, The Hill - Evil Guys, ","map":"2245595586","assets":[],"duration":1800},
               {"gameMode":"2249813701","comment":"EvilGuys Gamemode, Brick Top - Evil Guys, ","map":"2263986594","assets":[],"duration":1800},
               {"gameMode":"2313164959","comment":"Fantastic Fantasy Scroller Gamemode, Dungeon (FFS), ","map":"2312977419","assets":[],"duration":1800},
               {"gameMode":"2285067974","comment":"Deathrun, Deathrun Example Map, ","map":"2286680373","assets":["2229481041"],"duration":1800}
       ]
   }

The JSON is broken up into two parts:

General Configuration

Version - leave this at 1 Pin - Currently not supported motdURL - The URL displayed to the player when they join the server motdDelay - The delay, in seconds, before a user can move on from the MOTD rconPassword - Currently not supported

Map Cycles

The 'mapCycle' section provides information on the game-mode; to generated this section you should create a 'Favourite' inside Modiverse itself and then "Export" the JSON by clicking the small icon. This JSON can be pasted directly into this section (remember to add a ',' between each map cycle line and tweak the duration as required)

Error creating thumbnail: File missing


Launching

To launch the dedicated server, assuming you have the ServerConfiguration.json in place, is a simple mater of executing the following command from the directory "/home/james/Modiverse_1":

    ./KJModServer.sh -log -port=7778 -queryport=27016 -SteamServerName="Modiverse Ireland #1 (Sandbox)" -KJModBaseUGCFolder=/home/james/Documents/ServerData1 -DoNotRestartOnEmpty -InitUGCs

It is the first time you have launched Modiverse it will attempt to download all the UGC / Workshop items required by the map cycles; this includes maps, game-modes, assets, etc. If the '-log' message is present then information similar to the following, but this is likely to change in the near future, will be shown as it downloads each item:

Error creating thumbnail: File missing

After this process is completed the server will start moving through the map cycles.

WARNING

NOTE: Whilst you can install the dedicated servers, I'm waiting on Steam resolving an issue with anonymous workshop items (i.e. steam won't let the dedicated server download workshop items, even thought everything is set-up correctly).. the solution at the minute is to login to steamcmd using an account that owns the game, then after you pull an initial workshop item you can login anonymously..

Once you login with a valid Modiverse account execute the following command in steamCMD to create a valid key:

   workshop_download_item 1281150 2223124581

- Thanks

.

Playing

Developers

Developer Reference