Server

From King Arthur's Gold Wiki
Revision as of 21:07, 13 January 2012 by N2j3 (Talk | contribs)

Jump to: navigation, search
This page might not be up-to-date (build No current.).

A simple guide for hosting a KAG server on Linux and Windows. This guide will be growing gradually over time.
Currently the suggested operating system for hosting a KAG server is Linux.

Linux

In this example we use the Debian distribution. For other distributions, please modify accordingly.

To begin with you need to download the server files (linux server). You can unpack it locally (it's in "tar.gz" format so only thing you need to do is to unpack it twice, assuming you're using Windows) on your machine and upload it to your server via FTP/SFTP using programmes like "WinSCP", "FileZilla", etc.

You can use "wget http://kag2d.com/downloads/kag_linux.tar.gz" to download from the kag2d.com website. Alternatively you can upload this file without unpacking it locally and the unpack it on your server via SSH issuing this command:

tar -xzvf kag*tar.gz kag

if used wget command it will be "tar -xzvf kag_linux.tar.gz kag"

(I've used asterisk at and of file cause it will change overtime, supply there exact file name.)

Next step is to make these files executable:

KAGdedi
dedicatedserver.sh

To do this issue in main KAG folder the following commands:

To change to the main folder cd kag_linux
chmod +x KAGdedi
chmod +x dedicatedserver.sh

Assuming you've edited all configuration files to your liking, only thing that left to do is running your server:
./dedicatedserver.sh

As you can see all the output from the server is going straight onto your screen. You can use some multiplexer e.g. "GNU Screen", "nohup", etc. I'll cover in detail how to run it later. For now you can issue the following command:
./dedicatedserver.sh > /dev/null

It will output "everything" to "nowhere". It's a temporary solution.

If you are using SSH and you want the server to keep running after you close the SSH connection use this command:
nohup ./dedicatedserver.sh > /dev/null &


How to restart the server:
If you wish to restart the server this is simple type top then find the PID then type kill <PID of the KAG service>

64bit Kernel

If you're using a 64bit kernel then you need to install additional 32-bit libraries.
apt-get install ia32-libs

If you're not sure which kernel you're running, type:
uname -m
This will either return i686 (32bit) or x86_64 (64bit).

Windows

Locate "dedicatedserver.bat" in the root directory of your KAG installation (default location: C:\KAG).

Edit the files mentioned in the following section (Configuration) (default location: C:\KAG\Base\Scripts\ etc).

Once you're done editing the configuration files to match your server's needs, double click on the batchfile (dedicatedserver.bat) to run.

Configuration

Note: Following configuration files are common in both windows and linux servers; they must be edited for your server to work

dedicated_autoconfig.gm

When you edit this file you need to take a closer look at these lines (comments are from MM himself, I've tweaked it here and there to make it more clear):

global m_width = 600; // Map generator width. Affects RAM usage.
global m_height = 250; // Map generator height. Affects RAM usage.
global m_seed = 0; // Map generator seed. Pick a random number.
global g_kickvote_percent = 33; // Percentage of players needed for a kick vote to pass.
global g_mapvote_percent = 51; // Percentage of team players needed for a map vote to pass.
global g_vote_time = 60; // How long (in seconds) does the voting take place.
global g_kickvote_bantime = 30; // How long (in minutes) is the player banned after a kick vote.
global sv_maxplayers = 16; // Maximum number of players allowed ingame.
global sv_port = 50301; // Server communication port, this is where it listens for incoming clients. Remember to open this port in your firewall.
global sv_password = ``; // Sets the server password.
global sv_rconpassword = ``; // Sets the server remote console password. This is important if you want to have control over your server.
global sv_require_auth = 1; // If set to 1 server checks client authentication via master server.
global sv_gold_only = 0; // If set to 1 only premium account players can join (aka Gold Server).
global sv_allow_globals_mods = 1; // If set to 1 global KAG moderators and admins can kick/ban players on server.
global sv_deltapos_modifier = 1; // Controls the threshold for delta packet updating. Value higher than 1 will reduce bandwidth, lower increase.
global sv_maxping = 450; // Max ping allowed on server after which player is kicked. Large ping players will slow down server.
global sv_maxping_warnings = 200; // Because of ping spikes, warnings are issued if a player has ping over max number.
global sv_maxhack_warnings = 25; // Maximum amount of warnings where server thinks player is hacking.
global sv_alloweditor = 1; // If set to 1 players that have RCON can start map editor on server
global sv_name = `KAG game`; // Sets the server name displayed in server browser.
global sv_info = ``; // Sets the server info displayed in server browser. If you want it multi-line simply move text to new line with enter.

dedicated_autostart.gm

LoadRules("Rules/CTF/gamemode.cfg");
LoadMapCycle( "Scripts/mapcycle.cfg" );
LoadMap( "" );

This file is very important. If you want to change rules for your server then you have to edit the first line to contain the path to the config-file which you want to use.

Just leave it like that if you want your server to automatically change the map after a match is finished. But if you want to have one map all the time instead of a nice mapcycle remove the path from "LoadMapCycle" and use "LoadMap".

mapcycle.cfg

#KAG mapcycle;
# put map generator files, png files here, or script files
# eg. mapcycle = Maps/example1.png; Maps/example2.png; Maps/generator_flat.cfg; Maps/swordfight.gm;

mapcycle = Maps/generator_ctf_mountain.cfg;
You must separate paths to files with semicolons. Allowed files are generators, script files and maps in png format.

Generator.cfg

I use here general name for generator configuration file, you can name it however you like.
Generator uses "libnoise"-library. You can read a tutorial about how to use it here.

Maqq's CLI Server Configuration tool

Maqq's command-line interface server configuration tool provides an interactive way of setting up a server:

Download in the root KAG directory (C:\KAG or /kag_linux , in windows and linux respectively).

  • In Windows, run KAGServer.exe and follow the onscreen instructions.
  • In linux, make it executable via chmod +x sconfig.py and run with ./sconfig.py

Downloads for Maqq's CLI Server config: