Configure a wild server
(→External links) |
|||
| (One intermediate revision by one user not shown) | |||
| Line 13: | Line 13: | ||
== Installation == | == Installation == | ||
| − | If you have one, three, or more servers, dont worry, you won't need to install each time a new copy of armagetron. | + | If you have one, three, or more servers, dont worry, you won't need to install each time a new copy of armagetron. You dont need to have full-acces(root) on the machine, you only need a writable home directory. |
| + | First, download the source from the official site: http://prdownloads.sourceforge.net/armagetronad/armagetronad-0.2.8.2.1.src.tar.bz2?download | ||
| − | -- | + | Then unpack it: |
| + | tar xvf armagetronad-0.2.8.2.1.src.tar.bz2 | ||
| + | and enter the newly created folder: | ||
| + | cd armagetronad-0.2.8.2.1/ | ||
| + | Then launch the configure script which will prepare armagetronad for compilation. | ||
| + | ./configure --prefix ${HOME}/tron --disable-glout | ||
| + | The --prefix option sets where armagetronad will be installed and the --disable-glout option causes it to build only the dedicated server. | ||
| − | + | Like ever :) | |
| + | make && make install | ||
| − | + | == Configuration == | |
| − | + | For each server you want to create, create a separate directory for it, and 2 subfolders in it: config and var | |
| + | mkdir -p ~/myfunnytronserver/{config,var} | ||
| − | |||
| − | + | ---- | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
For each server I run I have a directory dedicated to them. So, wild has a dir: /home/ed/wild | For each server I run I have a directory dedicated to them. So, wild has a dir: /home/ed/wild | ||
| Line 53: | Line 55: | ||
This will set the server up as a clone of fortress. Everything else is added to that. I won't go into great detail about the settings I change, nothing major, just change winzone to dz, alter dz timeout settings, etc. If anyone wants a copy of my config files, just ask. | This will set the server up as a clone of fortress. Everything else is added to that. I won't go into great detail about the settings I change, nothing major, just change winzone to dz, alter dz timeout settings, etc. If anyone wants a copy of my config files, just ask. | ||
| − | to run this server I have a simple bash script to make it easier for myself. This looks like: | + | to run this server I have a simple bash script to make it easier for myself. This looks like: |
Code: | Code: | ||
| Line 313: | Line 315: | ||
== External links == | == External links == | ||
* Ed's original post: http://forums.crazy-tronners.com/viewtopic.php?p=3600#3600 | * Ed's original post: http://forums.crazy-tronners.com/viewtopic.php?p=3600#3600 | ||
| − | * Another map rotation script: http://forums.crazy-tronners.com/viewtopic.php?t=42 | + | * Another map rotation [http://www.research-service.com/custom-research-paper.html research paper] script: http://forums.crazy-tronners.com/viewtopic.php?t=42 |
Latest revision as of 21:54, 14 January 2010
This article is a stub. You can help Crazy Tronners Wiki by expanding it.
This article is being completely reformatted by me, to clearify it, see talk page for more info about progress and requests/objections --epsy
This little how-to will guide you through the installation of a dedicated armagetron advanced server and by putting a map switcher script. The map rotation script here is the one that was used on CT's servers with a few hacks inside.
You do not need to be root or with special right on the machine that will run the server to get it to work. A simple user which has a home directory is good enough.
Let's start! :)
Installation
If you have one, three, or more servers, dont worry, you won't need to install each time a new copy of armagetron. You dont need to have full-acces(root) on the machine, you only need a writable home directory.
First, download the source from the official site: http://prdownloads.sourceforge.net/armagetronad/armagetronad-0.2.8.2.1.src.tar.bz2?download
Then unpack it:
tar xvf armagetronad-0.2.8.2.1.src.tar.bz2
and enter the newly created folder:
cd armagetronad-0.2.8.2.1/
Then launch the configure script which will prepare armagetronad for compilation.
./configure --prefix ${HOME}/tron --disable-glout
The --prefix option sets where armagetronad will be installed and the --disable-glout option causes it to build only the dedicated server.
Like ever :)
make && make install
Configuration
For each server you want to create, create a separate directory for it, and 2 subfolders in it: config and var
mkdir -p ~/myfunnytronserver/{config,var}
For each server I run I have a directory dedicated to them. So, wild has a dir: /home/ed/wild within here I create 3 dir's: config, log and var
Then we need the config. All the settings I use are more or less the same as standard Bugfarm fortress, which are all ready to use in the basic install. You need to copy all the files from the default config files into /home/ed/wild/config. In my case I copied them from: /home/ed/tron/etc/games/armagetronad-dedicated/
I now have all the default config files within /home/ed/wild/config make sure it's these ones you modify, that way if you mess them up, you can always go back to the original. Although it's not considered good practice and the file itself tells you not to do it, I go ahead and modify the file settings_dedicated, changing TALK_TO_MASTER to 1 so your server appears on the main server list. And change server name, etc to your own. And a few others I add, like:
CYCLE_RUBBER_WALL_SHRINK 0.5 CYCLE_RUBBER_WALL_SHRINK_OVERRIDE 0
the important line to add at the base of the file is:
Include examples/cvs_test/fortress_complete.cfg
This will set the server up as a clone of fortress. Everything else is added to that. I won't go into great detail about the settings I change, nothing major, just change winzone to dz, alter dz timeout settings, etc. If anyone wants a copy of my config files, just ask.
to run this server I have a simple bash script to make it easier for myself. This looks like:
Code: #!/bin/sh tron="/home/ed/tron/bin/armagetronad-dedicated" config="/home/ed/wild/config" var="/home/ed/wild/var" log="/home/ed/wild/log/wildlog.txt" $tron --configdir $config --vardir $var | tee -a $log
this just means it runs my own install of tron. Uses my config files in "/home/ed/wild/config", outputs ladder, etc to "/home/ed/wild/var" and finally writes the files to log file "/home/ed/wild/log/wildlog.txt"
The "tee" program running there simply outputs to screen as well as writing to the log - so I can see any problems.
I run all this in a screen session, as I'm connecting via ssh. with this we now have a clone of Bugfarm Fortress, with the exceptions of any modifications made to the config files. In my case, very few.
Now let's get onto the map rotation. One problem with changing settings in each round is that let's say I wanted to change a setting for chico's eye, which uses <Setting name="CYCLE_BRAKE" value="-50"/> meaning brake will actually act as a boost. Unless I tell tron server to change that setting back to default it will continue to use this setting for the next map, and the next one, etc. Not something we want.
I get around this by having 2 everytime.cfg files. One at:
/home/ed/wild/config/everytime.cfg
This file is loaded at the end of every round and contains every setting that I use that changes from map to map. It looks like this:
Code: FORTRESS_CONQUERED_KILL_MIN 0 FORTRESS_CONQUEST_DECAY_RATE .1 FORTRESS_CONQUEST_RATE .3 FORTRESS_DEFEND_RATE .2 WIN_ZONE_INITIAL_SIZE 40 WIN_ZONE_RANDOMNESS 0 WIN_ZONE_DEATHS 1 WIN_ZONE_EXPANSION 4 CYCLE_BRAKE 30 CYCLE_BRAKE_REFILL .1 CYCLE_BRAKE_DEPLETE 1 SP_WALLS_LENGTH 400 WALLS_LENGTH 400 CYCLE_ACCEL_RIM 0 CYCLE_ACCEL 20 CYCLE_SPEED 30 CYCLE_START_SPEED 20 CYCLE_SPEED_MIN .25 CYCLE_RUBBER 5 CYCLE_TURN_SPEED_FACTOR .95
These are the default fortress values for these settings.
So after each round all settings are set back to default. The new map then loads with it's unique settings. Then after the round they are set back again, etc.
That is why, if you play there, you see settings changing all over the place.
The second everytime.cfg is kept in:
/home/ed/wild/var/everytime.cfg
This is the one that changes the map file at the end of every round. I just copied from it now and it says:
Code: MAP_FILE ed/fortress/slingshot-0.0.1.aamap.xml ROUND_CENTER_MESSAGE Round 5 - Slingshot
Lets try it now, it says:
Code: MAP_FILE ed/fortress/chico_time-0.1.4.aamap.xml ROUND_CENTER_MESSAGE Round 6 - It's Chico Time
Again, this file is read from by tron server at the end of every round.
So all we have to do it look at the log file that is being written to. See what round we're on and update /home/ed/wild/var/everytime.cfg with a map and center message.
I created a folder called /home/ed/mapscript in here we have four files:
start_map.sh mapcycle2.sh tron.class.php tron.php
It all starts with the bash script start_map.sh that looks like this. I run this one in a new screen session:
Code: #!/bin/sh log="/home/ed/wild/log/wildlog.txt" tail -n1 -f $log | /home/ed/mapscript/mapcycle2.sh
This will take each line of the wildlog.txt and feed it into mapcycle2.sh that looks like this:
Code: #!/bin/bash while true do line="" read line echo $line /home/ed/mapscript/tron.php "$line" done
This will take each line and feed it to tron.php that looks like this. It will also output to screen so I can see any error message, etc:
Code:
#!/usr/bin/php
<?php
$line=$argv[1];
include("tron.class.php");
$tron=new tron;
$tron->mysql_start();
if (substr($line,0,13)=="[0] Go (round"){
for ($i=1;$i<13;$i++){
if ($line=="[0] Go (round ".$i." of 12 )!"){
if ($i==12){
$tron->map_cycle(1);
} else {
$tron->map_cycle($i+1);
}
}
}
}
?>
This calls upon tron.class.php that looks like this:
Code:
class tron {
//
// Start Config
var $cfg_host="localhost";
var $cfg_user="mysqlusername";
var $cfg_pw="mysqlpassword";
var $cfg_db="tron";
var $cfg_file="/home/ed/wild/var/everytime.cfg";
//
//
// End Config
//
//
function mysql_start(){
mysql_connect($this->cfg_host,$this->cfg_user,$this->cfg_pw);
mysql_select_db($this->cfg_db);
}
function mysql_stop(){
mysql_close();
}
function map_cycle($round){
$mapquery=mysql_query('SELECT * FROM maps WHERE round="'.$round.'"');
$maps=mysql_num_rows($mapquery);
srand ((double)microtime()*1000000);
$mapnumber = rand(0,$maps-1);
$mapname=mysql_result($mapquery,$mapnumber,'maps.mapname');
$mapfile=mysql_result($mapquery,$mapnumber,'maps.mapfile');
if ($round==12){
$content='MAP_FILE '.$mapfile."\nROUND_CENTER_MESSAGE Final Round - ".$mapname."\n";
}else{
$content='MAP_FILE '.$mapfile."\nROUND_CENTER_MESSAGE Round ".$round.' - '.$mapname."\n";
}
$this->filewrite($content,'new');
}
function filewrite($content,$mode){
if ($mode=="new") {
$execfile=fopen ($this->cfg_file,'w+');
} else if ($mode=="add"){
$execfile=fopen ($this->cfg_file,'a+');
}
fputs($execfile,$content);
fclose($execfile);
echo $content;
}
}
?>
Of course you need a mysql database, in my case called tron. Within here is a table called maps. What does the maps table look like? If I run a query SELECT * FROM maps; I get this:
Code: mysql> select * from maps; +----+-------+----------------------------------------------------------+-------------------------+---------------+ | id | round | mapfile | mapname | server | +----+-------+----------------------------------------------------------+-------------------------+---------------+ | 1 | 1 | ed/fortress/pillar-0.0.7.aamap.xml | Pillar | wildfortress1 | | 2 | 1 | ed/fortress/lookout-0.0.6.aamap.xml | Look Out! | wildfortress1 | | 3 | 1 | ed/fortress/johnny-0.0.2.aamap.xml | Hello, my name's Johnny | wildfortress1 | | 4 | 2 | ed/fortress/minefield-0.0.7.aamap.xml | Minefield | wildfortress1 | | 5 | 2 | ed/fortress/minepillars-0.0.3.aamap.xml | Mine Pillars | wildfortress1 | | 6 | 2 | ed/fortress/hairbrush-0.0.2.aamap.xml | HairBrush | wildfortress1 | | 7 | 3 | ed/fortress/octazigzag-0.0.3.aamap.xml | Octagon Wiggle! | wildfortress1 | | 8 | 3 | ed/fortress/octagon-0.0.2.aamap.xml | Octagon Fortress! | wildfortress1 | | 9 | 10 | ed/fortress/hexagon_triangles-0.0.3.aamap.xml | Hexagonal Triangles | wildfortress1 | | 10 | 3 | ed/fortress/octagoneloopy-0.0.1.aamap.xml | Octa Gone Loopy! | wildfortress1 | | 11 | 4 | ed/fortress/arcanoid-0.0.6.aamap.xml | Arcanoid | wildfortress1 | | 12 | 4 | ed/fortress/behind_you-0.0.9.aamap.xml | Behind You | wildfortress1 | | 13 | 5 | ed/fortress/slingshot-0.0.1.aamap.xml | Slingshot | wildfortress1 | | 14 | 5 | ed/fortress/speed_dome-0.0.7.aamap.xml | Speed Kills | wildfortress1 | | 15 | 5 | ed/fortress/speed_city-0.0.2.aamap.xml | Speed City | wildfortress1 | | 16 | 6 | ed/fortress/chico_time-0.1.4.aamap.xml | It's Chico Time | wildfortress1 | | 17 | 6 | ed/fortress/chico_teamsumo-0.0.4.aamap.xml | It's Chico Sumo | wildfortress1 | | 18 | 6 | ed/fortress/hourglass-0.0.4.aamap.xml | Chico's Hourglass | wildfortress1 | | 19 | 7 | ed/fortress/boxes-0.0.6.aamap.xml | Little Boxes | wildfortress1 | | 20 | 7 | ed/fortress/columns-0.0.1.aamap.xml | Little Columns | wildfortress1 | | 21 | 7 | ed/fortress/circles-0.0.3.aamap.xml | Little Circles | wildfortress1 | | 22 | 7 | ed/fortress/little_spiral-0.0.5.aamap.xml | Little Spirals | wildfortress1 | | 23 | 13 | ed/fortress/mini-0.0.6.aamap.xml | Mini | wildfortress1 | | 24 | 8 | ed/fortress/nano-0.0.4.aamap.xml | Nano | wildfortress1 | | 25 | 11 | ed/fortress/chico_clover-0.0.4.aamap.xml | Chico's Clover | wildfortress1 | | 26 | 11 | ed/fortress/chicoeye-0.0.3.aamap.xml | Chico's Eye - Brake! | wildfortress1 | | 27 | 11 | ed/fortress/houreye-0.0.2.aamap.xml | Chico's Wild Ride | wildfortress1 | | 28 | 12 | ed/fortress/diamond_death-0.0.8.aamap.xml | Diamond Death | wildfortress1 | | 29 | 12 | ed/fortress/diamond_sumo-0.0.5.aamap.xml | Diamond Sumo | wildfortress1 | | 30 | 3 | ed/fortress/octagon_weasel-0.0.1.aamap.xml | Octagon Weasel | wildfortress1 | | 31 | 9 | ed/fortress/desperate_housewives-0.0.1.aamap.xml | Desperate Housewives | wildfortress1 | | 32 | 12 | ed/fortress/diamond_masacre-0.0.1.aamap.xml | Diamond Massacre | wildfortress1 | | 33 | 9 | ed/fortress/grand_designs-0.0.1.aamap.xml | Grand Designs | wildfortress1 | | 34 | 13 | ed/fortress/magic_roundabout-0.0.2.aamap.xml | Magic Roundabout | wildfortress1 | | 35 | 13 | ed/fortress/little_bear-0.0.2.aamap.xml | Little Bear | wildfortress1 | | 36 | 8 | ed/fortress/nano_knightmare-0.0.5.aamap.xml | Nano Knightmare | wildfortress1 | | 37 | 4 | ed/fortress/crossfire-0.0.1.aamap.xml | Crossfire | wildfortress1 | | 38 | 9 | ed/fortress/staff-0.0.1.aamap.xml | The Mighty Staff | wildfortress1 | | 39 | 6 | ed/fortress/chico_nano-0.0.5.aamap.xml | Chico in Nanoland | wildfortress1 | | 40 | 10 | ed/fortress/three_deadly_hexagonal_sumos-0.0.7.aamap.xml | Three Deadly Hex Sumo's | wildfortress1 | | 41 | 8 | ed/fortress/nano_sumo-0.1.2.aamap.xml | Nan's Team Sumo | wildfortress1 | | 42 | 10 | ed/fortress/death_of_hex-0.0.3.aamap.xml | Death of Hex | wildfortress1 | | 43 | 9 | ed/fortress/staffs_tomb-0.0.2.aamap.xml | Staffs Tomb | wildfortress1 | +----+-------+----------------------------------------------------------+-------------------------+---------------+ 43 rows in set (0.00 sec)
This makes it very easy for me to update maps, move maps around, remove them, etc.
And I think that's it. If you spot any errors, let me know. I hope it's useful to someone.
External links
- Ed's original post: http://forums.crazy-tronners.com/viewtopic.php?p=3600#3600
- Another map rotation research paper script: http://forums.crazy-tronners.com/viewtopic.php?t=42