Dedicated Server Setup

The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
Hello,

I am new to the NS2 front. Please can someone explain to me how to set my server to execute a configuration file or give me an example of a standard configuration file for the server to run? I have followed a tutorial on youtube, downloaded SteamCMD, downloaded the NS2 dedicated server files, allowed the program through windows firewall, no portwarding is required as it's not behind NAT. I need to know what the server.txt file is supposed to have in it and what commands i need to add to the shortcut target line in order to get it to execute.

Any support would be appreciated.
«1

Comments

  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    Note sure which tutorial video you followed, but the most up-to-date server info is located on the wiki page: http://wiki.unknownworlds.com/index.php/Dedicated_Server

    The biggest issue I see from new server operators is getting the launch options and config files setup correctly. Personally, I prefer launching the servers from a windows batch file with a setup like this:
    @echo off
    
    cd D:\NS2Server2
    C:\Windows\system32\cmd.exe /C start /high "NS2 Server 2" Server.exe -name "Server Name" -config_path "C:\server\config" -map ns2_summit -limit 20 -ip 192.168.0.10 -port 27015 -webadmin -webdomain 192.168.0.192 -webport 80 -webuser user -webpassword password
    

    To turn that into a shortcut launch options all you need is to put the following in the target line:
    -name "Server Name" -config_path "C:\server\config" -map ns2_summit -limit 20 -ip 192.168.0.10 -port 27015 -webadmin -webdomain 192.168.0.10 -webport 80 -webuser user -webpassword password
    
    The only necessary commands are
    - name
    - map
    - limit
    But I find the rest helps so you can manually specify things such as the config file location (-config_path), the server ip (-ip), the server port (-port), and the webadmin info (-webadmin, -webdomain, -webport, -webuser, -webpassword).

    The easiest to setup the config files is to launch your server once as it will automatically generate the files either in the config_path you specified or at the default location in the \AppData\Roaming\Natural Selection 2 folder. From there, the ones you'll likely want to modify are the serveradmin.json, serverconfig.json, and mapcycle.json files (all of which can be editted in any common text editor, though I prefer Notepad++).

    Adding a server admin to your serveradmin.json is easy. The best layout (imo, since its robust about including new admin commands should UWE add anymore) is:
    {
        "groups":
        {
            "admin_group": { "type": "disallowed", "commands": [
    	] }
        }
        
        "users":
        {
            "nsplayer1": { "id": 12345, "groups": [ "admin_group" ] },
            "nsplayer2": { "id": 12345, "groups": [ "admin_group" ] }
        }
    }
    
    Where all you have to do is change the number next to the "id" category to the SteamID's (converted to the appropriate format) of any admins you want.

    Next up is the serverconfig.json, which deals with the in-built afk kick, autoconcede, and autobalance features in addition to whether you want your server to show up as rookie friendly (i.e. green instead of white) on the server browser. The values are explained on the wiki, but my personal favorite setup is:
    {
        "settings":
        {
    	"rookie_friendly": false,
    	"end_round_on_team_unbalance": 0.5,
    	"auto_kick_afk_time": 600,
            "auto_team_balance":
            {
                "enabled_on_unbalance_amount": 5,
                "enabled_after_seconds": 10
            }
        },
    	"auto_kick_afk_capacity": 0.5
        "tags": [ "ns2" ]
    }
    
    This setup will:
    - Turn on afk kick after the server is 50% full and kick players who are afk for 5min (600s)
    - Autoconcede the round when one team has only 50% of the players of the other
    - Turn on autobalance when one team has more than 5 players than the other, after 10s
    You can adjust these values to whatever you desire, but this setup only kicks players for long-term afking (e.g. I feel 5min is enough for people who want to take a quick bathroom/drink/snack break between round) and typically causes an autoconcede rather than autobalance when big team imbalances occur.

    The final config file you'll like want to adjust is the mapcycle.json. Here's mine for reference.
    {
      "time": 30,
      "mode": "order",
      "maps": [ "ns2_refinery", "ns2_docking", "ns2_summit", "ns2_veil", "ns2_mineshaft", "ns2_tram", "ns2_descent" ]
    }
    
    Basically, the "time" is how long you want to be on a map before it changes to the next, the "mode" is how you want the server to switch between the maps (order means it just goes to the next one on the list), and "maps" are all the maps you want in the server rotation.

    That covers the most important basics. There are other more advanced server options you can do (e.g. setting up the webadmin, mods/custom maps, advanced consistency checking, etc), but it's best to get the bare minimum working and then add complexity from there.
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    Hello,

    Thank you for this extensive response. After trying these steps however i am still having issues. And i fail to see where the command is to execute the server.txt file. I have tried doing the batch file as you mentioned but i am no further forward. It seem the steps i previously followed in the tutorial were out of date. so to sum it up:

    The core files are installed, i created a folder called Config in the c:\ns2server directory, the json files are all there along with the server.txt file.

    My server.exe shortcut target reads this:

    C:\ns2server\Server.exe -name "NS2 Server" -config_path "C:\server\config" -map ns2_summit -limit 20 -ip 217.160.236.244 -port 27024

    The .bat files reads this:

    @echo off

    cd C:\ns2server
    C:\Windows\system32\cmd.exe /C start /high "ns2 server" Server.exe -name "NS2 Server" -config_path "C:\ns2server\config" -map ns2_summit -limit 20 -ip 217.160.236.244 -port 27024

    And finally, the server.txt file, located in C:\

    -port 27024 -ip 217.160.236.244 -map ns2_summit -limit 20 -name "NS2 Server" -config_path "C:\ns2server\config" -file "C:\ns2server\config\server.txt"

    Please note: i have tried to execute both the .BAT and the server shortcut individually, and i get no further forward. Can you tell me what i am doing wrong, or can you give me the information needed to get the server to boot from the server.exe shortcut? Basically if you give me the correct shortcut target commands and the server.txt file then i can see where i am going wrong.

    I can add administrators and change map cycles once i know the server is actually running.

    I have had trouble in the past with the CODMW3 server and AVP3 because steps needed to get there config files to execute were not really correct, i would hate to have the same issues again.

    Thanks again.

  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    And sorry,

    I meant that the server.txt file is located in: C:\ns2server\config
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    C:\ns2server\Server.exe -name "NS2 Server" -config_path "C:\server\config" -map ns2_summit -limit 20 -ip 217.160.236.244 -port 27024
    This should work once you've fixed -config_path "C:\server\config" to be -config_path "C:\ns2server\config" (since you said you created your config folder in the C:\ns2server directory).

    The server.txt info is outdated as you don't need that anymore. The key parts are getting your server shortcut or batch file and the json config files setup properly. You also don't need both the shortcut and batch, just one or the other (in your case, I'd start with getting the shortcut working first as its simpler).

    Also, could you describe the exact problem you're encountering? For example, is the server window showing up when you run the shortcut? Is it showing up but not loading the correct config files? Is it all loading, but no one can join your server? etc.
    I have had trouble in the past with the CODMW3 server and AVP3 because steps needed to get there config files to execute were not really correct, i would hate to have the same issues again.
    Unfortunately, this is common in online multiplayer games as server instructions generally presume a much more advanced user than the average gamer. The wiki instructions are the best attempt by both UWE and various server operators to explain it in as straight-forward manner as possible. However, many of us have had to do a bit of trial-and-error to troubleshoot/figure out the best method (as there is typically several ways to setup a server).
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    Hello,

    I appreciate your time but nothing has changed even with altering the mistake i made. I have normally been able to get servers working in the past with making alterations to their perameters but in this case it does the same thing, regardless of what i do.

    Basically i open the server.exe shortcut, i will have to provide a screenshot as i cant copy and paste from the window (screnshot below)

    It gives me this same details regardless of what settings i put with the exception of missing the IP address out it says failed to connect to steam servers. So i think something is wrong. Should i just delete the config folder, server.exe shortcut and start over? If it helps in understand where i may be going wrong, i have installed the files to C:\ns2server, server.exe is allowed through the firewall, the server.ex cmd says it's connected to steam servers, where as if i don't specify the IP then it says failed to connect. I can't think of anything else that i have done to stop it from working, if a server.txt file is no longer required and it's just a matter of specifying commands in the server.exe target line then it should be relatively straight forward like every other server i have set up.

    NS2.png 23.9K
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    And when i use the tab key to go to the other console window it's just a blank grey window.
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    That screenshot looks like everything's working normally, though if you could scroll to the top of the window and post a screenshot from that part, it'd be helpful. Also, have you tried joining the server? If it doesn't show up in the server browser (which is usually, though not always, a blocked port issue), then you can try connect IP:port to connect manually.

    If its saying that it can't connect to steam servers, try checking if steamfriends is working on that computer (sometimes the steam servers go down or you lose your connection to them and the easiest way to check is trying steamfriends).

    Also, the server window doesn't really provide great feedback and nothing like the server name, player limit, etc.
    And when i use the tab key to go to the other console window it's just a blank grey window.
    Yeah, this is a bit funky in to access the server console from the server window you have to
    - Select the server window
    - Hit tab
    - Select the new, popped up blank grey window
    - Hit tilde (~)
    It may also take a little bit to actually open the console part (I've had it hang for a few minutes before, but it typically works in 60s or less).
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    Hello,

    Thanks for the reply.

    The above part says:

    Press Tab to open the console window
    Press Ctrl-c to exit
    Build 239
    Setting breakpad minidump appid = 4920
    Connected to steam servers
    VAC Enabled

    I will try and get the console window working.

    Thanks again.
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    Build 239
    Well, that might be your problem. Build 240 was just released yesterday. Run SteamCMD again to update your server to B240.
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    edited March 2013
    We've tried it for a few days even prior to the update. I am going to remove the tools and re-install again and do everything from scratch. That way i can see if i have gone wrong as all the files will be created from scratch. Does the DS have issues with any operating systems or with 64bit? One of my admins have also just informed me that even with the server running it's not visible in the list.

    Also, tried running the console as you said but it stayed as a grey window (blank) even after several minutes and attempts. Tried compatability mode also.
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    edited March 2013
    Ok i deleted the previous folder and downloaded all the server files again. I have not made any changes or created anything additional, so now there are just the core installation files. Can you advise me on what to do next so i can see exactly where i may be going wrong. I just want to set the basics so i can confirm the server will launch.

    Thanks again.
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    edited March 2013
    If i put this: -name "Server Name" -config_path "C:\server\config" -map ns2_summit -limit 20 -ip 192.168.0.10 -port 27015 in my shortcut target (adjusting to my IP / config folder etc and run the server should it in theory at least boot up and be visible?

    I don't need to web admin stuff yet so i left that part of the target out.
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    If i put this: -name "Server Name" -config_path "C:\server\config" -map ns2_summit -limit 20 -ip 192.168.0.10 -port 27015 in my shortcut target (adjusting to my IP / config folder etc and run the server should it in theory at least boot up and be visible?

    I don't need to web admin stuff yet so i left that part of the target out.
    Yup, that's all you need and it should show up in the server browser.

    I'm not sure what's going on if it's not. Is there a chance you screencapture a short video to show how your setting everything up and what happens when you start the server?

    Also, more info on your hardware/setup is probably in order now (e.g. is this a colocated machine at a datacenter or a desktop at your house? What are the router/modem info if its the later? etc).
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    Hi Bob,

    Thank you for confirming. After deleting the old installation files of 239 and removing the old redundant config files, then re-downloading the files of 240, entering the target as above and launching, i can confirm the server is now functional. One of my admins has also confirmed visability in the list, and successfully connected to the server.

    So the issue was the out-of-date tutorial and old config files causing a bad setup. For a minute i thought i was becoming out of date myself haha, but after following the up to date steps, configuration is relatively simple. The error messages i got from previous console are now gone also.

    My admin tells me that the match is a "rookie friendly", are there any options that can be added or removed from the target line to add more functionality or options to the game? Or are they in these json files?

    Thank you very much for your support in this matter, you have indeed given excellent support and patience in to resolving my issue.
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    Just read your first post and you mentioned about the rookie friendly in the json so that confirms that. But are there any other commands i can add to the shortcut target to change / improve the game?
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    Only if you want to use the webadmin or run custom maps/mod.
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    Hello,

    The server seems to be running without issue following a few days testing and several clients have joined so thank you for your help. One of my admins has asked me about adminsitration on the server. Do i require all of this code in the target line?

    "-webadmin -webdomain 192.168.0.10 -webport 80 -webuser user -webpassword password"

    We simply want to log in to administration from in-game, we don't necessary require a browser-based admin portal at this time, however it may be useful. If it's easier to set the whole thing up then i can just do that.

    Also, how would we log-in to the adminsitration system from in-game? Is there a specific log in code? Or does the admin obtain automatic control should we put steam ID / username in to a specific file?

    Many thanks,
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    Hello,

    The server seems to be running without issue following a few days testing and several clients have joined so thank you for your help. One of my admins has asked me about adminsitration on the server. Do i require all of this code in the target line?

    "-webadmin -webdomain 192.168.0.10 -webport 80 -webuser user -webpassword password"

    We simply want to log in to administration from in-game, we don't necessary require a browser-based admin portal at this time, however it may be useful. If it's easier to set the whole thing up then i can just do that.

    Also, how would we log-in to the adminsitration system from in-game? Is there a specific log in code? Or does the admin obtain automatic control should we put steam ID / username in to a specific file?

    Many thanks,
    The target line stuff is just for the webadmin (which I find useful to admin servers when I'm not on my gaming PC). However, once you add someones SteamID to the serveradmin.json, they should have access to all of the admin commands via their console. The only command you need to remember is sv_help, as typing that into the console will show you all the available admin commands and their syntax.
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    edited March 2013
    Hi Bob,

    Thanks for this. But we seem to have another issue. Although the server has been working great and has plenty of players, one of my admins has reported to me that the server is no longer visible in the list as of last night. Despite several refreshes of the server list and relaunches of the server application. I had a couple of errors on console, 1 was caused by Steam dropping, the other was a level based error. (Screenshot attached). an you give me the update code to update and verify the installation of NS2? Is it something like:

    SteamCmd +login user password +force_install_dir c:\ns2server\ +app_update id validate

    We haven't changed anything so i can't see why the server would suddernly become invisible.

    Thanks,
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    And here is the screenshot:
  • unter_hosenunter_hosen Join Date: 2003-01-05 Member: 11858Members, Constellation
    The Ancient, it looks like you are running the server behind NAT, so this may be causing some issues.

    Also the last line of the console screenshot doesnt look right.

    Are you running server build, or a client build?

    If you are running a server only build then the SteamCMD batch file should say

    SteamCmd +login user password +force_install_dir c:\ns2server\ +app_update 4940 validate

    If you installed the client build, then replace 4940 with 4920
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    Hi Bob,

    Thanks for this. But we seem to have another issue. Although the server has been working great and has plenty of players, one of my admins has reported to me that the server is no longer visible in the list as of last night. Despite several refreshes of the server list and relaunches of the server application. I had a couple of errors on console, 1 was caused by Steam dropping, the other was a level based error. (Screenshot attached). an you give me the update code to update and verify the installation of NS2? Is it something like:

    SteamCmd +login user password +force_install_dir c:\ns2server\ +app_update id validate

    We haven't changed anything so i can't see why the server would suddernly become invisible.

    Thanks,
    UWE released a small patch last night that fixed a webadmin problem so its best to update your server if something isn't running properly. The update command would be:

    SteamCmd +login user password +force_install_dir c:\ns2server\ +app_update 4940 validate
    or
    SteamCmd +login user password +force_install_dir c:\ns2server\ +app_update 4940 verify

    Where user and password are the username and password of the steam account your using to download the files.

    Sometimes the server not showing up in the list is a steam issue. When their servers are down for maintenance (typically around 4pm PST on Tues or Wed, but they do have unplanned downtime on occasion), your server won't show up on the list. If the issue persists for more than a few hours, then something else may be going on.

    Also, its typically more useful to post your servers log.txt rather than a screenshot of the server window, as it provides more info to help diagnose problems. You can find it n the servers \AppData\Roaming\Natural Selection 2\ folder.
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    Hi,

    Thanks for the responses.

    @ unter_hosen

    I assume server build because it was downloaded by SteamCMD on a machine that is used only for hosting. I think it would be 4940 as thats the version mentioned on the dedicated server setup on the wiki. It's not behind any NAT or hardware firewall.

    @ ScardyBob,

    Will give the update a try, as i said before nothing has changed on our behalf so it may be just the update causing the issue, I could see others servers i nthe NS2 list but not hours, even after several refreshes and restarts of server.exe.

    Will double check it now.
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    However i have just booted the console again after the update and it says 4920. Yet i used 4940 in the SteamCMD update perameter.
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    Hi Guys,

    After running the updater the server is now visible in the list once again. I will make a note of this update code.

    Many thanks once again.
  • unter_hosenunter_hosen Join Date: 2003-01-05 Member: 11858Members, Constellation
    Hi The_Ancient

    Glad to hear you have it running now.

    I only mentioned it being on a NAT as you put this line in one of your posts

    "-webadmin -webdomain 192.168.0.10 -webport 80 -webuser user -webpassword password"

    192.168.0.0/24 is a private address space, indicating that you were behind a NAT of some kind :)

    Unter
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    Hi,

    Thanks for the responses.

    @ unter_hosen

    I assume server build because it was downloaded by SteamCMD on a machine that is used only for hosting. I think it would be 4940 as thats the version mentioned on the dedicated server setup on the wiki. It's not behind any NAT or hardware firewall.

    @ ScardyBob,

    Will give the update a try, as i said before nothing has changed on our behalf so it may be just the update causing the issue, I could see others servers i nthe NS2 list but not hours, even after several refreshes and restarts of server.exe.

    Will double check it now.
    4920 is fine to use also. The distinction is:
    4920 = Client NS2 Version (includes all of the server stuff)
    4940 = Server NS2 Version (only includes stuff relevant to the server, e.g. no HUD, models, etc).

    The differences are to provide NS2 server operators a free version with just the bare minimum to run a server. However, if the steam account you use to login to SteamCMD has NS2 purchased on it, its best to use the 4920 version (so consistency checking works better).
    Hi The_Ancient

    Glad to hear you have it running now.

    I only mentioned it being on a NAT as you put this line in one of your posts

    "-webadmin -webdomain 192.168.0.10 -webport 80 -webuser user -webpassword password"

    192.168.0.0/24 is a private address space, indicating that you were behind a NAT of some kind :)

    Unter
    I don't think that is his actual IP as he was just copying the text I wrote. One of the servers that I help operate (Team156 Seattle) are run behind a NAT (residential router), which is why I have the private address space there.
  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    Hi Guys,

    Thanks for the info. The post about the 192. ip scope was Bob's example, where as i am running a dedicated node. I have another server that requires port forwarding but it's used for older less demanding games.

    Thanks,
  • unter_hosenunter_hosen Join Date: 2003-01-05 Member: 11858Members, Constellation

    ScardyBob wrote: »
    I don't think that is his actual IP as he was just copying the text I wrote. One of the servers that I help operate (Team156 Seattle) are run behind a NAT (residential router), which is why I have the private address space there.

    Wow, I mean if it works, it works. Must be a half decent residential router for it to keep up with the NAT translations. I would be very tempted to try GNS3 with Cisco ASA running on an old PC, might chop a few ms off of the response time.

  • The_AncientThe_Ancient Join Date: 2013-03-01 Member: 183511Members
    Hi Bob,

    Yet another issue, ever since the 244 update the server no longer accepts clients. I already updated the game with SteamCMD and re-allowed the program through windows firewall, aside from that nothing else has changed. The error is: "incorrect network protocol". Screenshot attached: (Nothing has changed on the server) so I don't understand why this error would suddenly come about. Any support appreciated.

Sign In or Register to comment.