<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Death of a Gremmie &#187; Gaming</title>
	<atom:link href="http://deathofagremmie.com/category/gaming/feed/" rel="self" type="application/rss+xml" />
	<link>http://deathofagremmie.com</link>
	<description>by Brian Neal</description>
	<lastBuildDate>Wed, 14 Jul 2010 02:31:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Call of Duty Random Map Rotation Generator Script</title>
		<link>http://deathofagremmie.com/2009/07/24/call-of-duty-random-map-rotation-script/</link>
		<comments>http://deathofagremmie.com/2009/07/24/call-of-duty-random-map-rotation-script/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 22:03:12 +0000</pubDate>
		<dc:creator>gremmie</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[cod]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://deathofagremmie.com/?p=285</guid>
		<description><![CDATA[Here is a Python script I wrote to randomly generate a map rotation for our Call of Duty: World at War server. It outputs the &#8220;set sv_mapRotation&#8221; line that you should copy &#38; paste into your server&#8217;s config file. Our gaming clan mainly plays TDM, but we got a second server to try out the [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a <a href="http://python.org">Python</a> script I wrote to randomly generate a map rotation for our Call of Duty: World at War server. It outputs the &#8220;set sv_mapRotation&#8221; line that you should copy &amp; paste into your server&#8217;s config file. Our gaming clan mainly plays TDM, but we got a second server to try out the other objective-based game types. Not knowing which map combinations were the best, I simply wrote a script to generate a random rotation of the non-TDM and non-DM gametypes. Unfortunately, I found out later that there is a 1024 character line length limit in the config file (boo!). So I later modified the script to observe this unfortunate limit. This means you can&#8217;t have very large map rotations.</p>
<p>Here are some notes about the script.</p>
<ul>
<li>The script should work with any Call of Duty game from 1 to W@W. You just have to edit the list of maps and use the appropriate game types. Just be advised that the game type names aren&#8217;t consistent across titles. For example, COD:MW uses &#8220;WAR&#8221; for team deathmatch, while the older games, and COD:W@W use the more familiar &#8220;TDM&#8221;. Not all game types are supported in all titles in the series, and some titles have game types that don&#8217;t exist in other games. E.g. Only COD1 has retrieval (&#8220;RE&#8221;) and behind enemy lines (&#8220;BEL&#8221;).</li>
<li>Put the desired maps you want between the triple quoted lines 9 and 14, and separate them by spaces.</li>
<li>The gametypes  tuple on line 16 contains the game types supported. Edit this to contain the game types you want.</li>
</ul>
<pre>
<pre class="brush: python">
&quot;&quot;&quot;
map_rotate.py 

Generate map rotation for COD:W@W.
25 June 2009 - Brian Neal
&quot;&quot;&quot;
import random

maps = &quot;&quot;&quot;\
mp_airfield mp_asylum mp_castle mp_shrine mp_courtyard mp_dome mp_downfall
mp_hangar mp_kneedeep mp_makin mp_nachtfeuer mp_outskirts mp_roundhouse
mp_seelow mp_subway mp_suburban mp_makin_day
mp_docks mp_kwai mp_stalingrad
&quot;&quot;&quot;.split()

gametypes = (&#039;dom&#039;, &#039;koth&#039;, &#039;sab&#039;, &#039;sd&#039;, &#039;ctf&#039;, &#039;twar&#039;)

combos = []
for gametype in gametypes:
   for map in maps:
      combos.append((gametype, map))

random.shuffle(combos)

# There is a 1024 character limit for lines from the config file...damn.

s = &#039;set sv_mapRotation &quot;&#039;
for game in combos:
   ss = &#039;gametype %s map %s &#039; % (game[0], game[1])
   if len(s) + len(ss) &gt; 1024:
      break
   s += ss

s = s.rstrip()
s += &#039;&quot;&#039;

print s
</pre>
</pre>
<p>Remember that the script is random, so you may get the same map back-to-back, and/or some maps may be missing due to the stupid 1024 character limit. I run it a few times, saving the result into a file, until I get one that looks good. If you are ambitious, you could modify it a bit to prevent these issues, although the code for doing something like that starts to get very complicated.</p>
<p>I hope some people find this useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://deathofagremmie.com/2009/07/24/call-of-duty-random-map-rotation-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
