Fraggin Rockets

Randomize Your OpenArena Map Lists

by admin on Jul.10, 2009, under FPS

The FragginRockets Open Arena server makes use of a completely randomized map list so that a certain map should not be repeated with the same settings for a very long time. This is done using a simple Python script and a crontab. If you are interested in randomizing your server’s map list, then this tutorial is for you.

To start off with, most map lists look something like the default Open Arena map rotation:

timelimit 15
fraglimit 35
g_gametype 0
set d1 “map aggressor; set nextmap vstr d2″
set d2 “map oa_dm1; set nextmap vstr d3″
set d3 “map oa_dm2; set nextmap vstr d4″
set d4 “map oa_dm3; set nextmap vstr d5″
set d5 “map oa_dm4; set nextmap vstr d6″
set d6 “map kaos2; set nextmap vstr d7″
set d7 “map oa_dm5; set nextmap vstr d8″
set d8 “map oa_rpg3dm2;set nextmap vstr d9″
set d9 “map oa_shouse; set nextmap vstr d1″
wait
vstr d1 // start loop at d1
This list uses an unchanging frag and time limit as well as an unchanging game type. It also does not cover minimum bot players or bot skill, instantgib or rocket arena. Varying these options per map would make the rotation a lot more interesting.

The Python script used is split into two sections. The first identifies the map rotation lists to create and their settings and the second part uses this configuration to create Open Arena map list. Configuration is simple and uses a Python dictionary with a straight-forward setup:

data = {
    'rotation-list-ffa.cfg': {
        '__config__': { 'count': 20 },
        '__defaults__':  {
            # Defaults so maps do need to copy/paste
            'bot_skill':    [x*1.0/10 for x in range(28,41)],
            'g_gametype':   0,
            'bot_minplayers': [0],
            'g_instantgib': [0,0,0,0,0,0,1],
            'g_rockets':    [0,0,0,0,0,0,0,1],
            'timelimit':    range(10,21,5),
            'fraglimit':    range(20,31),
            'bot_minplayers': [5,6] #Up to six players on these
        },
        'oa_dm1': {
            # Specific settings (same as in __defaults__)
            # to override default values
        },
        'oa_dm2': {}, # Leave empty to use defaults
        'oa_dm3': {},
        'oa_dm4': {},
        'kaos2': {},
        'oa_dm5': {},
        'rpg3dm2': {},
        'oa_shouse': {}
        ... more maps to be selected for map-filename.cfg
    },
    ... more maps lists
}
Ultimately, the items given in the __defaults__ dictionary for a map list are the items to be configured for each map created in the target map list. The corresponding values are a list of possible values. The script simply picks one value out of the list, so duplicates are welcome. Notice that you can use the range() function or list expansions to make your random value lists easier to configure later.

One of the interesting features is the list for g_instantgib. Since python lists can contain duplicates and the randomizer will simply select a single value randomly out of the list, g_instantgib will be set to one (enabled) in 1 out of 7 maps. Similarly, rocket arena will be enabled in 1 out of 8.

As configured above, the script will create a file named rotation-list-ffa.cfg which map look something list this

set d1 "timelimit 20; bot_minplayers 5; g_rockets 0; bot_skill 3.7; g_instantgib 0; g_gametype 0; fraglimit 21; map oa_rpg3md2; set nextmap vstr d2"
set d2 "timelimit 10; bot_minplayers 5; g_rockets 0; bot_skill 3.6; g_instantgib 1; g_gametype 0; fraglimit 27; map oa_dm4; set nextmap vstr d3"
set d3 "timelimit 10; bot_minplayers 6; g_rockets 0; bot_skill 3.8; g_instantgib 0; g_gametype 0; fraglimit 27; map oa_dm5; set nextmap vstr d4"
set d4 "timelimit 15; bot_minplayers 6; g_rockets 0; bot_skill 3.4; g_instantgib 1; g_gametype 0; fraglimit 29; map oa_shouse; set nextmap vstr d5"
set d5 "timelimit 15; bot_minplayers 6; g_rockets 0; bot_skill 3.8; g_instantgib 0; g_gametype 0; fraglimit 24; map oa_dm2; set nextmap vstr d6"
set d6 "timelimit 10; bot_minplayers 6; g_rockets 0; bot_skill 3.2; g_instantgib 0; g_gametype 0; fraglimit 28; map oa_dm3; set nextmap vstr d7"
set d7 "timelimit 15; bot_minplayers 5; g_rockets 0; bot_skill 2.8; g_instantgib 1; g_gametype 0; fraglimit 23; map kaos; set nextmap vstr d8"
set d8 "timelimit 20; bot_minplayers 6; g_rockets 1; bot_skill 3.0; g_instantgib 0; g_gametype 0; fraglimit 28; map oa_dm1; set nextmap vstr d9"
set d9 "exec rotation-list-ffa.cfg"
vstr d1

The main difference between this script and the default Open Arena map rotation is on the second-to-last line, where, rather than the map list starting over, the server is instructed to re-read the map list file. If you configure a crontab or scheduled task to re-run the python script before the server finishes the map list, it will read the newly-randomized list rather than starting the same list over. Hence, the list is completely randomized.

Check out the attached script and enjoy.

Leave a Comment : more...

Hello world!

by admin on Jul.10, 2009, under Uncategorized

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

1 Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...