Difference between revisions of "Server"
(syntax highlighting and enclosing divs) |
|||
Line 86: | Line 86: | ||
<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> | <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> | ||
<p> | <p> | ||
− | # '''Do this step if you have a 64-bit OS.''' Install <code>ia32-libs</code>: <br /> < | + | # '''Do this step if you have a 64-bit OS.''' Install <code>ia32-libs</code>: <br /> <syntaxhighlight lang="bash" enclose="div">apt-get install ia32-libs</syntaxhighlight> |
− | # Download the server: <br /> < | + | # Download the server: <br /> <syntaxhighlight lang="bash" enclose="div">wget http://dl.kag2d.com/kag-linux32-dedicated-latest.tar.gz</syntaxhighlight> |
− | # Next, decompress the archive. <br /> < | + | # Next, decompress the archive. <br /> <syntaxhighlight lang="bash" enclose="div">tar -zxf kag-linux32-dedicated-latest.tar.gz</syntaxhighlight> |
− | # Change to the new directory: <br /> < | + | # Change to the new directory: <br /> <syntaxhighlight lang="bash" enclose="div">cd kag-linux32-dedicated</syntaxhighlight> |
− | # Run your server: <br /> < | + | # Run your server: <br /> <syntaxhighlight lang="bash" enclose="div">./KAGdedi</syntaxhighlight><br /> |
#Your default KAG Server is now running. | #Your default KAG Server is now running. | ||
</p> | </p> | ||
Line 117: | Line 117: | ||
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> | ||
− | < | + | <syntaxhighlight lang="ini" enclose="div"> |
#!/bin/bash | #!/bin/bash | ||
echo "Running KAG dedicated server" | echo "Running KAG dedicated server" | ||
Line 127: | Line 127: | ||
sleep 5 | sleep 5 | ||
done | done | ||
− | </ | + | </syntaxhighlight> |
<p>To use, run the script: <code>./dedi.sh</code> instead of the usual <code>./KAGdedi</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=== | ===Adapting for Maqq's Configuration Tool=== | ||
<p>To use a configuration generated by Maqq's Configuration Tool, replace line 6 in the above script with: | <p>To use a configuration generated by Maqq's Configuration Tool, replace line 6 in the above script with: | ||
− | < | + | <syntaxhighlight lang="bash" enclose="div"> |
./KAGdedi autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm | ./KAGdedi autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm | ||
− | </ | + | </syntaxhighlight> |
</p> | </p> | ||
===Windows=== | ===Windows=== | ||
<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> | <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> | ||
− | < | + | <syntaxhighlight lang="vb" enclose="div"> |
@ECHO off | @ECHO off | ||
Line 149: | Line 149: | ||
goto restart | goto restart | ||
− | </ | + | </syntaxhighlight> |
<p>To make it work on Windows Vista or 7 you need to disable Windows Error Reporting. To do so: | <p>To make it work on Windows Vista or 7 you need to disable Windows Error Reporting. To do so: | ||
*Run regedit.exe | *Run regedit.exe | ||
Line 155: | Line 155: | ||
===Adapting for Maqq's Configuration Tool=== | ===Adapting for Maqq's Configuration Tool=== | ||
<p>To use a configuration generated by Maqq's Configuration Tool, replace line 6 in the above script with: | <p>To use a configuration generated by Maqq's Configuration Tool, replace line 6 in the above script with: | ||
− | < | + | <syntaxhighlight lang="vb" enclose="div"> |
start /wait KAG.exe nolauncher autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm | start /wait KAG.exe nolauncher autostart Scripts/custom_autostart.gm autoconfig Scripts/custom_autoconfig.gm | ||
− | </ | + | </syntaxhighlight> |
</p> | </p> | ||
Line 166: | Line 166: | ||
<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:< | + | # In the text editor, type:<syntaxhighlight lang="bash" enclose="div">0 3 * * * pkill -1 KAGdedi</syntaxhighlight> |
# Close editor. Cronjob installed!</p> | # Close editor. Cronjob installed!</p> | ||
===Windows - Task Scheduler=== | ===Windows - Task Scheduler=== | ||
Line 174: | Line 174: | ||
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. | 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. | ||
− | < | + | <syntaxhighlight lang="bash" enclose="div">curl -s http://update.kag2d.com/linux32-dedicated-release/App/version.txt | head -n1 | cut -d ' ' -f2 |
− | 1337154874-636-6e12e0f833b0</ | + | 1337154874-636-6e12e0f833b0</syntaxhighlight> |
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. | 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. | ||
Line 197: | Line 197: | ||
#Download the tool: http://dl.dropbox.com/u/65858755/KAGServerConfigTool/KAG_Server_Config_Tool.zip | #Download the tool: http://dl.dropbox.com/u/65858755/KAGServerConfigTool/KAG_Server_Config_Tool.zip | ||
#Extract it and copy the contents into your KAG Servers root folder | #Extract it and copy the contents into your KAG Servers root folder | ||
− | #Change to the directory in the console, e.g.:< | + | #Change to the directory in the console, e.g.:<syntaxhighlight lang="bash" enclose="div">cd kag_linux</syntaxhighlight> |
− | #Make it executable: < | + | #Make it executable: <syntaxhighlight lang="bash" enclose="div">chmod +x ./RunKAGServerCT.sh</syntaxhighlight> |
− | #Start the app executing the RunKAGServerCT.sh script on a terminal window:< | + | #Start the app executing the RunKAGServerCT.sh script on a terminal window:<syntaxhighlight lang="bash" enclose="div"> ./RunKAGServerCT.sh</syntaxhighlight> |
#On first start you should go to the "Help" tab and select "Check for updates" to make sure you are using the newest version of the tool. | #On first start you should go to the "Help" tab and select "Check for updates" to make sure you are using the newest version of the tool. | ||
#Once the update has finished, follow the GUI's instructions and run the server. | #Once the update has finished, follow the GUI's instructions and run the server. | ||
Line 209: | Line 209: | ||
<p>Of the many modifiable variables, these are some of the most important: | <p>Of the many modifiable variables, these are some of the most important: | ||
− | < | + | <syntaxhighlight lang="ini" enclose="div"> |
global m_width = 600; // Map generator width. Affects RAM usage. | global m_width = 600; // Map generator width. Affects RAM usage. | ||
global m_height = 250; // Map generator height. Affects RAM usage. | global m_height = 250; // Map generator height. Affects RAM usage. | ||
Line 232: | Line 232: | ||
global sv_name = `KAG game`; // Sets the server name displayed in server browser. | 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. | 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. | ||
− | </ | + | </syntaxhighlight></p> |
===dedicated_autostart.gm=== | ===dedicated_autostart.gm=== | ||
− | < | + | <code><syntaxhighlight lang="cpp" enclose="div"> |
// autostart on dedicated server launch | // autostart on dedicated server launch | ||
Line 298: | Line 298: | ||
} | } | ||
− | print(`Config finished loading from Scripts/Server/dedicated_autostart.gm`); | + | print(`Config finished loading from Scripts/Server/dedicated_autostart.gm`); </syntaxhighlight></code> |
− | + | ||
− | </ | + | |
This file is very important. If you want to change rules for your server then you have to edit the global autostartswitch variable. <br /> | This file is very important. If you want to change rules for your server then you have to edit the global autostartswitch variable. <br /> | ||
Line 307: | Line 305: | ||
===mapcycle.cfg=== | ===mapcycle.cfg=== | ||
− | <p>< | + | <p><code><syntaxhighlight lang="ini" enclose="div"> |
#KAG mapcycle; | #KAG mapcycle; | ||
# put map generator files, png files here, or script files | # put map generator files, png files here, or script files | ||
Line 313: | Line 311: | ||
mapcycle = Maps/generator_ctf_mountain.cfg; | mapcycle = Maps/generator_ctf_mountain.cfg; | ||
− | </ | + | </syntaxhighlight></code> |
You must separate paths to files with semicolons. Allowed files are generators, script files and maps in png format.</p> | You must separate paths to files with semicolons. Allowed files are generators, script files and maps in png format.</p> | ||
Line 322: | Line 320: | ||
<p>There are several files that form the specific gamemode at the rules folder. If your are changing the settings for a specific gamemode it is highly recommended to change the name of the folder and point to that folder at the dedicated_autostart.cfg as a new update of KAG might reset the settings that are located at the default folders. | <p>There are several files that form the specific gamemode at the rules folder. If your are changing the settings for a specific gamemode it is highly recommended to change the name of the folder and point to that folder at the dedicated_autostart.cfg as a new update of KAG might reset the settings that are located at the default folders. | ||
Most variables are pretty self explanatory. Some variables you might want to change: | Most variables are pretty self explanatory. Some variables you might want to change: | ||
− | The amount of resources every class gets during the normal game and during the warmup. (class specific)< | + | The amount of resources every class gets during the normal game and during the warmup. (class specific)<code><syntaxhighlight lang="ini" enclose="div"> stone_default = 0 |
wood_default = 10 | wood_default = 10 | ||
gold_default = 0 | gold_default = 0 | ||
Line 332: | Line 330: | ||
gold_warmup = 0 | gold_warmup = 0 | ||
arrows_warmup = 0 | arrows_warmup = 0 | ||
− | bombs_warmup = 0 </ | + | bombs_warmup = 0 </syntaxhighlight></code> |
at gamemode.gm: | at gamemode.gm: | ||
− | < | + | <code><syntaxhighlight lang="ini" enclose="div"># match time formula is = m*(a*sqrt(b*x)) where x = number of players in team; m = map size/difficulty 0.8<=m<=1.2; |
match_time_formula_a = 5 | match_time_formula_a = 5 | ||
match_time_formula_b = 3 | match_time_formula_b = 3 | ||
Line 346: | Line 344: | ||
heart_fallout_probability = 2 # 0 - no hearts; 1 - every death; 2.. - randomly probability of 2... | heart_fallout_probability = 2 # 0 - no hearts; 1 - every death; 2.. - randomly probability of 2... | ||
spawn_tent_onstart = yes | spawn_tent_onstart = yes | ||
− | </ | + | <syntaxhighlight></code> |
at the team files: | at the team files: | ||
− | < | + | <code><syntaxhighlight lang="ini" enclose="div"> unit_count = 6 # units in team = unit_count * number of players; 0 one life; -1 unlimited |
stone_warmup = 1500 #the amount of resources there will be at the start when new_sacks_in_tent is enabled | stone_warmup = 1500 #the amount of resources there will be at the start when new_sacks_in_tent is enabled | ||
Line 360: | Line 358: | ||
gold_amount = 10 | gold_amount = 10 | ||
arrows_amount = 40 | arrows_amount = 40 | ||
− | bombs_amount = 0</ | + | bombs_amount = 0</syntaxhighlight></code> |
</p> | </p> | ||
− | === | + | ===[[Workshops]]=== |
− | You are able to add workshops by editing the room's file located at Base/Entities/Rooms. You can find the default Room file a gamemode uses at gamemode.gm. | + | You are able to add workshops by editing the room's file located at Base/Entities/Rooms. You can find the default Room file a gamemode uses at gamemode.gm. See [[Workshop_Modding]] for a detailed guide on room modding in classic KAG. |
− | + | ||
− | < | + | A room's settings can be found at the bottom of the file, here is an example of an edited file. |
+ | <syntaxhighlight lang="ini" enclose="div"># room syntax - room name; room level (0 menu - 1... upgrade); room sprite; room help text; room items/functions, item2, item3 ...; costs , , , (g gold, s stone, w wood, c coins, l level, u upgrades_from, r requires_roomname- none) ... | ||
@$rooms = QUARTERS; Entities/Rooms/Sprites/Quarters.png; Wait inside to heal; heal; -; | @$rooms = QUARTERS; Entities/Rooms/Sprites/Quarters.png; Wait inside to heal; heal; -; | ||
ARROW WORKSHOP; Entities/Rooms/Sprites/ArrowShop.png; $KEY7$ to make arrow; arrow; -; | ARROW WORKSHOP; Entities/Rooms/Sprites/ArrowShop.png; $KEY7$ to make arrow; arrow; -; | ||
Line 403: | Line 402: | ||
# d default build sound | # d default build sound | ||
# c*10 - buy as much as possible, max 10 | # c*10 - buy as much as possible, max 10 | ||
− | </ | + | </syntaxhighlight> |
===Builder blocks=== | ===Builder blocks=== | ||
Line 409: | Line 408: | ||
You can only add most of the custom blocks when gold_only = 1. | You can only add most of the custom blocks when gold_only = 1. | ||
Example of a modified builder_blocks: | Example of a modified builder_blocks: | ||
− | < | + | <syntaxhighlight lang="ini" enclose="div"> |
# builder blocks | # builder blocks | ||
Line 445: | Line 444: | ||
# res_bombs = 4 | # res_bombs = 4 | ||
− | </ | + | </syntaxhighlight> |
Line 460: | Line 459: | ||
<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>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 contents of the file <code>securitysetup.cfg</code> in <code>kagServer/Base/Security</code> (where kagServer is the path to the kagServer's directory) should look something like this:</p> | <p>The contents of the file <code>securitysetup.cfg</code> in <code>kagServer/Base/Security</code> (where kagServer is the path to the kagServer's directory) should look something like this:</p> | ||
− | < | + | <syntaxhighlight lang="ini" enclose="div"> |
# Security setup | # Security setup | ||
Line 471: | Line 470: | ||
seclevs_file = Security/seclevs.cfg | seclevs_file = Security/seclevs.cfg | ||
− | </ | + | </syntaxhighlight> |
<p>Note: The whitelist overrides the blacklist if enabled.</p> | <p>Note: The whitelist overrides the blacklist if enabled.</p> | ||
===Whitelist=== | ===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> | <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 format: name; anothername; yetanothername; | ||
whitelist = | whitelist = | ||
Line 482: | Line 481: | ||
anothername; | anothername; | ||
yetanothername; | yetanothername; | ||
− | </ | + | </syntaxhighlight> |
<p>Simply add usernames in this way to allow only those players access to the server.</p> | <p>Simply add usernames in this way to allow only those players access to the server.</p> | ||
===Blacklist=== | ===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> | <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; | # 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. | # IP of 0.0.0.0 means no IP is banned, and the user is just banned by username. | ||
Line 497: | Line 496: | ||
name1; 0.0.0.0; 10:30:0:31:11:2050; Banned; | name1; 0.0.0.0; 10:30:0:31:11:2050; Banned; | ||
name2; 12.34.45.78; 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. | <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> | Note that January is the 0th month</p> |
Revision as of 10:01, 2 December 2012
This page is for the set up of the default KAG Server and then configuring it. For minimum requirements, installation, managing stability and configuration this is the right page.
Contents
Server Requirements
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.
Dedicated Servers
Software
- The KAG server can run on almost all OS Linux, Windows, or Mac.
- The recommended operating system is Linux, specifically Debian.
Lowest Hardware
- RAM: At least 128MB
- CPU: At least 1 core clocked @ 1Ghz
Recommended Hardware
- RAM: 512MB
- CPU: 2 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 |
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.
Installation
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.
- 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 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.Linux Install
This guide is written for 32-bit Debian Linux. To run on 64-bit Debian Linux, the ia32-libs
package must be installed.
- Do this step if you have a 64-bit OS. Install
ia32-libs
:
apt-get install ia32-libs - Download the server:
wget http://dl.kag2d.com/kag-linux32-dedicated-latest.tar.gz - Next, decompress the archive.
tar -zxf kag-linux32-dedicated-latest.tar.gz - Change to the new directory:
cd kag-linux32-dedicated - Run your server:
./KAGdedi
- Your default KAG Server is now running.
Windows Install
- First, download the server: http://kag2d.com/en/download
- Next, decompress the archive. This can be done with many different programs, including PeaZip.
- Open the folder the archive was extracted into.
- Run your server by running
dedicatedserver.bat
.
- Your default KAG Server is now running.
Mac Install
Due to their similarities, the installation instructions for Linux should apply for Macs, though Mac does not currently have a dedicated server option. If that doesn't work try this:
- Download Trelawney's Dedicated OSX Server: http://dl.dropbox.com/u/23114384/kag/osx_dedicated.zip
- Make sure that KAG is in your applications folder.
- Next, decompress osx_dedicated.zip. This can be done with many different programs, including PeaZip. Then lanch it.
- It will says "Make sure to edit dedicated_autoconfig.gm" and a copy of KAG launches.
- Your default KAG Server is now running.
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
.
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/dedicated_autostart.gm autoconfig Scripts/dedicated_autoconfig.gm; do
echo "KAG server running"
sleep 5
done
To use, run the script: ./dedi.sh
instead of the usual ./KAGdedi
Adapting for Maqq's Configuration Tool
To use a configuration generated by Maqq's Configuration Tool, replace line 6 in the above script with:
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
.
: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
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
Adapting for Maqq's Configuration Tool
To use a configuration generated by Maqq's Configuration Tool, replace line 6 in the above script with:
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.
- Use
crontab -e
to create a new cronjob. This will open your default text editor. - In the text editor, type:0 3 * * * pkill -1 KAGdedi
- Close editor. Cronjob installed!
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.
1337154874-636-6e12e0f833b0
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.
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 or by using a Configuration Tool. Of the two, a tool is far the fastest and easiest method, yet manual returns greater results.
JackD's/Maqq's Tool
Windows GUI
Requirements:
- NET Framework 2.0 or higher
Installation:
- Download the tool: http://dl.dropbox.com/u/65858755/KAGServerConfigTool/KAG_Server_Config_Tool.zip
- Extract it and copy the contents into your KAG Servers root folder (e.g. C:\KAG).
- Run KAGServer.exe
- On first start you should go to the "Help" tab and select "Check for updates" to make sure you are using the newest version of the tool.
- Once the update has finished, follow the GUI's instructions and run the server.
Linux/Mac GUI
Requirements:
- Mono 2.10.8
Installation:
- Download the tool: http://dl.dropbox.com/u/65858755/KAGServerConfigTool/KAG_Server_Config_Tool.zip
- Extract it and copy the contents into your KAG Servers root folder
- Change to the directory in the console, e.g.:cd kag_linux
- Make it executable: chmod +x ./RunKAGServerCT.sh
- Start the app executing the RunKAGServerCT.sh script on a terminal window:./RunKAGServerCT.sh
- On first start you should go to the "Help" tab and select "Check for updates" to make sure you are using the newest version of the tool.
- Once the update has finished, follow the GUI's instructions and run the server.
Manual
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:
dedicated_autoconfig.gm
Of the many modifiable variables, these are some of the most important:
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_tcpr = 0; // 1 allows you to remotely control your server by telnet connections.
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
// autostart on dedicated server launch
//set autostartswitch to:
// 0 for CTF
// 1 for TDM
// 2 for Sandbox
// 3 for Zombies
// 4 for RTDM
// 10 for TEST
global autostartswitch = 0;
newWorld( "" );
switchGameState(0);
startServer();
if (autostartswitch == 0) //ctf
{
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`);
This file is very important. If you want to change rules for your server then you have to edit the global autostartswitch variable.
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
You must separate paths to files with semicolons. Allowed files are generators, script files and maps in png format.
# 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;
settings located at /rules/gamemode
There are several files that form the specific gamemode at the rules folder. If your are changing the settings for a specific gamemode it is highly recommended to change the name of the folder and point to that folder at the dedicated_autostart.cfg as a new update of KAG might reset the settings that are located at the default folders.
Most variables are pretty self explanatory. Some variables you might want to change:
The amount of resources every class gets during the normal game and during the warmup. (class specific)
wood_default = 10
gold_default = 0
arrows_default = 0
bombs_default = 0
stone_warmup = 0
wood_warmup = 10
gold_warmup = 0
arrows_warmup = 0
bombs_warmup = 0
at gamemode.gm:
# match time formula is = m*(a*sqrt(b*x)) where x = number of players in team; m = map size/difficulty 0.8<=m<=1.2;
match_time_formula_a = 5
match_time_formula_b = 3
match_time_override = 0 # minutes / overrides time formula / 0 unlimited time / -1 don't override
break_time = 9 # break_time * number of players - seconds
break_time_static = 60 # overrides break time if present, gives break time without player count linkage
minimum_players_inteam = 1 #when the countdown of when the warmup ends is starting
playerrespawn_seconds = 5.0
nearspawn_multiplier = 3.0
new_sacks_in_tent = yes
heart_fallout_probability = 2 # 0 - no hearts; 1 - every death; 2.. - randomly probability of 2...
spawn_tent_onstart = yes
<syntaxhighlight></code>
at the team files:
<code><syntaxhighlight lang="ini" enclose="div"> unit_count = 6 # units in team = unit_count * number of players; 0 one life; -1 unlimited
stone_warmup = 1500 #the amount of resources there will be at the start when new_sacks_in_tent is enabled
wood_warmup = 2500
gold_warmup = 100
arrows_warmup = 500
bombs_warmup = 0
stone_amount = 150 #the amount of resources builders get when when they are at the tent when new_sacks_in_tent is disabled
wood_amount = 250
gold_amount = 10
arrows_amount = 40
bombs_amount = 0
Workshops
You are able to add workshops by editing the room's file located at Base/Entities/Rooms. You can find the default Room file a gamemode uses at gamemode.gm. See Workshop_Modding for a detailed guide on room modding in classic KAG.
A room's settings can be found at the bottom of the file, here is an example of an edited file.
@$rooms = QUARTERS; Entities/Rooms/Sprites/Quarters.png; Wait inside to heal; heal; -;
ARROW WORKSHOP; Entities/Rooms/Sprites/ArrowShop.png; $KEY7$ to make arrow; arrow; -;
ARCHERY RANGE; Entities/Rooms/Sprites/ArcheryRange.png; Archer $KEY7$; class 0, class 1; -;
TUNNEL; Entities/Rooms/Sprites/Tunnel.png; $KEY7$ to travel quickly; travel_right, travel_left; -;
KNIGHT ARMORY; Entities/Rooms/Sprites/Armoury.png; Knight $KEY7$; class 0, class 2; -;
LIBRARY; Entities/Rooms/Sprites/Library.png; Library; -; -;
CARPENTRY; Entities/Rooms/Sprites/CarpentryShop.png; Carpentry shop; chest; -;
MASONRY; Entities/Rooms/Sprites/MasonryShop.png; Masonry Shop; boulder; -;
DOORWAY; Entities/Rooms/Sprites/Doorway.png; Doorway; travel_right, travel_left; -;
BANK; Entities/Rooms/Sprites/Bank.png; Bank; -; -;
BOMBSHOP; Entities/Rooms/Sprites/BombShop.png; No bombs for you boy; -; -;
DEMOLITION SHOP; Entities/Rooms/Sprites/DemoShop.png; ohhhhhhhhh; keg; -;
MECHANIC; Entities/Rooms/Sprites/MechanicShop.png; Make a portable light source!; lantern; -;
NURSERY; Entities/Rooms/Sprites/Nursery.png; Nursery; -; -;
SIEGE; Entities/Rooms/Sprites/SiegeShop.png; Siege Shop; -; -;
ZOMBIE PORTAL; Entities/Rooms/Sprites/ZombiePortal.png; Buy a Greg; greg; -;
;
# room_function syntax - function name; function actor name; function config file; function icon; function make sound; function icon frame; function icon frame size; function help text; costs , , , (g gold, s stone, w wood, c coins - none) ...
@$room_functions = arrow; -; -; Entities/Items/Sprites/MaterialStacks.png; Entities/Rooms/Sounds/ArrowsMake.ogg; 10; 16; Arrow cost 0 coin; -;
heal; -; -; -; Sounds/heart.ogg; 0; 0; Healing 0 coins per 1/2 heart; -;
class 2; -; -; GUI/MenuItems.png; Entities/Rooms/Sounds/SwitchKnight.ogg; 12; 32; Knight; -;
class 1; -; -; GUI/MenuItems.png; Entities/Rooms/Sounds/SwitchArcher.ogg; 16; 32; Archer; -;
class 0; -; -; GUI/MenuItems.png; Entities/Rooms/Sounds/SwitchBuilder.ogg; 8; 32; Builder; -;
lantern; genericitem; Entities/Items/Lantern.cfg; Entities/Items/Sprites/Lantern.png; Entities/Rooms/Sounds/BombMake.ogg; 0; 8; See in the dark; w20, g10, c10;
travel_left; -; -; GUI/MenuItems.png; Entities/Rooms/Sounds/Travel.ogg; 1; 32; Travel Left; -;
travel_right; -; -; GUI/MenuItems.png; Entities/Rooms/Sounds/Travel.ogg; 1; 32; Travel Right; -;
chest; genericitem; Entities/Items/TreasureChest.cfg; Entities/Items/Sprites/WoodChest.png; Entities/Rooms/Sounds/BombMake.ogg; 0; 8; Chest; w200, c10;
keg; keg; Entities/Items/Keg.cfg; Entities/Items/Sprites/Keg.png; Entities/Rooms/Sounds/BombMake.ogg; 0; 16; ooooh!; w200, c10;
boulder; boulder; Entities/Items/Boulder.cfg; Entities/Items/Sprites/Boulder.png; d; 0; 16; Make me to crush your foes!; s200, c10;
greg; zombie; Entities/Actors/Greg.cfg; Entities/Actors/Sprites/Greg.png; d; 0; 32; Greg; g240, s240, w240, c10;
# - nothing
# - in room_functions as texture = don't add to menu - collide function
# d default build sound
# c*10 - buy as much as possible, max 10
Builder blocks
The builder_blocks.cfg file you point to at your specific builder's config shows what blocks a builder can make. You can only add most of the custom blocks when gold_only = 1. Example of a modified builder_blocks:
# name; offset from world.png; resource_type 1; resource_type 2; resource_cost 1; resource_cost 2; requires horizontal num; requires vertical num
@$blocks =
Door; 128; 1; -1; 0; 0; 1; 1;
Trap Bridge; 176; 1; -1; 0; 0; 1; 1;
Ladder; 144; 1; -1; 0; 0; 1; 1;
Wooden Back Wall; 205; 1; -1; 0; 0; 1; 1;
Castle Back Wall; 64; 0; -1; 0; 0; 1; 1;
Mossy Castle Back Wall; 227; 0; -1; 0; 0; 1; 1;
Wooden Wall; 196; 1; -1; 0; 0; 1; 1;
Castle Wall; 48; 0; -1; 0; 0; 1; 1;
Mossy Castle Wall; 224; 0; -1; 0; 0; 1; 1;
Gold Bullion; 160; 2; -1; 0; 0; 1; 1;
Workshop; 146; 1; -1; 0; 0; 3; 3;
Spikes; 167; 0; -1; 0; 0; 1; 1;
Dirt; 16; -1; -1; 0; 0; 1; 1;
Background Dirt; 32; -1; -1; 0; 0; 1; 1;
Grass; 25; -1; -1; 0; 0; 1; 1;
Rubble; 155; -1; -1; 0; 0; 1; 1;
Gold; 80; -1; -1; 0; 0; 1; 1;
Rock; 96; -1; -1; 0; 0; 1; 1;
Thickrock; 208; -1; -1; 0; 0; 1; 1;
# resource_type:
# none = -1
# res_stone = 0
# res_wood = 1
# res_gold = 2
# res_arrows = 3
# res_bombs = 4
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
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.
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 contents of the file securitysetup.cfg
in kagServer/Base/Security
(where kagServer is the path to the kagServer's directory) should look something like this:
# Set to 1 to allow only the names in the whitelist or 0 to disallow the names in the blacklist
whitelist_active = 0
whitelist_file = Security/whitelist.cfg
blacklist_file = Security/blacklist.cfg
# Path to file where security levels are defined
seclevs_file = Security/seclevs.cfg
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 =
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:
# 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