Dynamic Map Rotations is a plugin I wrote to allow me to automatically alter the map rotation based on the current server conditions. With Dynamic Map Rotations, you can skip maps based on the number of players on the server or the time of day, and it's easy to add more conditions.

Every map is its own section with an arbitrary section name. In this case, the names are "10", "20", and "30", but they could easily be the mapnames themselves or whatever you want.

There is a "start" keyvalue pair that indicates the first map in the rotation.

Within each section is a "map" keyvalue pair whose value is the actual name of the map.

Within each section is a "default_nextmap" keyvalue pair. The value points to the section of the nextmap. For example, notice how in section 30 (cp_dustbowl), the default_nextmap is section 10 (cp_gravelpit).

The above DMR looks like:
Now let's say we want to skip ctf_well when the number of players on the server is <= 12. The corresponding DMR looks like:

Notice the subsection added within section 10 (cp_dustbowl). This is called a conditional nextmap. Basically, the red highlighted section can be read as "if the number of players is lte (less than or equal to) 12, then the nextmap is section 30 (cp_dustbowl)". If the conditional nextmap isn't true, which in this case means there are more than 12 players on the server, then the default_nextmap is used as the next map. Visualized, this looks like:
One more example. Let's add cp_badlands to the rotation and throw in a few more conditional nextmaps:

Before I discuss it, here is the visualization:
First, notice how I used the section name "bdlnds". Remember that section names are arbitrary -- I could have just been consistent and chosen "40" or chosen anything at all.

Let's look closely at section 20 (ctf_well). There are two conditional nextmaps and a default_nextmap. The first condition reads "IF the number of players <= 10 AND the current server time is <= 11AM, THEN the next map is section bdlnds (cp_badlands)". The second condition reads "IF the number of players <= 10 THEN the next map is section 10 (cp_gravelpit). If none of the conditional nextmaps are true, then the nextmap is the default_nextmap: section 30 (cp_dustbowl).

Conditional nextmaps are evaluated in the order they're written, and the first one that is true is taken. So in the case of ctf_well, if the number of players were, for example 8, and it was 1AM, then the next map would be cp_badlands. If the number of players were 8 and it was 2PM, then the next map would be cp_gravelpit. It's really pretty straightforward!

Automated DMR Generator
Understandably, typing up a DMR is a pain. I've written a simple web tool to help get you started as well as visualize your DMR.

Simply paste your mapcycle.txt into the top text box to generate the basic DMR. You can then modify it to add custom conditions. You can use the bottom text box to create a visualization of your DMR similar to the example images you've seen in this post.

Custom Conditions

players_lte - the number of players on the server is less than or equal to the specified number

players_gte - ditto, but greater than or equal to

time_lte - the current server time is less than or equal to the specified time, in 24-hour "h:mm" format

time_gte - ditto, but greater than or equal to

day_eq - the day is currently a certain day of the week, where the day is specified with m, t, w, r, f, s, and u for Monday, Tuesday, etc. You can specify multiple days. For example, "day_eq" "mwf" will be true if the day is Monday, Wednesday, or Friday. "day_eq" "u" will be true if the day is Sunday.

Create a dynamic map rotation and copy it to your game's root directory (the same directory as mapcycle.txt, most likely

Copy dmr.smx to your SourceMod plugins directory

Note: dmr.inc is for plugin authors. You do not need to download dmr.inc for a normal installation.

Other CvarsThese cvars are modified and used directly by the plugin and should be considered read only. Modify them at your own peril.

dmr_map_key - the current section key in the rotation. DMR will base its nextmap decisions on this section's conditional nextmaps/default_nextmap.

dmr_force_nextmap - if sm_setnextmap was used, this cvar stores the value of the nextmap that will be loaded in lieu of the DMR-based nextmap. Setting this value directly will not guarantee it will be used: use sm_setnextmap.

Compatibility
This plugin was developed for a TF2 server, but I don't have any reason to believe it would misbehave in other games. Please let me know if it works with other games.

Version History

2008-03-20 - v0.1

Initial release

2008-03-25 - v0.2

Fixed bug with Insurgency mod

Added GetNextMaps() function for other plugins to retrieve a mapcycle-like list of next maps

One thing I should note is that I don't know if DMR plays nice with rockthevote and similar map-related plugins. I really don't know either way (I haven't looked into it) but I'll be sure to resolve this for the next version. DMR seems to work fine with basevotes/votemap and rockthevote. I don't know enough about mapchooser yet to test it out with mapchooser, but I suspect there will be issues with mapchooser.

Let me know if you need any help constructing your dmr.txt. I'm on gamesurge as FLOOR_MASTER.

im gonna try this on my insurgency server (217.163.31.17:27015). many thanks for the automated generator - it helped me alot for figuring this baby out i'll let you know the outcome. for your reference my following rotation is set to:

Your dmr.txt is perfect, so the error involves some incompatibility between the plugin and Insurgency. I'm downloading the Insurgency client/server now and will try to duplicate the problem.

thanks thats very much appreciated.

just in case its me being thick......i added the cvars (dmr_map_key and dmr_force_nextmap) to the sourcemod.cfg file, exactly how you wrote them above ^^ (e.g. without numbers/values against them). if it was me being thick - apologies

just so you know it is controlling the map rotation as nextmap.smx is disabled and the maps are rotating just not using the dynamic function that this plugin is made for.