Difference between revisions of "Server"

From King Arthur's Gold Wiki
Jump to: navigation, search
m (64bit Kernel)
(Server)
Line 1: Line 1:
{{Build
+
The King Arthur's Gold Server is a relatively lightweight, 32-bit command line application. Freely distributed, this program allows anybody with an internet connection and a computer to host their own King Arthur's Gold server.
|Version = Not Up-to-date
+
}}
+
A simple guide for hosting a KAG server on Linux and Windows. This guide will be growing gradually over time.<br />
+
Currently the ''suggested'' operating system for hosting a KAG server is Linux.
+
  
 +
Note: There is very little official documentation for the KAG server. As a result, the majority of this document was created from observation, trial and error. Use at your own risk.
 +
=Features=
 +
*All servers are added to the official server list to be seen by anybody who chooses the "Pick a Server" option in-game.
 +
*Servers can be remotely controlled in game by anybody with the server's Remote Control (RCON) password.
 +
*Servers can be password protected. (This is separate from the RCON password.)
 +
=Requirements=
 +
==Hardware==
 +
The hardware requirements for a KAG server are minimal. If a computer can run the full KAG game, it can run the KAG server.
 +
==Software==
 +
The KAG server can run on Linux, Windows, or Mac. The recommended operating system is Linux, specifically Debian.
 +
==Network==
 +
The KAG server uses three ports.
 +
{|border="1" cellpadding="5" cellspacing="0"
 +
|-
 +
|
 +
! scope="col" style="background:#efefef;" | Description
 +
! scope="col" style="background:#efefef;" | Modifiable?
 +
! scope="col" style="background:#efefef;" | Firewall Tolerant?
 +
|-
 +
! scope="row" style="background:#efefef;" | 50301
 +
|Used to listen for connections.
 +
!scope="row" style="background:#31E831;"|yes
 +
!scope="row" style="background:#E83131;"|no
 +
|-
 +
! scope="row" style="background:#efefef;" | 50328
 +
|Used to communicate with clients.
 +
!scope="row" style="background:#31E831;"|yes
 +
!scope="row" style="background:#31E831;"|yes
 +
|-
 +
! scope="row" style="background:#efefef;" | 51308
 +
|Used to communicate with the master server.
 +
!scope="row" style="background:#E83131;"|no
 +
!scope="row" style="background:#31E831;"|yes
 +
|}
 +
Firewall tolerant means that a typical connection-oriented ([http://en.wikipedia.org/wiki/Stateful_firewall SPI]) firewall will allow that port through. Depending on the firewall, all ports may need to be forwarded.<br />
 +
The internet connection is typically the bottleneck that determines the number of users a server can support. Hosting more users than a connection can support will cause a high ping time and significant lag.
 +
=Installation=
 
==Linux==
 
==Linux==
 
+
<p>This guide is written for 32-bit Debian Linux. To run on 64-bit Debian Linux, the <code>ia32-libs</code> package must be installed.</p>
''In this example we use the Debian distribution. For other distributions, please modify accordingly.''
+
<p>
 
+
# First, download the server: <br /> <pre>wget http://kag2d.com/downloads/kag_linux.tar.gz</pre>
To begin with you need to download the [http://kag2d.com/download 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.<br />.
+
# Next, decompress the archive. <br /> <pre>tar -zxf kag_linux.tar.gz</pre>
Otherwise, and via SSH type: ''wget http://kag2d.com/downloads/kag_linux.tar.gz'' to download from the kag2d.com website.
+
# Change to the new directory: <br /> <pre>cd kag_linux</pre>
 
+
# [[Server#Configuration|Configure]] your server.
To decompress type:
+
# Run your server: <br /> <pre>./dedicatedserver.sh</pre>
<code>
+
tar zxf kag_linux.tar.gz
+
</code>
+
change into kag_linux  directory by:
+
<code>
+
cd kag_linux
+
</code>
+
<p>Assuming you've edited all [[Server#Configuration|configuration files]] to your liking, only thing that left to do is running your server:<br />
+
 
+
 
+
./KAGdedi
+
 
</p>
 
</p>
 
+
==Windows==
<p>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:<br />
+
<p>
 
+
# First, download the server: http://kag2d.com/downloads/ <br /> Note: The downloads page only lists a linux server. Even though the server is intended to run on Linux, it will run on Windows.
 
+
# Next, decompress the archive. This can be done with many different programs, including [http://peazip.sourceforge.net/ PeaZip].
./dedicatedserver.sh > /dev/null
+
# Open the folder the archive was extracted into.
 +
# [[Server#Configuration|Configure]] your server.
 +
# Run your server by clicking <code>dedicatedserver.bat</code>.
 
</p>
 
</p>
 
+
==Mac==
It will output "everything" to "nowhere". It's a temporary solution.<br />
+
Due to their similarities, the installation instructions for Linux should apply for Macs.
 
+
=Configuration=
<p>If you are using SSH and you want the server to keep running after you close the SSH connection use this command:<br />
+
<p>The KAG server is configured using text files.  Customizing a KAG server installation involves modifying the variables in these files. There are two ways to do this: manually and using Maqq's Configuration Tool. Of the two, Maqq's Tool is by far the fastest and easiest method.</p>
<code>
+
<p>'''One of the most important decisions a server administrator must make is whether or not to allow the [[Royal Guard]] to police their server. Please read the opening posts in these threads ([http://kagforum.com/index.php?threads/in-game-moderators-aka-royal-guard-updated-25-12-2011.1128/ In-game moderators (AKA Royal Guard)] & [http://kagforum.com/index.php?threads/the-royal-guard-frequently-asked-questions-public-policy.1714/ The Royal Guard - FAQ & Public Policy]) so you can make an informed decision.'''</p>
nohup dedicatedserver.sh &
+
</code> </p><br />
+
How to restart the server:<br />
+
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===
+
<p>If you're using a 64bit kernel then you need to install additional 32-bit libraries.<br />
+
 
+
<code>
+
apt-get install ia32-libs
+
</code></p>
+
 
+
<p>If you're not sure which kernel you're running, type:<br />
+
 
+
<code>
+
uname -m
+
</code><br />
+
 
+
This will either return ''i686'' (32bit) or ''x86_64'' (64bit).</p>
+
 
+
==Windows==
+
Locate "dedicatedserver.bat" in the root directory of your KAG installation (default location: C:\KAG).
+
 
+
Edit the files mentioned in the following section  ([[Server#Configuration|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==
+
'''A ''vital'' consideration for your server is whether you will allow global moderators (a.k.a. "[[guards]]"). Please read the opening posts in these threads ([http://kagforum.com/index.php?threads/in-game-moderators-aka-royal-guard-updated-25-12-2011.1128/ In-game moderators (AKA Royal Guard)] & [http://kagforum.com/index.php?threads/the-royal-guard-frequently-asked-questions-public-policy.1714/ The Royal Guard - FAQ & Public Policy]) so you can make an informed decision.'''
+
 
+
 
<p>If you decide you don't want guards to moderate on your server, ''please ensure they are turned off'' in your dedicated_autoconfig.gm file like this:
 
<p>If you decide you don't want guards to moderate on your server, ''please ensure they are turned off'' in your dedicated_autoconfig.gm file like this:
  
Line 72: Line 65:
 
global sv_allow_globals_mods = 0
 
global sv_allow_globals_mods = 0
 
</pre></font></p>
 
</pre></font></p>
 
+
==Manual Configuration==
 +
Of the many editable configuration files that the KAG server depends upon, most customization is done in the <code>dedicated_autoconfig.gm</code>, <code>dedicated_autostart.gm</code>, <code>mapcycle.cfg</code>, and <code>*-generator.cfg</code> files. These are all in the kagServer/Base/Scripts directory, where kagServer is the directory the server was extracted into.
 
===dedicated_autoconfig.gm===
 
===dedicated_autoconfig.gm===
  
<p>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):
+
<p>Of the many modifiable variables, these are some of the most important:
 
   
 
   
 
<font size=3><pre>
 
<font size=3><pre>
Line 128: Line 122:
 
<p>I use here general name for generator configuration file, you can name it however you like.<br />
 
<p>I use here general name for generator configuration file, you can name it however you like.<br />
 
Generator uses "libnoise"-library. You can read a tutorial about how to use it [http://libnoise.sourceforge.net/tutorials/tutorial4.html here].</p>
 
Generator uses "libnoise"-library. You can read a tutorial about how to use it [http://libnoise.sourceforge.net/tutorials/tutorial4.html here].</p>
 
+
==Maqq's Server Configuration Tool==
===Maqq's Server Configuration Tool===
+
<p>Maqq's command-line interface server configuration tool provides an interactive way of setting up a server:</p>
Maqq's command-line interface server configuration tool provides an interactive way of setting up a server:
+
<p>
 
+
 
Download in the root KAG directory (C:\KAG or /kag_linux , in windows and linux respectively).
 
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 Windows, run KAGServer.exe and follow the onscreen instructions.
*In linux, make it executable via ''chmod +x sconfig.py'' and run with  ''./sconfig.py'' . Daemonisation tools applicable to dedicatedserver.sh (''screen, tmux, nohup'' etc) still useable with this programme
+
*In linux, make it executable via ''chmod +x sconfig.py'' and run with  ''./sconfig.py'' . Daemonisation tools applicable to dedicatedserver.sh (''screen, tmux, nohup'' etc) still useable with this program</p>
;Reusing Generated Configs
+
===Reusing Generated Configs===
 
+
<p>These commands reuse the generated configuration files:[http://kagforum.com/index.php?threads/maqqs-cli-server-configuration-tool.3121/#post-67046 ]</p>
These commands reuse the generated configuration files:[http://kagforum.com/index.php?threads/maqqs-cli-server-configuration-tool.3121/#post-67046 ]
+
<p>
 
+
 
*If you're using linux, type this in the console:
 
*If you're using linux, type this in the console:
 
''./KAGdedi autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm''
 
''./KAGdedi autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm''
Line 144: Line 136:
 
*If you're using windows, you should consider using the [GUI version], it lets you save the configuration into a file, but if you want to use the CLI version, type this in the command prompt:
 
*If you're using windows, you should consider using the [GUI version], it lets you save the configuration into a file, but if you want to use the CLI version, type this in the command prompt:
 
''KAG autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm''
 
''KAG autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm''
<br /><br />
+
</p>
 
+
===Download Maqq's Server Config Tool===
==Download Maqq's Server Config Tool==
+
<p>
 
*Windows (GUI): http://dl.dropbox.com/u/51067730/kag/KAGServer.exe
 
*Windows (GUI): http://dl.dropbox.com/u/51067730/kag/KAGServer.exe
 
*Windows (CLI): http://dl.dropbox.com/u/51067730/KAGServer.exe (has python included)
 
*Windows (CLI): http://dl.dropbox.com/u/51067730/KAGServer.exe (has python included)
*Linux/OSX (CLI-only): http://213.152.176.254/mirror/sconfig.py
+
*Linux/OSX (CLI-only): http://213.152.176.254/mirror/sconfig.py</p>

Revision as of 02:44, 22 February 2012

The King Arthur's Gold Server is a relatively lightweight, 32-bit command line application. Freely distributed, this program allows anybody with an internet connection and a computer to host their own King Arthur's Gold server.

Note: There is very little official documentation for the KAG server. As a result, the majority of this document was created from observation, trial and error. Use at your own risk.

Features

  • All servers are added to the official server list to be seen by anybody who chooses the "Pick a Server" option in-game.
  • Servers can be remotely controlled in game by anybody with the server's Remote Control (RCON) password.
  • Servers can be password protected. (This is separate from the RCON password.)

Requirements

Hardware

The hardware requirements for a KAG server are minimal. If a computer can run the full KAG game, it can run the KAG server.

Software

The KAG server can run on Linux, Windows, or Mac. The recommended operating system is Linux, specifically Debian.

Network

The KAG server uses three ports.

Description Modifiable? Firewall Tolerant?
50301 Used to listen for connections. yes no
50328 Used to communicate with clients. yes yes
51308 Used to communicate with the master server. no yes

Firewall tolerant means that a typical connection-oriented (SPI) firewall will allow that port through. Depending on the firewall, all ports may need to be forwarded.
The internet connection is typically the bottleneck that determines the number of users a server can support. Hosting more users than a connection can support will cause a high ping time and significant lag.

Installation

Linux

This guide is written for 32-bit Debian Linux. To run on 64-bit Debian Linux, the ia32-libs package must be installed.

  1. First, download the server:
    wget http://kag2d.com/downloads/kag_linux.tar.gz
  2. Next, decompress the archive.
    tar -zxf kag_linux.tar.gz
  3. Change to the new directory:
    cd kag_linux
  4. Configure your server.
  5. Run your server:
    ./dedicatedserver.sh

Windows

  1. First, download the server: http://kag2d.com/downloads/
    Note: The downloads page only lists a linux server. Even though the server is intended to run on Linux, it will run on Windows.
  2. Next, decompress the archive. This can be done with many different programs, including PeaZip.
  3. Open the folder the archive was extracted into.
  4. Configure your server.
  5. Run your server by clicking dedicatedserver.bat.

Mac

Due to their similarities, the installation instructions for Linux should apply for Macs.

Configuration

The KAG server is configured using text files. Customizing a KAG server installation involves modifying the variables in these files. There are two ways to do this: manually and using Maqq's Configuration Tool. Of the two, Maqq's Tool is by far the fastest and easiest method.

One of the most important decisions a server administrator must make is whether or not to allow the Royal Guard to police their server. Please read the opening posts in these threads (In-game moderators (AKA Royal Guard) & The Royal Guard - FAQ & Public Policy) so you can make an informed decision.

If you decide you don't want guards to moderate on your server, please ensure they are turned off in your dedicated_autoconfig.gm file like this:

global sv_allow_globals_mods = 0

Manual Configuration

Of the many editable configuration files that the KAG server depends upon, most customization is done in the dedicated_autoconfig.gm, dedicated_autostart.gm, mapcycle.cfg, and *-generator.cfg files. These are all in the kagServer/Base/Scripts directory, where kagServer is the directory the server was extracted into.

dedicated_autoconfig.gm

Of the many modifiable variables, these are some of the most important:

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 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 . Daemonisation tools applicable to dedicatedserver.sh (screen, tmux, nohup etc) still useable with this program

Reusing Generated Configs

These commands reuse the generated configuration files:[1]

  • If you're using linux, type this in the console:
./KAGdedi autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm
  • If you're using windows, you should consider using the [GUI version], it lets you save the configuration into a file, but if you want to use the CLI version, type this in the command prompt:
KAG autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm

Download Maqq's Server Config Tool