Dedicated Server (Killing Floor 2): Difference between revisions

From Killing Floor 2 Wiki
Jump to navigation Jump to search
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[[index.php?title=Category:KF2]]
[[Category:KF2]]
Creating Dedicated Server (Killing Floor 2)
Creating Dedicated Server (Killing Floor 2)


Line 323: Line 323:
The Engine.ini is where most port related changes can be made to a server, including the game port and query port.
The Engine.ini is where most port related changes can be made to a server, including the game port and query port.


  NetServerMaxTickRate - This setting changes the server tickrate.  The default is 30.
  [IpDrv.TcpNetDriver]


{| class="wikitable"
{| class="wikitable"
Line 329: Line 329:
! style="width:20%" |Valid Entries
! style="width:20%" |Valid Entries
! style="width:65%" |What this option controls
! style="width:65%" |What this option controls
|-
|NetServerMaxTickRate
|Numeric character combinations. Default: 30
|This setting changes the server tickrate.
|-
|-
|EnableDDOSProtection
|EnableDDOSProtection
|True or False
|True or False
|Turns on or off advanced DDOS protection
|Turns on or off advanced DDOS protection. This setting must be set to True for the other DDOS protection settings below to take effect
|-
|-
|MaxUnverifiedConnections
|MaxUnverifiedConnections
|numeric character combinations. Example: 1500
|numeric character combinations. Default: 1500
|The number of simultaneous unverified connections. The lower the number, the sooner your server will start ignoring new connection attempts.
|The number of simultaneous unverified connections. The lower the number, the sooner your server will start ignoring new connection attempts.
|-
|-
|HandShakeTimeOutSec
|HandShakeTimeOutSec
|numeric character combinations. Example: 1
|numeric character combinations. Default: 1
|Number of seconds your server will wait for a handshake phase timeout
|Number of seconds your server will wait for a handshake phase timeout
|-
|-
|EnableBlockList
|EnableBlockList
|True or False
|True or False
|when set to TRUE server stops processing incoming connections from the specific IP if there are too many unverified connections from the same IP in the buffer.
|When set to TRUE server stops processing incoming connections from the specific IP if there are too many unverified connections from the same IP in the buffer.
|-
|-
|MaxUnverifiedConsWithSameIpToBlock
|MaxUnverifiedConsWithSameIpToBlock
|numeric character combinations. Example: 16
|numeric character combinations. Default: 16
|When EnableBlockList is TRUE, specifies number of unverified connections in the buffer, after which server stops processing requests from the IP.
|When EnableBlockList is TRUE, specifies number of unverified connections in the buffer, after which server stops processing requests from the IP.
|-
|-
|BlockListTimeSeconds
|BlockListTimeSeconds
|numeric character combinations. Example: 60
|numeric character combinations. Default: 60
|When EnableBlockList is TRUE, specifies how much time in seconds the IP will be blocked when the maximum number of unverified connections from the same IP is reached
|When EnableBlockList is TRUE, specifies how much time in seconds the IP will be blocked when the maximum number of unverified connections from the same IP is reached
|}
|}

Latest revision as of 11:27, 30 July 2024

Creating Dedicated Server (Killing Floor 2)

Installation

Prerequisite: SteamCMD Tool

Downloading SteamCMD:

Follow the official SteamCMD documentation on downloading SteamCMD for your given patform (Win/Linux/macOS).

Running SteamCMD:

Follow the official SteamCMD documentation on running SteamCMD for your given platform (Win/Linux/macOS).

You will know you have successfully run SteamCMD when it is updated and your command line changes to a prompt like:

Steam>

Logging in to SteamCMD:

Before downloading the Killing Floor 2 server you need to login to the SteamCMD tool. To download the Killing Floor 2 server you do not need to be logged into a Steam account that owns Killing Floor 2. It is recommended that you login anonymously! You can still login with your real Steam account but be careful to only enter your Steam credentials into a machine that you trust.

Steam> login anonymous

You should see something like the following:

Connecting anonymously to Steam Public...Loaded client id: 11372976712471569586
Listening for IPv4 broadcast on: 27036
Logged in OK
Waiting for user info...OK

You're done and ready to download the Killing Floor 2 Server!

Downloading the Killing Floor 2 Server

This describes the process of updating the KF2 dedicated server application. These steps are required every time the game is updated. To automate this process for future updates, see #Automating SteamCmd.
1. If you aren't proceeding from the previous set of instructions, first launch SteamCmd.
2. At the Steam> prompt, set your KF2 Dedicated Server install directory.
Examples:
Absolute Path:
force_install_dir c:\KF2Server\
Up one folder:
force_install_dir ..\KF2Server\
In the Steam Command folder (suggested):
force_install_dir .\KF2Server\
3. Install or Update KF2.
If this is your first time installing or if you are trying to verify the integrity of the server files:
app_update 232130 validate
If this is simply an update to an existing KF2 dedicated server:
app_update 232130
If Tripwire is currently running a beta update of the dedicated server files:
app_update 232130 -beta "branch name"

Where "branch name" is the current beta branch. Currently there is not a live dedicated server beta branch.

4. Once finished, type quit at the Steam> prompt to properly log off of the Steam servers.

Automating SteamCmd

There are three ways to automate SteamCmd.

1. Use the commands on a single command line. Example (open CMD and input):
SteamCmd +force_install_dir ./KF2Server +login anonymous +app_update 232130 validate +exit
2. Create a script file.
a. Put your SteamCmd commands in a text file. Example:
// kf2_ds.txt
//
force_install_dir ./KF2Server
login anonymous
app_update 232130 validate
exit
Note: Using the validate option in your SteamCmd script will overwrite the KF2Server.bat file every time you update your server. If you edited this file for launching your server, either create a separate batch file to launch your server or remove the validate option from your SteamCmd script.
b. Run SteamCmd with the +runscript option. Example:
SteamCmd +runscript kf2_ds.txt
3. Create a batch script that uses SteamCMD
a. Put your commands in a bat file (e.g.) server-update.bat to call the SteamCMD. Example (the bat file being located inside /KF2Server):
..\steamcmd.exe +force_install_dir ../KF2Server +login anonymous +app_update 232130 validate +exit
where "..\steamcmd.exe" can either be a path relative to the bat file or an absolute path (e.g. G:\steamcmd\SteamCmd.exe)
and "../KF2Server" is the path to the server installation relative to the SteamCmd location (compare to 1. Add commands to the command line)

Linux

1. First install steamcmd either via direct download or through your package manager:
sudo apt install steamcmd
2. Create a script file for steamcmd to run (replace with your username if you are installing in your home directory):
force_install_dir /home/username/games/killingfloor
login anonymous
app_update 232130 validate
quit
3. Run this directly or through a shell script (again replace username):
steamcmd +runscript /home/username/games/killingfloor/update.txt

Starting the Server

Use the batch file downloaded with the server or create your own. To launch a server with default settings on Survival Biotics Lab use the following batch script:

start .\Binaries\win64\kfserver kf-bioticslab

For Linux Dedicated Servers the included bat file will not work as it is for the windows distribution. Instead run the following:

./Binaries/Win64/KFGameSteamServer.bin.x86_64 kf-bioticslab


If after starting the server it repeatly prints:

[0145.24] Log: Attempting server re-register now...
[0145.24] DevOnline: We need Steam Server UID. Waiting for Steam Server UID for a few seconds.

Make sure you don't have any Steam game open before starting it, validate the files if needed, and make sure you installed the Pre-Requisites mentioned below.

Pre-Requisites

Currently the server has several dependencies. As such we have shipped the UE3Redist.exe with the server files and it can be found in the "\Binaries\Redist" sub folder of where you have installed the server from SteamCMD.

Ports

By default the server will use the following ports:

Port Default Protocol What this option controls
Game Port 7777 UDP This is the main port the game will send connections over
Query Port 27015 UDP This port is used to communicate with the Steam Master Server
Web Admin 8080 TCP This port is used to connect to your servers web admin page (if turned on)
Steam Port 20560 UDP
NTP Port 123 UDP Weekly Outbreak Only - Internet time lookup to determine correct Outbreak

Game Modes

By default the game will launch into the Survival coop game mode which is a 6 player game mode.


Versus Survival

Admins can have the server launch into Versus Survival competitive game mode (an up to 12 player game mode) by using the following launch script:

..\Binaries\Win64\KFGame.exe Server KF-BurningParis?Game=KFGameContent.KFGameInfo_VersusSurvival?maxplayers=12

To make this change in webadmin admins just need to select the game mode "VersusSurvival" from the Change Map tab.

Support maps for Versus Survival at this time are:

BurningParis
BioticsLab
Prison
VoltorManor
Farmhouse


Weekly Outbreaks

Admins can also launch the server into the Weekly Outbreaks coop game mode (also a 6 player game mode) by using the following launch script:

..\Binaries\Win64\KFGame.exe Server KF-BurningParis?Game=KFGameContent.KFGameInfo_WeeklySurvival


To make this change in webadmin admins just need to select the game mode "Weekly" from the Change Map tab.


Endless

Admins can also launch the server into the Endless game mode (also a 6 player game mode) by using the following launch script:

..\Binaries\Win64\KFGame.exe Server KF-BurningParis?Game=KFGameContent.KFGameInfo_Endless


To make this change in webadmin admins just need to select the game mode "Endless" from the Change Map tab.

Advanced Configuration

Configuring your new Killing Floor 2 server will be very similar to those who have set up any Unreal Engine 3 server (such as UT 3). However to those who are from other engines such as IdTech and Source there are many differences, which we'll cover here. Those who are also looking for specific sever config settings will likely find what they are looking for below.

Please note: You will need to launch your server once for it to generate config files (based of the default config files that come with the install. It is strongly recommended you do NOT ever edit one of the default config files).


Command Line Launch Options

You can use several command line launch options to help quickly launch a server. These include url arguments attached to the command line itself (example ...bioticslab?optionhere=x?option2here=x) as well as switches which are included after the main line (example ...bioticslab -switchhere -switch2here)

Url Arguments Valid Entries What this option controls
AdminName= Alpha numeric character combinations. Example: Admin This is the admin username for WebAdmin if you're configuring WebAdmin via Commandline
AdminPassword= Alpha numeric character combinations. Example: Abd32Sdn53 This is the master server administrator password
MaxPlayers= Alpha numeric character combinations. Example: 6 This is how many maximum players the server is set to support
Difficulty= Numeric characters 0-3 This sets the server difficulty. 0 = Normal, 1 = Hard, 2 = Suicidal, 3 = Hell on Earth
Switches Valid Entries What this option controls
Port= Alpha numeric character combinations. Example: 7787 This is the game port. Changing this without changing the query port will automatically change the query port as well (up/down the same number from the default game port)
QueryPort= Alpha numeric character combinations. Example: 27015 This is the query port. Changing this will change the port the server uses to communicate with Steam. Default is 27015. Change this in your launch will make it different from the automatic change that happens if you change the default port.
WebAdminPort= Alpha numeric character combinations. Example: 8080 This is the web admin port. Changing this will change the port used to connect to the servers webadmin panel if that functionality is turned on. This switch is still in Beta, use at your own risk.
Multihome= An IP that can resolve to the server machine. Example: 192.168.0.1 If a server machine can resolve to multiple IP's, this command can tie a server to a specific IP on that machine.
PREFERREDPROCESSOR= Numeric characters. Example: 2 This will tie a server process to a single core/thread on the hosting machine.
ConfigSubDir= Alpha numeric character combinations. Example: KF2Server-Normal-Long1 Creates and reads settings from a sub directory under ./KFGame/Config which allows you to configure .INI settings on a per server basis.

PCServer-KFGame.ini

The PCServer-KFGame.ini file can be found under \KFGame\Config\

This file controls all the various game elements that can be configured by admins in Killing Floor2. From game modes to spectating options and more, everything can be set up to the admins liking from this file.

First admins will want to configure this file to update the WebAdmin, server password and other settings that you do have access to. Here is an example of a very simple PCServer-KFGame.ini settings admins will want to change first:

Server Passwords

[Engine.AccessControl] in PCServer-KFGame.ini:
Option Name Valid Entries What this option controls
AdminPassword Alpha numeric character combinations. Example: Abd32Sdn53 This is the master server administrator password
GamePassword Alpha numeric character combinations. Example: cl4ng4m3 This sets a password players will need to enter to join the server

Server Name and Admin Contact

[Engine.GameReplicationInfo] in PCServer-KFGame.ini:
Option Name Valid Entries What this option controls
ServerName Alpha numeric character combinations. Example: Yoshi's House of 32 Compressed Pancakes This is the displayed server name to all players in the server and the server browser
AdminContact Alpha numeric character combinations. Example: [email protected] This is the displayed admin contact in the server browser

Maps

bUseMapList=True - This sets the server to use a custom map list you specify instead of the entire default map list.
GameLength=1 - This sets the number of rounds per game. 0 -> {short, 4 rounds}  1 -> {normal, 7 rounds}  2 -> {long, 10 rounds}

Maps can be set to run by gametype and amount of rounds played. The following is an example map list that can be put in your PCServer-KFGame.ini:

Game Map Cycle
GameMapCycles=(Maps=("KF-BurningParis","KF-Bioticslab","KF-Outpost","KF-VolterManor","KF-Catacombs","KF-EvacuationPoint"))

The first part specifies the exact maps and their game types.

PCServer-KFEngine.ini

The Engine.ini is where most port related changes can be made to a server, including the game port and query port.

[IpDrv.TcpNetDriver] 
Option Name Valid Entries What this option controls
NetServerMaxTickRate Numeric character combinations. Default: 30 This setting changes the server tickrate.
EnableDDOSProtection True or False Turns on or off advanced DDOS protection. This setting must be set to True for the other DDOS protection settings below to take effect
MaxUnverifiedConnections numeric character combinations. Default: 1500 The number of simultaneous unverified connections. The lower the number, the sooner your server will start ignoring new connection attempts.
HandShakeTimeOutSec numeric character combinations. Default: 1 Number of seconds your server will wait for a handshake phase timeout
EnableBlockList True or False When set to TRUE server stops processing incoming connections from the specific IP if there are too many unverified connections from the same IP in the buffer.
MaxUnverifiedConsWithSameIpToBlock numeric character combinations. Default: 16 When EnableBlockList is TRUE, specifies number of unverified connections in the buffer, after which server stops processing requests from the IP.
BlockListTimeSeconds numeric character combinations. Default: 60 When EnableBlockList is TRUE, specifies how much time in seconds the IP will be blocked when the maximum number of unverified connections from the same IP is reached

Setting Up Web Admin

To enable webadmin: Open KFWeb.ini. In the [IpDrv.WebServer] section set

bEnabled=true

By default webadmin will listen on port 8080 on the IP of the game server using, but you'll want to customize this port for multiple servers on the same IP. To change this, open KFweb.ini and modify the following line:

ListenPort=8080

Admins will now be able to log into their servers web admin panel. They can do by either connecting via a local address (if the server is local) or web address (the servers IP) followed by the port. They can use any of their favorite modern internet browsers such as Chrome, Firefox, and IE. An example of what to put in the address bar of the browser is:

192.168.0.100:8080

They will be presented with a login screen. The default user is: Admin. The password will be whatever was set as the admin pass in PCServer-KFGame.ini. If no admin pass was set, the admin will not be able to log in.


Setting up multiple web admins

Open KFWebAdmin.ini and add the following under [WebAdmin.WebAdmin]:

AuthenticationClass=WebAdmin.MultiWebAdminAuth

Start the server once to generate a new MultiAdmin.ini. Now you can either add new admin names and passwords from within the Web Admin itself, or you can add them manually in the file. To do so add the following information for each admin under [Admin MultiAdminData] in MultiAdmin.ini

DisplayName=			"AdminNameHere" // Punctuation does matter for these names
Password=			"123" // Any alpha numeric set of characters will work here
Order=				"DenyAllow"
bEnabled=			"True" // This enables this admin

How To Use Web Admin

Go to Web Admin to find out more details on how to use the system.

Setting Up Steam Workshop For Servers

Configuring the server to download files from Workshop:

  1. Make sure that the server is not running. If it is running, the Workshop setup will be overridden the next time you restart the server.
  2. Add a new section to the PCServer-KFEngine.ini config file: [OnlineSubsystemSteamworks.KFWorkshopSteamworks]
  3. For each Workshop item you want the server to download, add a ServerSubscribedWorkshopItems=<number> line in that section. You can find the number by looking for the id= part of the the URL of the Workshop item in Steam. For example, the URL of the Workshop Test map is http://steamcommunity.com/sharedfiles/filedetails/?id=535769647, so the line will be "ServerSubscribedWorkshopItems=535769647". There might be other text=number parts of the URL, so be sure to use only the number after "id=".

Example [OnlineSubsystemSteamworks.KFWorkshopSteamworks] section (These ID's are for Grindhouse Contest Maps):

[OnlineSubsystemSteamworks.KFWorkshopSteamworks]
ServerSubscribedWorkshopItems=605633924
ServerSubscribedWorkshopItems=605551918
ServerSubscribedWorkshopItems=605549089
ServerSubscribedWorkshopItems=605532351


Make clients download the Workshop item from Steam when connecting to the server:

This will only work for Workshop items that the server downloads itself, that are listed in the [OnlineSubsystemSteamworks.KFWorkshopSteamworks] section as described above.

  1. Make sure that the server is not running. If it is running, the Workshop setup will be overridden the next time you restart the server.
  2. Find the section [IpDrv.TcpNetDriver] in the PCServerEngine.ini config file.
  3. Add the line "DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload" to that section. If there are other "DownloadManagers=" lines, make sure this one is the first.
  4. Do not delete anything from this section, except (optionally) other DownloadManagers= lines.


Steam Workshop map location in server and map names

Start the server and wait it to download Steam Workshop maps you added earlier. This can take several minutes. After server has downloaded all the maps stop the server and make sure that it is not running.

Navigate into server install location and go into folder KFGame\Cache\XXX\0\BrewedPC where XXX is one of the ServerSubscribedWorkshopItems you added earlier. For example (KF-BikiniAtoll):

KFGame\Cache\643383080\0\BrewedPC

Copy paste the map file name (excluding the .kfm extension).

See #Maps and #Get Custom Maps To Show In Web Admin where you can paste it.

Known issue on Linux servers:

Linux servers currently do not create the proper cache folder, you must create it inside your server install directory:

mkdir -p KFGame/Cache

Setting Up Redirect - Depreciated by SteamWorkshop

To enable redirect for third party custom maps to be able to run on their server, admins needs to install the "cooked server" files in their "\KFGame\BrewedPC" directory on the dedicated server.

Now unless users already have the cooked client map files installed manually or previously downloaded in their clients cache, the server will need to be set up to redirect clients without the map to download it from a redirect server. To enable this, the admin must open the PCServer-KFEngine.ini file and add a new section near the bottom of the file. The section is called [IpDrv.HTTPDownload] and should look like this:

[IpDrv.HTTPDownload]
RedirectToURL=http://kf2.tripwirecdn.com/

Where the RedirectToURL is a web location that is a repository of the client map files. The example above is the location of Tripwire's public redirect server which will host several near complete and complete custom maps. The client map file must be named as a .kfm file.


For Windows Server users if you use IIS for the redirect please make sure to go to Server Manager and check that you have Anonymous Authentication or Basic Authentication enabled. Next be sure that the File Extension .kfm is added to the list in MIME Types. You will see two fields when you add a new MIME Type, File name extension and MIME type. Here is an example on how it should look

http://i.imgur.com/hGsJuId.png (Can't find out how to embed the image so here is the link)

Get Custom Maps To Show In Web Admin

To get custom maps to show up in the change level section of web admin, admins will need to add a data store for the game in PCServer-KFGame.ini. A data store looks like the following example:

[KF-Default KFMapSummary]
MapName=KF-Default
ScreenshotPathName=UI_MapPreview_TEX.UI_MapPreview_Placeholder

Please note the use of lowercase in the map name and read the Known Issues to Avoid section for more information on the topic. This holds true for the mapcycle as well.

Known Issues to Avoid

  • Linux Redirect

As a redirect server can be a Linux machine, it is very important admins have the closing forward slash in the URL as well as spell all map names in lowercase. Failure to do so will result in a broken redirect and clients will only obtain a 1kb file of the proper name but not the actual files. Also take care when adding the map data store to the PCServer-KFGame.ini to use lowercase as well as the server will use those file names over any typed in as an admin.

  • Traveling from a custom map to a custom map

When a server goes from a custom map to a custom map, clients will download the second custom map, however there is a bug where the client will just see the "connecting" screen without any updated information about downloading the custom map until it is downloaded and begins to load.

A redirect server needs fast speeds and as much bandwidth as possible, but little else.

  • Hosting too many maps

A server should not have more than 519 maps in rotation or it will cause the server to break

Setting Up Server Welcome Screen

  1. Make sure the game server isn't running
  2. Edit PCServer-KFGame.ini:

Find this part and edit it, here is the default one

Code:

BannerLink=http://art.tripwirecdn.com/TestItemIcons/MOTDServer.png
ServerMOTD=Welcome to our server. \n \n Have fun and good luck!
WebsiteLink=http://killingfloor2.com/
  1. BannerLink should be a PNG (save it > 8bit) image
  2. ServerMOTD is the message display under the BannerLink image. You can usesome "\n" to create a new line like in the default message, I personally add two lines before my MOTD message to add space between image and text
  3. WebsiteLink is the url of your website (if you edit this from the webadmin, it resets to a blank value after saving)
  4. Save, start the server, enjoy you welcome screen.


Server Takeover

What it is

Server Takeover is a feature that allows players who are matchmaking and choosing to start their own private game to "grab" a server that has not opted out for them to use during their play time. This will change the settings on the server to those that the players want and make it private. However it will not expose any of the private information about that server (such as admin passwords) to them. At the end of their stay in the server, the server will open back up again and await new players or another takeover request.

How to opt out

To remove your server from the take over list you can use this line in the PCServer-KFEngine.ini:

[Engine.GameEngine]
bUsedForTakeover=FALSE