Definitive guide to running a modded server (Combat, custom maps or otherwise)
MCMLXXXIV
Join Date: 2010-04-14 Member: 71400Members
I keep getting queries from server operators who are having trouble getting set up with modded servers (mainly for my mod, Combat) so I thought I would post a proper guide on how to get this set up.
<!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo-->Before you start<!--sizec--></span><!--/sizec-->
<b>How to look up a mod's ID</b>
Log into Steam on your gaming PC, visit the workshop and subscribe to the mod you want to host. Start up NS2 and wait for it to download. Once it has downloaded, look in your workshop folder at C:\Users\<you>\AppData\Roaming\Natural Selection 2\Workshop and look at the most recently updated folders. One of those is probably the right one.
The folders in the workshop are always of the form m<b>4d41f11</b>_1350933140. The bit in bold is the actual Mod ID that you'll be using below.
<b>What you will need</b>
<ul><li>The mod ID of any server mods you want to run (e.g. Combat Mode is 5f35045)</li><li>The names and mod IDs of any custom maps you want to have in your rotation. (e.g. "ns2_co_core" has mod ID "57f5f9a").</li></ul>
<!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo-->Server Hosting Instructions<!--sizec--></span><!--/sizec-->
<ul><li>Get the dedicated server working with regular NS2</li><li>Create a new batch file in your server's directory and put the following in it (<i>Note, you will need to change everything that is marked in <brackets> in the code blocks below:</i>)<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->cd <your server location>
server.exe -config_path "C:\Users\<your username>\AppData\Roaming\Natural Selection 2\<config folder, e.g. combat>" -modstorage "C:\Users\<your username>\AppData\Roaming\Natural Selection 2\Workshop" -mods "<Server Mods, separated by space, if applicable> <Map mods, separated by space>" -map <first map to start> -name "<My Modded Server>"<!--c2--></div><!--ec2--></li><li>Run the batch file</li><li>The server will create new config files in your C:\Users\<your username>\AppData\Roaming\Natural Selection 2\<config folder, e.g. combat> folder and download all the appropriate mods from the Workshop automatically!</li><li>Close the server down and visit this folder with Windows Explorer: c:\Users\<your username>\AppData\Roaming\Natural Selection 2\<config folder, e.g. combat></li><li>Edit MapCycle.json and put something like this inside it, then hit save:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->{
"mods": [ "<Server mod, e.g. >" ],
"mode": "random",
"time": 30,
"maps": [ { "map": "<map name e.g. ns2_co_core>", "mods": [ "<mod ID, e.g. 57f5f9a>" ] },
{ "map": "<map name e.g. ns2_co_core>", "mods": [ "<mod ID, e.g. 57f5f9a>" ] }
{ "map": "<map name e.g. ns2_co_faceoff", "mods": [ "<mod ID, e.g. 4d41f11>" ] } ]
}<!--c2--></div><!--ec2--></li><li>Start the server again. You're now up and running with your Modded Server!</li></ul>
<!--sizeo:4--><span style="font-size:14pt;line-height:100%"><!--/sizeo-->Example Configurations<!--sizec--></span><!--/sizec-->
<b>If you have any good example configurations, please reply below and I'll add them here:</b>
<!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo-->Combat Mode<!--sizec--></span><!--/sizec-->
<b>Launch Command</b>
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->server.exe -config_path "C:\Users\<you>\AppData\Roaming\Natural Selection 2\combat" -modstorage "C:\Users\<you>\AppData\Roaming\Natural Selection 2\Workshop" -mods "5f35045 55e90a3 4d41f11 4fd7fd4 57c685f 57f5f9a 662442f" -map ns2_co_core -name "Combat Mode Server"<!--c2--></div><!--ec2-->
<b>MapCycle.json</b>
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->{
"mods": [ "5f35045" ],
"mode": "random",
"time": 30,
"maps": [ { "map": "ns2_co_Core", "mods": [ "57f5f9a" ] },
{ "map": "ns2_pulsecombat", "mods": [ "57c685f" ] },
{ "map": "ns2_summitcombat", "mods": [ "4fd7fd4" ] },
{ "map": "ns2_co_veilcombat", "mods": [ "662442f" ] },
{ "map": "ns2_chuteout", "mods": [ "55e90a3" ] },
{ "map": "ns2_co_faceoff", "mods": [ "4d41f11" ] } ]
}<!--c2--></div><!--ec2-->
<!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo-->Before you start<!--sizec--></span><!--/sizec-->
<b>How to look up a mod's ID</b>
Log into Steam on your gaming PC, visit the workshop and subscribe to the mod you want to host. Start up NS2 and wait for it to download. Once it has downloaded, look in your workshop folder at C:\Users\<you>\AppData\Roaming\Natural Selection 2\Workshop and look at the most recently updated folders. One of those is probably the right one.
The folders in the workshop are always of the form m<b>4d41f11</b>_1350933140. The bit in bold is the actual Mod ID that you'll be using below.
<b>What you will need</b>
<ul><li>The mod ID of any server mods you want to run (e.g. Combat Mode is 5f35045)</li><li>The names and mod IDs of any custom maps you want to have in your rotation. (e.g. "ns2_co_core" has mod ID "57f5f9a").</li></ul>
<!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo-->Server Hosting Instructions<!--sizec--></span><!--/sizec-->
<ul><li>Get the dedicated server working with regular NS2</li><li>Create a new batch file in your server's directory and put the following in it (<i>Note, you will need to change everything that is marked in <brackets> in the code blocks below:</i>)<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->cd <your server location>
server.exe -config_path "C:\Users\<your username>\AppData\Roaming\Natural Selection 2\<config folder, e.g. combat>" -modstorage "C:\Users\<your username>\AppData\Roaming\Natural Selection 2\Workshop" -mods "<Server Mods, separated by space, if applicable> <Map mods, separated by space>" -map <first map to start> -name "<My Modded Server>"<!--c2--></div><!--ec2--></li><li>Run the batch file</li><li>The server will create new config files in your C:\Users\<your username>\AppData\Roaming\Natural Selection 2\<config folder, e.g. combat> folder and download all the appropriate mods from the Workshop automatically!</li><li>Close the server down and visit this folder with Windows Explorer: c:\Users\<your username>\AppData\Roaming\Natural Selection 2\<config folder, e.g. combat></li><li>Edit MapCycle.json and put something like this inside it, then hit save:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->{
"mods": [ "<Server mod, e.g. >" ],
"mode": "random",
"time": 30,
"maps": [ { "map": "<map name e.g. ns2_co_core>", "mods": [ "<mod ID, e.g. 57f5f9a>" ] },
{ "map": "<map name e.g. ns2_co_core>", "mods": [ "<mod ID, e.g. 57f5f9a>" ] }
{ "map": "<map name e.g. ns2_co_faceoff", "mods": [ "<mod ID, e.g. 4d41f11>" ] } ]
}<!--c2--></div><!--ec2--></li><li>Start the server again. You're now up and running with your Modded Server!</li></ul>
<!--sizeo:4--><span style="font-size:14pt;line-height:100%"><!--/sizeo-->Example Configurations<!--sizec--></span><!--/sizec-->
<b>If you have any good example configurations, please reply below and I'll add them here:</b>
<!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo-->Combat Mode<!--sizec--></span><!--/sizec-->
<b>Launch Command</b>
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->server.exe -config_path "C:\Users\<you>\AppData\Roaming\Natural Selection 2\combat" -modstorage "C:\Users\<you>\AppData\Roaming\Natural Selection 2\Workshop" -mods "5f35045 55e90a3 4d41f11 4fd7fd4 57c685f 57f5f9a 662442f" -map ns2_co_core -name "Combat Mode Server"<!--c2--></div><!--ec2-->
<b>MapCycle.json</b>
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->{
"mods": [ "5f35045" ],
"mode": "random",
"time": 30,
"maps": [ { "map": "ns2_co_Core", "mods": [ "57f5f9a" ] },
{ "map": "ns2_pulsecombat", "mods": [ "57c685f" ] },
{ "map": "ns2_summitcombat", "mods": [ "4fd7fd4" ] },
{ "map": "ns2_co_veilcombat", "mods": [ "662442f" ] },
{ "map": "ns2_chuteout", "mods": [ "55e90a3" ] },
{ "map": "ns2_co_faceoff", "mods": [ "4d41f11" ] } ]
}<!--c2--></div><!--ec2-->
Comments
A question for us rent-a-server guys,
Is there any way to set relative paths? I cannot set the whole "C:\appdata ..." since I cannot see it. Can config_path be ".\config" ?
It's beyond me why all these folders are not in the same directory to begin with by default, but for people without access to the whole machine, it makes administration a tiresome process as we have to request changes from the host.
Thanks again
The dedicated server wiki needs some serious work.
Is there any way to set relative paths? I cannot set the whole "C:\appdata ..." since I cannot see it. Can config_path be ".\config" ?
It's beyond me why all these folders are not in the same directory to begin with by default, but for people without access to the whole machine, it makes administration a tiresome process as we have to request changes from the host.<!--QuoteEnd--></div><!--QuoteEEnd-->
Yup, just change the directory for the -config_path and -modstorage to whatever you want. The only thing you can't currently change the path for is the server log.txt (it always defaults to your appdata directory).
Mod here, I'll remove the build part.
It seems I have to restart the server like twice a day.
Also, modded servers do tend to need updating at least once a day as the mods and associated maps tend to change quite regularly. I find that it's easiest to do this with a scheduled task that closes and restarts the server and runs once a day, when people in your region are normally asleep!
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->"maps": [ { "map": "ns2_co_core", "mods": [ "57f5f9a" ] },<!--c2--></div><!--ec2-->
needs to be
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->"maps": [ { "map": "ns2_co_Core", "mods": [ "57f5f9a" ] },<!--c2--></div><!--ec2-->
It's case sensitive
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->"maps": [ { "map": "ns2_co_core", "mods": [ "57f5f9a" ] },<!--c2--></div><!--ec2-->
needs to be
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->"maps": [ { "map": "ns2_co_Core", "mods": [ "57f5f9a" ] },<!--c2--></div><!--ec2-->
It's case sensitive<!--QuoteEnd--></div><!--QuoteEEnd-->
Thanks for the tip! Guide is updated...
This is a SINGLE string. Don't edit it with enters. Or you're gonna look for mistakes for several #### hours.
Disclaimer: I'm not a server op, some of those guys may have some better advice!
I don't want the Combat modid on that first line of MapCycle.json, as I don't want to run CO on every map.
With this MapCycle.json, I can change to ns2_co_faceoff only when the ns2_co_faceoff modid is the only modid on that line. Once I add the CO modid (two modids on the same line, space-delimited), the changemap fails with server and client errors (clients are disconnected with "File not found"):
The same MapCycle.json (that has both modids on the ns2_co_faceoff line and generates errors on changemap) allows me to start the server with "-map ns2_co_faceoff" just fine, and things play perfectly, but the server and client errors (and disconnections) return the next time I change the map to ns2_co_faceoff.
So, is it fair of me to want NS2 and CO on the same server, depending on the map?
The lua looks like it should handle that properly, as it's not doing anything different for the global vs. the map specific ones. It seems like the problem is that it's just incorrectly interpreting the two mods as one mod, but the [ ... ] syntax appears to indicate a comma delim array so that should work...
I have a problem with your mod i can't download it. I get this error:
So i have download the mod with my ns2 steam account and copying files in the workshop server folder but when i launch my server that erase all the files and trying to download the mod. Can you help me please ?
Thank you