Shared ServerPerks Stats Across Several Killing Floor Servers (ServerPerksHost and FTP)
Almost every custom Killing Floor 1 server keeps perk progress through ServerPerks (Marco's mutator). Owners of several servers often want a player who levelled up on an easy server to carry on at a harder one with the same levels. Or one server for perks 1-7 and another for 8-40 with better guns, open only from level 7. ServerPerks supports this with a remote stats database. This page is based on w.a.l's guide on the killingfloor.ru forum (2013), with additions from Essence, Flame and Proton.
Where the stats live
ServerPerks has two settings files:
ServerPerks.ini- levelling, trader, skins, levels, smileys;ServerPerksStat.ini- the players' stats themselves. This is what moves into a shared database.
Two more notes from the killingfloor.ru forum:
- Linux, running as root. If the server runs as root, perk stats are stored in
/root/.killingfloor/system/ServerPerksStat.ini. To avoid running the server as root, create a separate user and give it rights to the game directory (Flack, "Мутатор ServerPerksV4" thread). - Transferring levels by hand (for example, a player who moved from another server). Have the player play on the server a little first, at least a map or a wave (it depends on
MidGameSaveWavesinServerPerks.ini), so that a record exists. Then find it inServerPerksStat.inior, with a remote database, inData.iniand enter the values you need. Search by ID rather than by nickname, since nicknames can repeat ("Перки" thread).
Option 1: ServerPerksHost
ServerPerksHost is a small utility by Marco that holds the stats database and serves it to servers over the network. There are two builds: console ServerPerksHost155.exe (a visible window, so you can see it is running) and windowless ServerPerksHostNW.exe (made mainly for running under Wine on Linux, where the console build fails; stop it from Task Manager). If one does not start, try the other.
- Create a folder on the host machine with
ServerPerksHost.exeand its settings. - Move
ServerPerksStat.iniout of the server folder into it. - Run the utility with that file as its parameter: the easiest way is to drag
ServerPerksStat.iniontoServerPerksHost.exe. AData.inifile appears; it is the new database. It holds one entry per SteamID:
[76561199075808484]
ZomboUser=SRVetSupportSpec,28,0,22999,0,0,0,0,0,6,0,0,0,0,0,0,0,0,2,74,0,111,1028,0,0
- Configure the utility in its
Host.ini(the password must be quoted):
[General]
Port=6000
Password="5555"
- In
ServerPerks.iniof every server (this file stays in place):
[ServerPerksMut.ServerPerksMut]
RemotePort=6000
bUseRemoteDatabase=True
RemoteDatabaseURL=192.168.0.1
RemotePassword=5555
RemotePort- the same port as inHost.ini;bUseRemoteDatabase=True- turns the remote database on;RemoteDatabaseURL- IP of the machine running ServerPerksHost (just the IP, no protocol or port);RemotePassword- the password fromHost.ini.
- Delete
ServerPerksStat.inion all servers, start ServerPerksHost, then the servers.
Any number of servers can share one database as long as their connection settings match. To turn Data.ini back into a ServerPerksStat.ini, run ServerPerksHost.exe with the UNDO parameter.
Option 2: FTP (ServerPerks 7 and later)
From version 7, ServerPerks can keep stats on a plain FTP server, one SteamID.txt file per player:
[ServerPerksMut.ServerPerksMut]
bUseRemoteDatabase=True
bUseFTPLink=True
RemoteDatabaseURL=192.168.1.33
RemotePort=21
RemoteFTPUser=User
RemotePassword=Pass
RemoteFTPDir=
FTPKeepAliveSec=120
RemoteDatabaseURL- IP or host name of the FTP server;RemoteFTPDir- empty for the root, or/folder;FTPKeepAliveSec- how often the server pings FTP to keep the connection alive (120 is recommended).
Moving existing stats to FTP. Copy ServerPerks, ServerPerks.ini and ServerPerksStat.ini into your own game folder, set bUploadAllStats=True in ServerPerksStat.ini, start a solo game with the Server Veterancy Handler V7 modification and wait until the player files appear on the FTP server. There is no converter from the .txt files back to ServerPerksStat.ini.
Code fixes for FTP mode
- Server without Steam. If Steam is not running and logged in on the machine, FTP mode fails because
Openneeds Steam authentication. In classFTPTcpLink, replaceDataConnection.Open(A)withDataConnection.OpenNoSteam(A)andOpen(SiteAddress)withOpenNoSteam(SiteAddress). - FileZilla Server. Stats are written to a temporary file and then renamed to
.txt. FileZilla refuses to rename over an existing file and answers with error 553. InFTPTcpLink, in the handler for reply 350, sendDELEbeforeRNTO:
case 350: // Rename accepted.
if( bPostUploadCheck )
{
SetTimer(5,false);
SendFTPLine("DELE "$Left(TempFileName,Len(TempFileName)-4));
SendFTPLine("RNTO "$Left(TempFileName,Len(TempFileName)-4));
}
After code changes, recompile the package (see ucc make) and rename it so clients do not hit a version mismatch.
Additions
Web player top (Frosty, the "Топ пользователей" (user top) thread): a PHP script that shows stats from ServerPerksStat.ini on a website. Setup:
- In
stats.php, on line 26 ($path = 'C:\KF\system\ServerPerksStat.ini';), set your own path toServerPerksStat.ini. - In
top.php, on line 28 (the<iframe src=... width=1189 height=500 frameborder=0>tag), enter the path tostats.php. - If the players do not fit and a side scroll bar appears, raise
height=500on the same line.
The script was unfinished: sorting did not work for the author. No ready version for servers that keep stats in a ServerPerksDataBase database instead of ServerPerksStat.ini appeared in the thread.