First of all, you should get some more maps (tracks) e.g. from http://tm.mania-exchange.com or similar and test them on your server. That is why the creation of the tracklist is being automated by file listing, “upgrading” the map list remains more easy with this guide then.

# adduser tm2
# su - tm2

$ mkdir TM2
$ cd TM2
$ wget http://files.maniaplanet.com/beta3/ManiaPlanetDedicated_2011-08-16.zip
$ unzip ManiaPlanetDedicated_2011-08-16.zip

$ vim UserData/Config/dedicated_cfg.txt

* change SuperAdmin, Admin, User password (not the name) in authorization_levels
* go to your player account and create a new dedicated server login, and add those credentials to the masterserver_account section (login and password).
* change the name of the server in server_options
* change the connection up and download rate in system_config section
* don’t change the ports, but keep them in mind for later firewall configuration

We will use our own tracklist for matchsettings (generated by a small perl script). Change dnscloud.txt to anything you want.

$ vim RunSrv.sh

#!/bin/sh
./ManiaPlanetServer /game_settings=MatchSettings/dnscloud.txt /dedicated_cfg=dedicated_cfg.txt /title=TMCanyon

Now let’s create the sources for the automated generation of dnscloud.txt – to see an example how the config settings look like, check UserData/Maps/MatchSettings/Beta1.txt or similar. The folder is named like the tracklist txt we will be creating.

$ mkdir UserData/Maps/dnscloud

Now copy that perl script to somewhere applicable and adapt $maindir if you changed dnscloud from above.

$ vim UserData/Maps/MatchSettings/gen_maplist.pl
#!/usr/bin/perl -w
my $maindir="dnscloud";
chdir "/home/tm2/TM2/UserData/Maps/$maindir/";
my @files=<*>;
my $file;

print "<?xml version="1.0" encoding="utf-8" ?>
<playlist>
        <gameinfos>
                <game_mode>2</game_mode> <!-- 2 = TimeAttack -->
                <chat_time>10000</chat_time>
                <finishtimeout>1</finishtimeout>
                <allwarmupduration>0</allwarmupduration>
                <disablerespawn>0</disablerespawn>
                <forceshowallopponents>0</forceshowallopponents>
                <script_name>TMTimeAttack</script_name>
                <rounds_pointslimit>35</rounds_pointslimit>
                <rounds_usenewrules>0</rounds_usenewrules>
                <rounds_forcedlaps>0</rounds_forcedlaps>
                <rounds_pointslimitnewrules>5</rounds_pointslimitnewrules>
                <team_pointslimit>5</team_pointslimit>
                <team_maxpoints>6</team_maxpoints>
                <team_usenewrules>0</team_usenewrules>
                <team_pointslimitnewrules>5</team_pointslimitnewrules>
                <timeattack_limit>240000</timeattack_limit>
                <timeattack_synchstartperiod>0</timeattack_synchstartperiod>
                <laps_nblaps>5</laps_nblaps>
                <laps_timelimit>0</laps_timelimit>
                <cup_pointslimit>100</cup_pointslimit>
                <cup_roundsperchallenge>5</cup_roundsperchallenge>
                <cup_nbwinners>3</cup_nbwinners>
                <cup_warmupduration>1</cup_warmupduration>
        </gameinfos>

        <hotseat>
                <game_mode>0</game_mode>
                <time_limit>300000</time_limit>
                <rounds_count>5</rounds_count>
        </hotseat>

        <filter>
                <is_lan>1</is_lan>
                <is_internet>1</is_internet>
                <is_solo>0</is_solo>
                <is_hotseat>0</is_hotseat>
                <sort_index>1000</sort_index>
                <random_map_order>0</random_map_order>
                <force_default_gamemode>0</force_default_gamemode>
        </filter>

        <startindex>0</startindex>";

foreach $file (@files) {
        print "
        <map>
                <file>$maindir/$file</file>
        </map>";
}

print "
</playlist>";

Now it’s time to place your tracks into UserData/maps/dnscloud – after that run the script to generate a new config. Make sure that the filenames don’t contain special chars or white spaces. Windows doesn’t mind, but this is targetted against Linux.

$ cd UserData/Maps/MatchSettings
perl gen_maplist.pl > dnscloud.txt

Now we need to make sure that all needed ports are opened in iptables – 2350, 3450 and 5000 for xmlrpc, all tcp and udp.

-A INPUT -p tcp -m tcp --dport 2350 -j ACCEPT
-A INPUT -p udp -m udp --dport 2350 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3450 -j ACCEPT
-A INPUT -p udp -m udp --dport 3450 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 5000 -j ACCEPT
-A INPUT -p udp -m udp --dport 5000 -j ACCEPT

Change to tm2 user again, cd into ~/TM2 and run the server.

$ cd ~/TM2
$ ./RunSrv.sh

If you are adding new maps, just re-run the steps on map list generation and restart the server (ps aux | grep ./ManiaPlanetServer and kill the pid, re-run the RunSrv.sh and watch out for future init scripts).

%d bloggers like this: