Difference between revisions of "Server"

From King Arthur's Gold Wiki
Jump to: navigation, search
(Minor addition to avoid suspicion.)
m
 
(121 intermediate revisions by 17 users not shown)
Line 1: Line 1:
 
{{Build
 
{{Build
|Version = 371
+
|Version = 2536
 
}}
 
}}
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.
+
<p>This page is for the set up of the default Beta KAG Server and then configuring it. For minimum requirements, installation, managing stability and configuration this is the right page.</p>
 +
=Server Requirements=
 +
The King Arthur's Gold Beta 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.'''
 
'''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=
+
==Residential Connections==
*All servers are added to the official server list to be seen by anybody who chooses the "Pick a Server" option in-game.
+
<p>For those hosting on residential internet connections:</p>
*Servers can be remotely controlled in game by anybody with the server's Remote Control (RCON) password.
+
* Make sure that your computer has at least the above specifications.
*Servers can be password protected. (This is separate from the RCON password.)
+
*Keep in mind that many ISPs forbid running any kind of server, including a KAG server, they may block certain ports and dynamically assign IP addresses.
=Requirements=
+
 
==Hardware==
+
==Dedicated Servers==
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===
==Software==
+
*The KAG server can run on almost all OS.
The KAG server can run on Linux, Windows, or Mac. The recommended operating system is Linux, specifically Debian.
+
*To run a KAG server on Linux you must have the latest version of your distro but Debian 6 is supported too (maybe more, to be tested).
==Network==
+
*The recommended operating system is Linux, specifically Ubuntu or Debian.
<p>The KAG server isn't designed to work on computers without an Internet connection. It is, however, [https://forum.kag2d.com/index.php?threads/lan-no-internet-server.4135/ still possible] to run it without one.</p>
+
 
<p>The KAG server uses three ports:
+
===Lowest Hardware===
 +
*RAM: At least 128MB
 +
*CPU: At least 1 core clocked @ 1Ghz
 +
===Recommended Hardware===
 +
*RAM: 512MB
 +
*CPU: 1 cores clocked @ 2Ghz
 +
 
 +
===Network===
 +
*Internet Connection speed per player scales with the number of players:
 +
*Upload to each player: (number of players - 1) * 0.3 kb/s
 +
*Download from each player: 0.5kb/s
 +
===Ports===
 +
*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 in UDP.
 
{|border="1" cellpadding="5" cellspacing="0"  
 
{|border="1" cellpadding="5" cellspacing="0"  
 
|-
 
|-
Line 24: Line 38:
 
! scope="col" style="background:#efefef;" | Firewall Tolerant?
 
! scope="col" style="background:#efefef;" | Firewall Tolerant?
 
|-
 
|-
! scope="row" style="background:#efefef;" | 50301
+
! scope="row" style="background:#efefef;" | 50301/udp
|Used to listen for connections.
+
|Used to listen for game connections.
 +
!scope="row" style="background:#31E831;"|yes
 +
!scope="row" style="background:#E83131;"|no
 +
|-
 +
! scope="row" style="background:#efefef;" | 50301/tcp
 +
|Used to listen for [[Remote Administration|remote admin (tcp rcon)]] connections.
 
!scope="row" style="background:#31E831;"|yes
 
!scope="row" style="background:#31E831;"|yes
 
!scope="row" style="background:#E83131;"|no
 
!scope="row" style="background:#E83131;"|no
 
|-
 
|-
! scope="row" style="background:#efefef;" | 50328
+
! scope="row" style="background:#efefef;" | 50328/udp
 
|Used to communicate with clients.
 
|Used to communicate with clients.
 
!scope="row" style="background:#31E831;"|yes
 
!scope="row" style="background:#31E831;"|yes
 
!scope="row" style="background:#31E831;"|yes
 
!scope="row" style="background:#31E831;"|yes
 
|-
 
|-
! scope="row" style="background:#efefef;" | 51308
+
! scope="row" style="background:#efefef;" | 80/tcp
|Used to communicate with the master server.
+
|Used for autoupdates
 +
!scope="row" style="background:#E83131;"|no
 +
!scope="row" style="background:#31E831;"|yes
 +
|-
 +
! scope="row" style="background:#efefef;" | 443/tcp
 +
|Used for API (server list, auth, minimaps, etc) server communication
 
!scope="row" style="background:#E83131;"|no
 
!scope="row" style="background:#E83131;"|no
 
!scope="row" style="background:#31E831;"|yes
 
!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 in UDP.</p><p>
 
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.</p>
 
===Hosting on Residential Connections===
 
<p>For those hosting on residential internet connections, keep in mind that many ISPs forbid running any kind of server, including a KAG server. To complicate hosting a server, they may block certain ports and dynamically assign IP addresses.
 
*It is highly unlikely that they would block the ports used by the KAG server. (A local router's firewall is most likely the culprit for connectivity issues when hosting on a residential connection.)
 
*[http://ip4.me This] site displays the IP address of the current visitor. It can be used to determine the currently assigned public IP address.</p>
 
  
 
=Installation=
 
=Installation=
==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>
+
==Linux Install==
<p>
+
===Basic Install===
# First, download the server: <br /> <pre>wget http://kag2d.com/en/download/kag_linux.tar.gz</pre>
+
<p>This guide is written for Debian based distributions.
# Next, decompress the archive. <br /> <pre>tar -zxf kag_linux.tar.gz</pre>
+
<br>'''If your OS is 64-bit start here.'''
# Change to the new directory: <br /> <pre>cd kag_linux</pre>
+
<br>For OS that support multiarch (For Ubuntu it's 12.04 or newer):
# [[Server#Configuration|Configure]] your server.
+
#Check your foreign architectures:<syntaxhighlight lang="bash" enclose="div">sudo dpkg --print-foreign-architectures</syntaxhighlight>  
# Run your server: <br /> <pre>./KAGdedi</pre><br />To connect, either find it in the server list or connect directly using the IPaddress:PortNumber format. (The default port is 50301.) Note that domain names will not work in place of the IP address.
+
#If i386 is not present:<syntaxhighlight lang="bash" enclose="div">sudo dpkg --add-architecture i386</syntaxhighlight>
 +
#Update your package list:<syntaxhighlight lang="bash" enclose="div">sudo apt-get update</syntaxhighlight>
 +
#Install 32-bit libraries required for KAG:<syntaxhighlight lang="bash" enclose="div">sudo apt-get install libc6:i386 libstdc++6:i386 libglapi-mesa:i386 libgl1-mesa-glx:i386 libxxf86vm1:i386 libxext6:i386 libx11-6:i386 libfreetype6:i386 libgcc1-dbg:i386 libxdamage1:i386 libxfixes3:i386 libx11-xcb1:i386 libxcb-glx0:i386 libxcb-dri2-0:i386 libxcb1:i386  libdrm2:i386 libxdmcp6:i386</syntaxhighlight>
 +
For OS that do not support multiarch:
 +
#Install 32-bit Libraries:<syntaxhighlight lang="bash" enclose="div">sudo apt-get install ia32-libs</syntaxhighlight>
 +
'''If your OS is 32-bit start here.'''
 +
# Download the server: <br /> <syntaxhighlight lang="bash" enclose="div">wget http://dl.kag2d.com/kag-linux32-dedicated-release.tar.gz</syntaxhighlight>
 +
# Next, decompress the archive: <br /> <syntaxhighlight lang="bash" enclose="div">tar -zxf kagbeta-linux32-dedicated.tar.gz</syntaxhighlight>
 +
# Change to the new directory: <br /> <syntaxhighlight lang="bash" enclose="div">cd kagbeta-linux32-dedicated</syntaxhighlight>
 +
#Allow the server to be executed: <syntaxhighlight lang="bash" enclose="div">chmod +x KAGdedi</syntaxhighlight><br />
 +
# Run your server: <br /> <syntaxhighlight lang="bash" enclose="div">./KAGdedi</syntaxhighlight><br />
 +
</p>
 +
 
 +
===Using Screen===
 +
<p>It is recommend to use Screen while hosting (multiple) servers (on a Virtual Server). Basically what screen is can be found [http://www.gnu.org/software/screen/ here]. In simple words screen is a program which lets you create multiple terminal sessions. For example, if you don't want to run all the processes on your main terminal you can easily create a 'screen' and run your server there.
 +
After you installed like stated above, ''stop'' before ./KAGdedi. This is where you don't run KAG but start the 'screen' and run it there.
 +
# First, download screen if you haven't got it: <br /> <syntaxhighlight lang="bash" enclose="div"> sudo apt-get install screen</syntaxhighlight>
 +
# Now, in you KAG server folder create a new screen: <br /> <syntaxhighlight lang="bash" enclose="div">screen -S MyScreenName</syntaxhighlight> <br />
 +
Note that the -S is a capital s and not a small one (s)! <br />
 +
# Now, start your server: <br /> <syntaxhighlight lang="bash" enclose="div">./KAGdedi</syntaxhighlight><br />
 +
Some basic screen instructions: <br />
 +
# To open a screen, for example when you shut down your terminal and you want to restart your server: <br /> <syntaxhighlight lang="bash" enclose="div">screen -x MyScreenName</syntaxhighlight> <br />
 +
# Want to stop your server: Press "ctrl+c" (general Linux command to kill a process). <br />
 +
# Want to kill the screen as you don't use/need it anymore, do this '''in''' your screen: ctrl+a+k and press Y to confirm. <br />
 +
# Want to go out of a screen/detach, do this (in your screen, of course): ctrl+a+d.
 +
<br />
 
</p>
 
</p>
  
==Windows==
+
==Windows Install==
 
<p>
 
<p>
# First, download the server: http://kag2d.com/en/download <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.
+
# First, download windows KAG at: http://kag2d.com/en/download <br />  
# Next, decompress the archive. This can be done with many different programs, including [http://peazip.sourceforge.net/ PeaZip].
+
# Install
# Open the folder the archive was extracted into.
+
# Run your server by executing <code>dedicatedserver.bat</code>.<br />
# [[Server#Configuration|Configure]] your server.
+
# Run your server by clicking <code>dedicatedserver.bat</code>.<br />To connect, either find it in the server list or connect directly using the IPaddress:PortNumber format. (The default port is 50301.) Domain names will not work in place of the IP address.
+
 
</p>
 
</p>
  
==Mac==
+
==Port Forwarding==
Due to their similarities, the installation instructions for Linux should apply for Macs.
+
===Router===
 +
<p>As said before KAG Servers require various ports to be open for it to run properly. If you are using a router, it most likely has its own firewall. Unfortunately since there are many router manufacturers, its almost impossible for a universal guide that would offer step-by-step instructions on how to set up these 'port forwards'. Please consult your router manufacturer's website for more precise information on how to accomplish this.</p>
 +
===Windows Firewall===
 +
<p>If you are running a Windows OS this is most likely active on your computer blocking certain ports . The following steps were done on a Windows 7 computer but other Windows OS should be nearly identical.
 +
#Go to Control Panel and open the Security and Security tab.
 +
#Click on "Windows Firewall".
 +
#Click on "Advanced settings" on the left hand side column.
 +
#Right click on the "Inbound Rules" button, in the left hand side column, and select "New Rule..."
 +
#Select "Port" and click "Next".
 +
#Type in the port you wish to allow (they are found above) and click "Next".
 +
#Select "Allow this connection and click "Next"
 +
#(Recommended) Select "Domain", "Private" and "Public"
 +
#Type in a Name and click "Finish.
 +
#Repeat steps 4-9 for all the ports
 +
===Mac Firewall===
 +
#Download Portmap: http://www.macupdate.com/app/mac/27342/port-map/
 +
#Next, decompress the archive. This can be done with many different programs, including [http://peazip.sourceforge.net/ PeaZip].
 +
#Launch Portmap.
 +
#Open the required ports.
 +
===Antivirus Firewall===
 +
Like Windows Firewall, if you have an antivirus it most always has a firewall. Unfortunately since there are many antivirus products on the market, its almost impossible for a universal guide that would offer step-by-step instructions on how to set up these 'port forwards'. Please consult your antivirus brand's website for more precise information on how to accomplish this.</p>
 +
 
 
=Configuration=
 
=Configuration=
<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>
+
<p>The KAG server is configured using text files.  Customizing a KAG server installation involves modifying the variables in these files. Most of the key variables, such as player amount, ports used to connect, IP or weather or not guards (see below) can moderate the server are found in the autoconfig.cfg file, stored in KAG/autoconfig.cfg</p>
 +
 
 +
==autoconfig.cfg==
 +
 
 +
 
 +
Key variables in autoconfig.cfg
 +
 
 +
 
 +
<syntaxhighlight lang="ini" enclose="div">
 +
 
 +
sv_gamemode = TDM                                                        # The gamemode launched on start of dedicated server. This is the DIRECTORY name under Base/Rules!
 +
 
 +
sv_mapcycle =                                                            # The default map cycle loaded on server start. See Base/Maps/mapcycle.cfg.example for an example. Leave blank if you want Rules to                                           load their own cycle.
 +
 
 +
sv_gravity = 9.81                                                        # Sets the global physics gravity.
 +
 
 +
sv_canpause = 1                                                          # Determines whether the server can pause and sleep while there are no players to save CPU load.
 +
 
 +
sv_test = 0                                                              # This determines if the server is in development testing mode. For usage in scripts.
 +
 
 +
sv_restart_on_update = 1                                                # The server closes and restarts itself if KAG update is detected - only done on map changes.
 +
 
 +
v_showminimap = 1                                                        # Show minimap or not. Might solve performance issues.
 +
 
 +
security_whitelist_active = 0                                            # Set to 1 to allow only the names in the whitelist or 0 to disallow the names in the blacklist
 +
 
 +
security_whitelist = ../Security/whitelist.cfg                          # The file with the whitelist config
 +
 
 +
security_blacklist = ../Security/blacklist.cfg                          # The file with the blacklist config
 +
 
 +
security_ignorelist = ../Security/ignorelist.cfg                        # The file with the ignorelist config
 +
 
 +
security_seclevs = ../Security/seclevs.cfg                              # The file with the seclev config
 +
 
 +
sv_maxplayers = 16                                                      # Maximum number of players allowed ingame. These slots are included as spectator slots.
 +
 
 +
sv_enable_joinfull = 1                                                  # If set to 1 then privileged users (join_full seclev feature) may join the server when full.
 +
 
 +
sv_reservedslots = 0                                                    # Number of reserved slots (additional slots on top of the max, accessible only to privileged players).
 +
 
 +
sv_register = 1                                                          # Whether or not to register this server with the master list.  You likely only want this set to 0 if this is a firewalled private server.
 +
 
 +
sv_port = 50301                                                          # Server communication port, this is where it listens for incoming clients. Remember to open this port in your firewall.
 +
 
 +
cl_port = 50328                                                          # Client communication port.
 +
 
 +
sv_password =                                                            # Sets the server password.
 +
 
 +
sv_rconpassword =                                                        # Sets the server remote console password.
 +
 
 +
disable_seclevoutput = 1                                                # If set to 1 then loading seclevs will not print them out.
 +
 
 +
sv_allow_globals_mods = 1                                                # If set to 1 global KAG moderators and admins can kick/ban players on server.
 +
 
 +
sv_compression = 1                                                      # Compress network data or not. Disabling compression may improve performance. DO NOT change this while running the server!
 +
 
 +
sv_maxping = 450                                                        # Max ping allowed on server after which player is kicked. Large ping players will slow down server.
 +
 
 +
sv_maxping_warnings = 600                                                # Because of ping spikes, warnings are issued if a player has ping over max number.
 +
 
 +
sv_maxhack_warnings = 25                                                # Maximum amount of warnings where server thinks player is hacking.
 +
 
 +
sv_name = KAG Server                                                    # Sets the server name displayed in server browser.
 +
 
 +
sv_info = Server Description                                            # Sets the server info displayed in server browser.
 +
 
 +
sv_global_bans = 0                                                      # Determines whether the server uses the KAG accounts global ban data.
 +
 
 +
u_shownames = 0                                                          # Show team member names above head
 +
 
 +
c_write_console_to_disk = 1                                              # Whether or not to write the console log out to disk. (The file will still be created and some data written, but it will stop ASAP.)
 +
 
 +
c_write_chat_to_disk = 1                                                # Whether or not to write the chat log out to disk.
 +
 
 +
</syntaxhighlight>
 +
 
 +
==Setting the Server name and description==
 +
 
 +
Setting a name for your server is easy, simply open up KAGServ/autoconfig.cfg and you will find the variables; sv_name and sv_info; to set the name simply enter your desired name after sv_name = %the_name_of_your_server% and for the description (the information in the side panel when selecting a server in game) edit sv_info = %Your_server_description_here%
 +
 
 +
==Enabling or disabling Global moderation AKA; "Royal Guards"==
 +
 
 
<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 ([https://forum.kag2d.com/index.php?threads/in-game-moderators-aka-royal-guard-updated-25-12-2011.1128/ In-game moderators (AKA Royal Guard)] & [https://forum.kag2d.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>
 
<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 ([https://forum.kag2d.com/index.php?threads/in-game-moderators-aka-royal-guard-updated-25-12-2011.1128/ In-game moderators (AKA Royal Guard)] & [https://forum.kag2d.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>
<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 autoconfig.cfg and in your security levels.</p>
  
<font size=2><pre>
+
The variable used to allow/disallow guards is:
global sv_allow_globals_mods = 0;
+
</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===
+
  
<p>Of the many modifiable variables, these are some of the most important:
+
<syntaxhighlight lang="ini" enclose="div">
+
sv_allow_globals_mods = 1                                               # If set to 1 global KAG moderators and admins can kick/ban players on server.
<pre>
+
</syntaxhighlight>
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.
+
</pre></p>
+
  
===dedicated_autostart.gm===
+
==Setting the server gametype==
  
<p><pre>
+
The variable to set the server gametype is found inside autconfig.cfg
// autostart on dedicated server launch
+
  
 +
<syntaxhighlight lang="ini" enclose="div">
  
//set autostartswitch to:
+
sv_gamemode = TDM                                                       # The gamemode launched on start of dedicated server. This is the DIRECTORY name under Base/Rules!
// 0 for CTF
+
// 1 for TDM
+
// 2 for Sandbox
+
// 3 for Zombies
+
// 4 for RTDM
+
// 10 for TEST
+
  
global autostartswitch = 0;
+
</syntaxhighlight>
  
newWorld( "" );
+
The variable is the name of the location of of a gamemode file; usually stored in KAGServ/Base/Rules but can be pointed elsewhere, such as ../Mods/my_game_type/. In the example above, we are pointing to KAGserv/Base/Rules/TDM/ so that we load the Team Death Match game type.
switchGameState(0);
+
  
startServer();
 
  
if (autostartswitch == 0) //ctf
+
==Setting a mapcycle==
{
+
LoadRules("Rules/CTF/gamemode.cfg");
+
LoadMapCycle( "Scripts/mapcycle.cfg" );
+
LoadMap( "" );
+
print(`Loaded CTF default config`);
+
}
+
else if (autostartswitch == 1) //tdm
+
{
+
LoadRules("Rules/TDM/gamemode.cfg");
+
LoadMapCycle( "Scripts/mapcycle.cfg" );
+
LoadMap( "" );
+
print(`Loaded TDM default config`);
+
}
+
else if (autostartswitch == 2) //sandbox
+
{
+
LoadRules("Rules/Sandbox/gamemode.cfg");
+
LoadMapCycle( "Scripts/mapcycle.cfg" );
+
LoadMap( "" );
+
print(`Loaded TDM default config`);
+
}
+
else if (autostartswitch == 3) //zombies (GOLD ONLY)
+
{
+
LoadRules("Rules/Zombie_Survival/gamemode.cfg");
+
LoadMapCycle( "Rules/Zombie_Survival/ZombieMapCycle.cfg" );
+
LoadMap( "" );
+
+
print(`Loaded zombies default config : server now in GOLD MODE`);
+
} else if (autostartswitch == 4) //rtdm
+
{
+
LoadRules("Rules/RTDM/gamemode.cfg");
+
LoadMapCycle( "Rules/RTDM/RTDMMapCycle.cfg" );
+
LoadMap( "" );
+
print(`Loaded RTDM default config`);
+
}else
+
if (autostartswitch == 10) //test
+
{
+
LoadRules("Rules/TEST/gamemode.cfg");
+
LoadMapCycle( "Scripts/mapcycle.cfg" );
+
LoadMap( "" );
+
print(`Loaded TEST default config`);
+
}
+
  
print(`Config finished loading from Scripts/Server/dedicated_autostart.gm`);
+
A mapcycle is essentially a list of maps that your server will put on rotation; you can point to your mapcycle.cfg file using this variable inside your autoconfig.cfg
  
</pre>
+
<syntaxhighlight lang="ini" enclose="div">
 +
sv_mapcycle =  Base/Maps/mapcycle.cfg                                                          # The default map cycle loaded on server start...
 +
</syntaxhighlight>
  
This file is very important. If you want to change rules for your server then you have to edit the global autostartswitch variable. <br />
+
Example mapcycle.cfg:
For an individual Rule there is the the number 10. If you want to make a Zombie Survival Server or any modded Server you need to make your server for Gold users only ( see dedicated_autoconfig.gm)</p>
+
  
===mapcycle.cfg===
+
<syntaxhighlight lang="ini" enclose="div">
  
<p><pre>
+
# KAG mapcycle;
#KAG mapcycle;
+
# used when defined in variable sv_mapcycle - see autoconfig.cfg for details
# put map generator files, png files here, or script files
+
# loads .PNG, .KAG and .AS files
# eg. mapcycle = Maps/example1.png; Maps/example2.png; Maps/generator_flat.cfg; Maps/swordfight.gm;
+
  
mapcycle = Maps/generator_ctf_mountain.cfg;
+
mapcycle = Maps/WARDraft.png; Maps/Custom.kag; ../Mods/My/mymap_script.as
</pre>
+
  
You must separate paths to files with semicolons. Allowed files are generators, script files and maps in png format.</p>
+
</syntaxhighlight>
  
===*-generator.cfg===
+
In this example, every line that beings with # denotes a comment, or a line that will not be read by KAG.  
<p>Generators use [http://libnoise.sourceforge.net/tutorials/tutorial4.html  "libnoise"-library].</p>
+
Each map is separated by a semi colon ';'.
 +
If this option is not set in autoconfig.cfg, then KAG will simply load the ones as part of the rules of the gametype you have chosen to run on your server.
  
==Maqq's Server Configuration Tool==
+
==Day/Night Cycle in gamemodes other than Take the Halls==
<p>Maqq's command-line interface server configuration tool provides an interactive way of setting up a server:</p>
+
<p>To enable day and night, simply open up the gamemode.cfg file, located Kagserv/Base/Rules/%your_game_mode_choice%/ and change the variables: </p>
<p>
+
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 <code>chmod +x sconfig.py</code> and run with  <code>./sconfig.py</code> . Daemonisation tools applicable to dedicatedserver.sh (''screen, tmux, nohup'' etc) still useable with this program</p>
+
===Reusing Generated Configs===
+
<p>These commands reuse the generated configuration files:[https://forum.kag2d.com/index.php?threads/maqqs-cli-server-configuration-tool.3121/#post-67046 ]</p>
+
<p>
+
*If you're using linux, type this in the console:
+
<pre>./KAGdedi autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm</pre>
+
  
*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:
+
<syntaxhighlight lang="ini" enclose="div">
<pre>KAG autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm</pre>
+
daycycle_speed                    = 0 # 1 day = X minutes; / 0 no cycle
</p>
+
daycycle_start                    = 0.5        # 0.0 midnight; 0.5 - midday; 1.0 midnight
 +
</syntaxhighlight>
  
===Download Maqq's Server Config Tool===
+
==Remote Control==
<p>
+
<p>A server can be controlled in-game. While connected to the server, press the HOME key to open the console. A full list of available rcon commands can be found [[Commands|here]]. In order to remote control a server however you must be set as an administrator in the servers configuration files. The system KAG uses for this is found bellow.
*Windows (GUI): http://dl.dropbox.com/u/51067730/kag/KAGServer.exe
+
You are also able to remotely control your server when you've set sv_tcpr to 1. More info at [[Remote_Administration|Remote Administration]]</p>
*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</p>
+
  
=Remote Control=
+
===Linux===
<p>A server can be controlled in-game. While connected to the server, press the HOME key to open the console. Typing "/rcon password", where password is the RCON password set by sv_rconpassword, will allow the current user to send commands to the server. These commands must be prefixed by "/rcon". For example, to use the /list command, type. "/rcon /list".</p>
+
<p>*Coming soon*</p>
==Remote Server Commands==
+
<p>
+
\list - list all commands and variables<br />
+
\kick [playername] [minutes]<br />
+
\kickid [id] [minutes]<br />
+
\kickhost [host] [minutes] - kicks and/or bans host (host number can be found in logs when player joins)<br />
+
\unbanhost [host] \unban; \unbanhost; \unbanhid commands<br />
+
\swapid [player id] - swaps the players team<br />
+
\players<br />
+
\restartmap<br />
+
\loadmap [name]<br />
+
\savemap [name]<br />
+
\msg [text]<br />
+
\rcon [password]<br />
+
addBotX - addBotX( team, class, name ); eg. addBotX( 1, 0, `St. John` );<br />
+
</p>
+
=Blacklisting & Whitelisting=
+
<p>A player blacklists is the list of players who are not allowed to play on a given server. A whitelist is the inverse of a blacklist; if enabled, only those on the whitelist will be allowed to play.</p>
+
==How to Create a Blacklist or Whitelist==
+
<p>Create the following file and save it as <code>securitysetup.cfg</code> in <code>kagServer/Base/Scripts</code>, where kagServer is the path to the kagServer's directory.</p>
+
<pre>
+
# security setup
+
# set this to 1 to allow only the names in whitelist
+
  
whitelist_active = 0;
+
===Windows===
whitelist = names; go; here;
+
<p>A tool was created by ardivaba, that allows for remote connection for windows pc. The tool can be downloaded here. You need to make sure the server has sv_tcpr set to 1, and you know the rcon password.</p>
 +
[https://forum.thd.vg/threads/remote-administration-tcp-rcon.9926/#post-160324/ Windows remote tool]
  
#blacklist format: name; IP; expiration time and date h:m:s:d:M:y; reason;
+
==[[Security Levels]]==
# IP of 0 means no IP is banned, and the user is just banned by username.
+
{{:Security_Levels}}
# Username of 0.0.0.0 means no IP is banned for that entry
+
# The time is in C++ struct tm format except for the year, which is human readable.
+
# eg: 10:30:0:31:11:2050 is 10:30 AM on the 31st of December 2050AD
+
  
blacklist = name1; 0.0.0.0; 10:30:0:31:11:2050; Banned;
+
[[Security_Levels|''Read more...'']]
name2; 12.34.45.78; 10:30:0:31:11:2050; Banned;
+
  
</pre>
+
==Blacklisting & Whitelisting==
<p>Note: The whitelist overrides the blacklist.</p>
+
<p>A player blacklists is the list of players who are not allowed to play on a given server. A whitelist is the inverse of a blacklist; if enabled, only those on the whitelist will be allowed to play.</p>
 +
<p>The security contents of the file <code>autoconfig.cfg</code> should look something like this:</p>
 +
<syntaxhighlight lang="ini" enclose="div">
 +
security_whitelist_active = 0  # Set to 1 to allow only the names in the whitelist or 0 to disallow the names in the blacklist
 +
security_whitelist = ../Security/whitelist.cfg # The file with the whitelist config
 +
security_blacklist = ../Security/blacklist.cfg # The file with the blacklist config
 +
security_ignorelist = ../Security/ignorelist.cfg # The file with the ignorelist config
 +
security_seclevs = ../Security/seclevs.cfg # The file with the seclev config
 +
</syntaxhighlight>
 +
<p>Note: The whitelist overrides the blacklist if enabled.</p>
 +
 
 +
===Whitelist===
 +
<p>If you are using the whitelist, then at the path specified in whitelist_file you can create a file that looks something like this:</p>
 +
<syntaxhighlight lang="ini" enclose="div">
 +
# Whitelist format: name; anothername; yetanothername;
 +
whitelist =
 +
name;
 +
anothername;
 +
yetanothername;
 +
</syntaxhighlight>
 +
<p>Simply add usernames in this way to allow only those players access to the server.</p>
 +
 
 +
===Blacklist===
 +
<p>If you are using the blacklist, then at the path specified in blacklist_file you can create a file that looks something like this:</p>
 +
<syntaxhighlight lang="ini" enclose="div">
 +
# Blacklist format: name; IP; expiration time and date h:m:s:d:M:y; reason;
 +
# IP of 0.0.0.0 means no IP is banned, and the user is just banned by username.
 +
# Blank username means no user is banned for that entry and it's just by IP.
 +
# The time is in C++ struct tm format except for the year, which is human readable. Get relative times from /listbans on the console.
 +
# eg: 10:30:0:31:11:2050 is 10:30 AM on the 31st of December 2050AD
 +
 
 +
blacklist =
 +
name1; 0.0.0.0; 10:30:0:31:11:2050; Banned;
 +
name2; 12.34.45.78; 10:30:0:31:11:2050; Banned;
 +
</syntaxhighlight>
 +
<p>Simply add player details in the format described to ban them from the server. Alternatively, just use the ban menus or rcon commands in game to ban users.
 +
Note that January is the 0th month</p>
  
 
=Managing Instability=
 
=Managing Instability=
<p>As Alpha software frequently is, the KAG server is very unstable. Recent builds have been especially prone to crashing whenever left running for more than 24 hours (build 360+ has been much more stable, but it varies from release to release due to new features mixed with bug fixes). As such, it is recommended practice run the server in a keepalive script, which will restart it whenever it crashes. (In addition, many people restart their server once a day, during the hours of least usage, to help decrease the risk of a crash while the server is being played upon.)</p>
+
<p>As Alpha software, the KAG server in certain builds is very unstable. Build are sometimes crash prone but it varies from release to release due to new features mixed with bug fixes. As such, it is recommended practice to run the server in a keepalive script, which will restart it whenever it crashes. In addition, many people restart their server once a day, during the hours of least usage, to help decrease the risk of a crash while the server is being played upon.</p>
==Trelawney's Keepalive Script for Linux==
+
==Keep-alive Scripts==
<p>This script, <code>dedi.sh</code>, will restart the KAG server 5 seconds after it crashes. Download it [http://dl.dropbox.com/u/23114384/files/dedi.sh here].<br />
+
===Linux/Mac===
 +
<p>Trelawney's Keepalive Script, <code>dedi.sh</code>, will restart the KAG server 5 seconds after it crashes. Download it [http://dl.dropbox.com/u/23114384/files/dedi.sh here].<br />
 
If retyping/using copy and paste, make sure word wrapping is turned off in you text editor. (In nano, use <code> nano -w dedi.sh </code>.)<br />
 
If retyping/using copy and paste, make sure word wrapping is turned off in you text editor. (In nano, use <code> nano -w dedi.sh </code>.)<br />
 
Once created, be sure to make the script executable with <code>chmod +x dedi.sh</code>.</p>
 
Once created, be sure to make the script executable with <code>chmod +x dedi.sh</code>.</p>
<pre>
+
<syntaxhighlight lang="ini" enclose="div">
 
#!/bin/bash
 
#!/bin/bash
 
echo "Running KAG dedicated server"
 
echo "Running KAG dedicated server"
Line 267: Line 335:
 
mv KAGdedi.tmp KAGdedi
 
mv KAGdedi.tmp KAGdedi
 
chmod +x KAGdedi
 
chmod +x KAGdedi
until ./KAGdedi nolauncher autostart Scripts/dedicated_autostart.gm autoconfig Scripts/dedicated_autoconfig.gm; do
+
until ./KAGdedi nolauncher autostart Scripts/server_autostart.as autoconfig ../autoconfig.cfg; do
 
         echo "KAG server running"
 
         echo "KAG server running"
 
         sleep 5
 
         sleep 5
 
done
 
done
</pre>
+
</syntaxhighlight>
<p>To use, run the script: <code>./dedi.sh</code></p>
+
<p>To use, run the script: <code>./dedi.sh</code> instead of the usual <code>./KAGdedi</code></p>
===Adapting for Maqq's Configuration Tool===
+
===Windows===
<p>To use a configuration generated by Maqq's Configuration Tool, replace line 6 in the above script with:
+
<p>The Beaz's Keepalive Script, <code>dedi.bat</code>, will restart the KAG server 5 seconds after it crashes. To use, create a text file, paste/type in the script below, and save it as <code>dedi.bat</code>.</p>
<pre>
+
<syntaxhighlight lang="vb" enclose="div">
./KAGdedi autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm
+
</pre>
+
</p>
+
 
+
==The Beaz's Keepalive Script for Windows==
+
<p>This script, <code>dedi.bat</code>, will restart the KAG server 5 seconds after it crashes. To use, create a text file, paste/type in the script below, and save it as <code>dedi.bat</code>.</p>
+
<pre>
+
 
@ECHO off
 
@ECHO off
 
   
 
   
Line 288: Line 349:
 
echo (%time%) Server Started - close this window to prevent restart.
 
echo (%time%) Server Started - close this window to prevent restart.
 
   
 
   
start /wait KAG.exe nolauncher autostart Scripts/dedicated_autostart.gm autoconfig Scripts/dedicated_autoconfig.gm
+
start /wait KAG.exe nolauncher autostart Scripts/server_autostart.as autoconfig autoconfig.cfg
 
   
 
   
 
echo (%time%) WARNING: Server closed or crashed, restarting.
 
echo (%time%) WARNING: Server closed or crashed, restarting.
 
   
 
   
 
goto restart
 
goto restart
</pre>
+
</syntaxhighlight>
===Adapting for Maqq's Configuration Tool===
+
<p>To make it work on Windows Vista or 7 you need to disable Windows Error Reporting. To do so:
<p>To use a configuration generated by Maqq's Configuration Tool, replace line 6 in the above script with:  
+
*Run regedit.exe  
<pre>
+
*Modify HKCU\Software\Microsoft\Windows\Windows Error Reporting\DontShowUI entry with value 1</p>
start /wait KAG.exe nolauncher autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm
+
 
</pre>
+
</p>
+
 
==Daily Server Restarts==
 
==Daily Server Restarts==
<p>If a KAG server is running in a keepalive script, a scheduled task/cronjob that kills the server once a day is, effectively, a daily restart because the keepalive script will automatically restart the server.</p>
+
<p>If a KAG server is running in a keepalive script, a scheduled task that kills the server once a day is, effectively, a daily restart because the keepalive script will automatically restart the server.</p>
===For Linux - Cronjob===
+
===Linux/Mac - Cronjob===
 
<p>This script will kill all instances of KAGdedi at 3 AM.</p>
 
<p>This script will kill all instances of KAGdedi at 3 AM.</p>
 
<p>
 
<p>
 
# Use <code>crontab -e</code> to create a new cronjob. This will open your default text editor.
 
# Use <code>crontab -e</code> to create a new cronjob. This will open your default text editor.
# In the text editor, type:<pre>0 3 * * * pkill -1 KAGdedi</pre>
+
# In the text editor, type:<syntaxhighlight lang="bash" enclose="div">0 3 * * * pkill -1 KAGdedi</syntaxhighlight>
# Close editor. Cronjob installed!
+
# Close editor. Cronjob installed!</p>
</p>
+
===Windows - Task Scheduler===
 
+
"Needs info"
=Checking for Updates=
+
 
+
So far there is not a public script to restart a server when an update is available, but the following logic should be able to be combined with a restart script above to restart a server once an update is available.
+
 
+
<pre>nova-dhcp-host111:~ ryan$ curl -s http://update.kag2d.com/kag_linux/App/version.txt | head -n1 | cut -d ' ' -f2
+
1337154874-636-6e12e0f833b0
+
nova-dhcp-host111:~ ryan$</pre>
+
 
+
When that string (the 2nd whitespace-delimited element of the first line of that URL) changes, an update is available.  The first number is the unix timestamp of the build, the 2nd is the code revision, the 3rd is a hex identifier used internally by the developers.  You should be able to just monitor for a change.  You could also use logic involving watching the first two parts of the string to see if they increment, but the format of this string may change in the future -- tl;dr: it is best to just watch if the string changes, don't try to parse it.
+

Latest revision as of 19:33, 20 April 2018

This page is in line with the latest build 2536.

This page is for the set up of the default Beta KAG Server and then configuring it. For minimum requirements, installation, managing stability and configuration this is the right page.

Server Requirements

The King Arthur's Gold Beta 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.

Residential Connections

For those hosting on residential internet connections:

  • Make sure that your computer has at least the above specifications.
  • Keep in mind that many ISPs forbid running any kind of server, including a KAG server, they may block certain ports and dynamically assign IP addresses.

Dedicated Servers

Software

  • The KAG server can run on almost all OS.
  • To run a KAG server on Linux you must have the latest version of your distro but Debian 6 is supported too (maybe more, to be tested).
  • The recommended operating system is Linux, specifically Ubuntu or Debian.

Lowest Hardware

  • RAM: At least 128MB
  • CPU: At least 1 core clocked @ 1Ghz

Recommended Hardware

  • RAM: 512MB
  • CPU: 1 cores clocked @ 2Ghz

Network

  • Internet Connection speed per player scales with the number of players:
  • Upload to each player: (number of players - 1) * 0.3 kb/s
  • Download from each player: 0.5kb/s

Ports

  • 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 in UDP.
Description Modifiable? Firewall Tolerant?
50301/udp Used to listen for game connections. yes no
50301/tcp Used to listen for remote admin (tcp rcon) connections. yes no
50328/udp Used to communicate with clients. yes yes
80/tcp Used for autoupdates no yes
443/tcp Used for API (server list, auth, minimaps, etc) server communication no yes

Installation

Linux Install

Basic Install

This guide is written for Debian based distributions.
If your OS is 64-bit start here.
For OS that support multiarch (For Ubuntu it's 12.04 or newer):

  1. Check your foreign architectures:
    sudo dpkg --print-foreign-architectures
  2. If i386 is not present:
    sudo dpkg --add-architecture i386
  3. Update your package list:
    sudo apt-get update
  4. Install 32-bit libraries required for KAG:
    sudo apt-get install libc6:i386 libstdc++6:i386 libglapi-mesa:i386 libgl1-mesa-glx:i386 libxxf86vm1:i386 libxext6:i386 libx11-6:i386 libfreetype6:i386 libgcc1-dbg:i386 libxdamage1:i386 libxfixes3:i386 libx11-xcb1:i386 libxcb-glx0:i386 libxcb-dri2-0:i386 libxcb1:i386  libdrm2:i386 libxdmcp6:i386
For OS that do not support multiarch:
  1. Install 32-bit Libraries:
    sudo apt-get install ia32-libs
If your OS is 32-bit start here.
  1. Download the server:
    wget http://dl.kag2d.com/kag-linux32-dedicated-release.tar.gz
  2. Next, decompress the archive:
    tar -zxf kagbeta-linux32-dedicated.tar.gz
  3. Change to the new directory:
    cd kagbeta-linux32-dedicated
  4. Allow the server to be executed:
    chmod +x KAGdedi

  5. Run your server:
    ./KAGdedi

Using Screen

It is recommend to use Screen while hosting (multiple) servers (on a Virtual Server). Basically what screen is can be found here. In simple words screen is a program which lets you create multiple terminal sessions. For example, if you don't want to run all the processes on your main terminal you can easily create a 'screen' and run your server there. After you installed like stated above, stop before ./KAGdedi. This is where you don't run KAG but start the 'screen' and run it there.

  1. First, download screen if you haven't got it:
     sudo apt-get install screen
  2. Now, in you KAG server folder create a new screen:
    screen -S MyScreenName

Note that the -S is a capital s and not a small one (s)!
  1. Now, start your server:
    ./KAGdedi

Some basic screen instructions:
  1. To open a screen, for example when you shut down your terminal and you want to restart your server:
    screen -x MyScreenName

  2. Want to stop your server: Press "ctrl+c" (general Linux command to kill a process).
  3. Want to kill the screen as you don't use/need it anymore, do this in your screen: ctrl+a+k and press Y to confirm.
  4. Want to go out of a screen/detach, do this (in your screen, of course): ctrl+a+d.

Windows Install

  1. First, download windows KAG at: http://kag2d.com/en/download
  2. Install
  3. Run your server by executing dedicatedserver.bat.

Port Forwarding

Router

As said before KAG Servers require various ports to be open for it to run properly. If you are using a router, it most likely has its own firewall. Unfortunately since there are many router manufacturers, its almost impossible for a universal guide that would offer step-by-step instructions on how to set up these 'port forwards'. Please consult your router manufacturer's website for more precise information on how to accomplish this.

Windows Firewall

If you are running a Windows OS this is most likely active on your computer blocking certain ports . The following steps were done on a Windows 7 computer but other Windows OS should be nearly identical.

  1. Go to Control Panel and open the Security and Security tab.
  2. Click on "Windows Firewall".
  3. Click on "Advanced settings" on the left hand side column.
  4. Right click on the "Inbound Rules" button, in the left hand side column, and select "New Rule..."
  5. Select "Port" and click "Next".
  6. Type in the port you wish to allow (they are found above) and click "Next".
  7. Select "Allow this connection and click "Next"
  8. (Recommended) Select "Domain", "Private" and "Public"
  9. Type in a Name and click "Finish.
  10. Repeat steps 4-9 for all the ports

Mac Firewall

  1. Download Portmap: http://www.macupdate.com/app/mac/27342/port-map/
  2. Next, decompress the archive. This can be done with many different programs, including PeaZip.
  3. Launch Portmap.
  4. Open the required ports.

Antivirus Firewall

Like Windows Firewall, if you have an antivirus it most always has a firewall. Unfortunately since there are many antivirus products on the market, its almost impossible for a universal guide that would offer step-by-step instructions on how to set up these 'port forwards'. Please consult your antivirus brand's website for more precise information on how to accomplish this.

Configuration

The KAG server is configured using text files. Customizing a KAG server installation involves modifying the variables in these files. Most of the key variables, such as player amount, ports used to connect, IP or weather or not guards (see below) can moderate the server are found in the autoconfig.cfg file, stored in KAG/autoconfig.cfg

autoconfig.cfg

Key variables in autoconfig.cfg


sv_gamemode = TDM                                                        # The gamemode launched on start of dedicated server. This is the DIRECTORY name under Base/Rules!

sv_mapcycle =                                                            # The default map cycle loaded on server start. See Base/Maps/mapcycle.cfg.example for an example. Leave blank if you want Rules to                                           load their own cycle.

sv_gravity = 9.81                                                        # Sets the global physics gravity.

sv_canpause = 1                                                          # Determines whether the server can pause and sleep while there are no players to save CPU load.

sv_test = 0                                                              # This determines if the server is in development testing mode. For usage in scripts.

sv_restart_on_update = 1                                                 # The server closes and restarts itself if KAG update is detected - only done on map changes.

v_showminimap = 1                                                        # Show minimap or not. Might solve performance issues.

security_whitelist_active = 0                                            # Set to 1 to allow only the names in the whitelist or 0 to disallow the names in the blacklist

security_whitelist = ../Security/whitelist.cfg                           # The file with the whitelist config

security_blacklist = ../Security/blacklist.cfg                           # The file with the blacklist config

security_ignorelist = ../Security/ignorelist.cfg                         # The file with the ignorelist config

security_seclevs = ../Security/seclevs.cfg                               # The file with the seclev config

sv_maxplayers = 16                                                       # Maximum number of players allowed ingame. These slots are included as spectator slots.

sv_enable_joinfull = 1                                                   # If set to 1 then privileged users (join_full seclev feature) may join the server when full.

sv_reservedslots = 0                                                     # Number of reserved slots (additional slots on top of the max, accessible only to privileged players).

sv_register = 1                                                          # Whether or not to register this server with the master list.  You likely only want this set to 0 if this is a firewalled private server.

sv_port = 50301                                                          # Server communication port, this is where it listens for incoming clients. Remember to open this port in your firewall.

cl_port = 50328                                                          # Client communication port.

sv_password =                                                            # Sets the server password.

sv_rconpassword =                                                        # Sets the server remote console password.

disable_seclevoutput = 1                                                 # If set to 1 then loading seclevs will not print them out.

sv_allow_globals_mods = 1                                                # If set to 1 global KAG moderators and admins can kick/ban players on server.

sv_compression = 1                                                       # Compress network data or not. Disabling compression may improve performance. DO NOT change this while running the server!

sv_maxping = 450                                                         # Max ping allowed on server after which player is kicked. Large ping players will slow down server.

sv_maxping_warnings = 600                                                # Because of ping spikes, warnings are issued if a player has ping over max number.

sv_maxhack_warnings = 25                                                 # Maximum amount of warnings where server thinks player is hacking.

sv_name = KAG Server                                                     # Sets the server name displayed in server browser.

sv_info = Server Description                                             # Sets the server info displayed in server browser.

sv_global_bans = 0                                                       # Determines whether the server uses the KAG accounts global ban data.

u_shownames = 0                                                          # Show team member names above head

c_write_console_to_disk = 1                                              # Whether or not to write the console log out to disk. (The file will still be created and some data written, but it will stop ASAP.)

c_write_chat_to_disk = 1                                                 # Whether or not to write the chat log out to disk.

Setting the Server name and description

Setting a name for your server is easy, simply open up KAGServ/autoconfig.cfg and you will find the variables; sv_name and sv_info; to set the name simply enter your desired name after sv_name = %the_name_of_your_server% and for the description (the information in the side panel when selecting a server in game) edit sv_info = %Your_server_description_here%

Enabling or disabling Global moderation AKA; "Royal Guards"

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 autoconfig.cfg and in your security levels.

The variable used to allow/disallow guards is:

sv_allow_globals_mods = 1                                                # If set to 1 global KAG moderators and admins can kick/ban players on server.

Setting the server gametype

The variable to set the server gametype is found inside autconfig.cfg

sv_gamemode = TDM                                                        # The gamemode launched on start of dedicated server. This is the DIRECTORY name under Base/Rules!

The variable is the name of the location of of a gamemode file; usually stored in KAGServ/Base/Rules but can be pointed elsewhere, such as ../Mods/my_game_type/. In the example above, we are pointing to KAGserv/Base/Rules/TDM/ so that we load the Team Death Match game type.


Setting a mapcycle

A mapcycle is essentially a list of maps that your server will put on rotation; you can point to your mapcycle.cfg file using this variable inside your autoconfig.cfg

sv_mapcycle =  Base/Maps/mapcycle.cfg                                                          # The default map cycle loaded on server start...

Example mapcycle.cfg:

# KAG mapcycle;
# used when defined in variable sv_mapcycle - see autoconfig.cfg for details
# loads .PNG, .KAG and .AS files

mapcycle = Maps/WARDraft.png; Maps/Custom.kag; ../Mods/My/mymap_script.as

In this example, every line that beings with # denotes a comment, or a line that will not be read by KAG. Each map is separated by a semi colon ';'. If this option is not set in autoconfig.cfg, then KAG will simply load the ones as part of the rules of the gametype you have chosen to run on your server.

Day/Night Cycle in gamemodes other than Take the Halls

To enable day and night, simply open up the gamemode.cfg file, located Kagserv/Base/Rules/%your_game_mode_choice%/ and change the variables:

daycycle_speed                     = 0                  # 1 day = X minutes; / 0 no cycle
daycycle_start                     = 0.5        # 0.0 midnight; 0.5 - midday; 1.0 midnight

Remote Control

A server can be controlled in-game. While connected to the server, press the HOME key to open the console. A full list of available rcon commands can be found here. In order to remote control a server however you must be set as an administrator in the servers configuration files. The system KAG uses for this is found bellow. You are also able to remotely control your server when you've set sv_tcpr to 1. More info at Remote Administration

Linux

*Coming soon*

Windows

A tool was created by ardivaba, that allows for remote connection for windows pc. The tool can be downloaded here. You need to make sure the server has sv_tcpr set to 1, and you know the rcon password.

Windows remote tool

Security Levels

King Arthur's Gold uses a system called 'Security Levels' (or 'seclevs' for short) to manage player access to various features on its servers. There are default, hardcoded levels setup but it is strongly advised that server owners take the time to setup their own specific seclev definitions.


Read more...

Blacklisting & Whitelisting

A player blacklists is the list of players who are not allowed to play on a given server. A whitelist is the inverse of a blacklist; if enabled, only those on the whitelist will be allowed to play.

The security contents of the file autoconfig.cfg should look something like this:

security_whitelist_active = 0  # Set to 1 to allow only the names in the whitelist or 0 to disallow the names in the blacklist
security_whitelist = ../Security/whitelist.cfg # The file with the whitelist config
security_blacklist = ../Security/blacklist.cfg # The file with the blacklist config
security_ignorelist = ../Security/ignorelist.cfg # The file with the ignorelist config
security_seclevs = ../Security/seclevs.cfg # The file with the seclev config

Note: The whitelist overrides the blacklist if enabled.

Whitelist

If you are using the whitelist, then at the path specified in whitelist_file you can create a file that looks something like this:

# Whitelist format: name; anothername; yetanothername;
whitelist =
name;
anothername;
yetanothername;

Simply add usernames in this way to allow only those players access to the server.

Blacklist

If you are using the blacklist, then at the path specified in blacklist_file you can create a file that looks something like this:

# Blacklist format: name; IP; expiration time and date h:m:s:d:M:y; reason;
# IP of 0.0.0.0 means no IP is banned, and the user is just banned by username.
# Blank username means no user is banned for that entry and it's just by IP.
# The time is in C++ struct tm format except for the year, which is human readable. Get relative times from /listbans on the console.
#       eg: 10:30:0:31:11:2050 is 10:30 AM on the 31st of December 2050AD

blacklist =
name1; 0.0.0.0; 10:30:0:31:11:2050; Banned;
name2; 12.34.45.78; 10:30:0:31:11:2050; Banned;

Simply add player details in the format described to ban them from the server. Alternatively, just use the ban menus or rcon commands in game to ban users. Note that January is the 0th month

Managing Instability

As Alpha software, the KAG server in certain builds is very unstable. Build are sometimes crash prone but it varies from release to release due to new features mixed with bug fixes. As such, it is recommended practice to run the server in a keepalive script, which will restart it whenever it crashes. In addition, many people restart their server once a day, during the hours of least usage, to help decrease the risk of a crash while the server is being played upon.

Keep-alive Scripts

Linux/Mac

Trelawney's Keepalive Script, dedi.sh, will restart the KAG server 5 seconds after it crashes. Download it here.
If retyping/using copy and paste, make sure word wrapping is turned off in you text editor. (In nano, use nano -w dedi.sh .)
Once created, be sure to make the script executable with chmod +x dedi.sh.

#!/bin/bash
echo "Running KAG dedicated server"
echo "TO SET IP/PORT/SLOTS/PASSWORD ADD THESE COMMAND PARAMS: ip 127.0.0.1 port 50213 slots 32 password pass123"
mv KAGdedi.tmp KAGdedi
chmod +x KAGdedi
until ./KAGdedi nolauncher autostart Scripts/server_autostart.as autoconfig ../autoconfig.cfg; do
        echo "KAG server running"
        sleep 5
done

To use, run the script: ./dedi.sh instead of the usual ./KAGdedi

Windows

The Beaz's Keepalive Script, dedi.bat, will restart the KAG server 5 seconds after it crashes. To use, create a text file, paste/type in the script below, and save it as dedi.bat.

@ECHO off
 
:restart
echo (%time%) Server Started - close this window to prevent restart.
 
start /wait KAG.exe nolauncher autostart Scripts/server_autostart.as autoconfig autoconfig.cfg
 
echo (%time%) WARNING: Server closed or crashed, restarting.
 
goto restart

To make it work on Windows Vista or 7 you need to disable Windows Error Reporting. To do so:

  • Run regedit.exe
  • Modify HKCU\Software\Microsoft\Windows\Windows Error Reporting\DontShowUI entry with value 1

Daily Server Restarts

If a KAG server is running in a keepalive script, a scheduled task that kills the server once a day is, effectively, a daily restart because the keepalive script will automatically restart the server.

Linux/Mac - Cronjob

This script will kill all instances of KAGdedi at 3 AM.

  1. Use crontab -e to create a new cronjob. This will open your default text editor.
  2. In the text editor, type:
    0 3 * * * pkill -1 KAGdedi
  3. Close editor. Cronjob installed!

Windows - Task Scheduler

"Needs info"