NS2 Server support
oldassgamers
Join Date: 2011-02-02 Member: 80033Members, Squad Five Blue, Reinforced - Shadow
Hello guys, I just have two fast question about hosting a ns2 server. Someone who can help?
<b>1.</b> How do you create a server using a specific core for cpu. Example: Core 2 - ns2 server , core 3 - another ns2 server.
<b>2.</b> Each time uwe releases an update I want my servers to auto-update its software.
<b><u>
Progress report:</u></b>
<b>Update 1 - GMT +1 (15.22) </b>
I wrote this specfic command ""C:\Service\NS2 Servers\Server 2\server.exe -file "c:\Service\NS2 Servers\Server 2\config\server.xml"" and it tells me it doesn't work in windows.
<b>Update 2 - GMT +1 (15.24)</b>
Getting frustrated, hitting my keyboard....
<b>Update 3 - GMT +1 (15.28) </b>
Viewing carefully ScardyBob post and notice that all director was name intact with no space. for instance: "C:\ns2_configs\west1.xml" .
Rechanged coding to the following: C:\Service\NS2_Servers\Server_2\server.exe -file "c:\service\ns2_servers\server_2\config\server.xml"
IT WORKED!!
<b>Update 4 - GMT +1 (15.43) </b>
Struggling to create a bat file, found this tutorial <a href="http://www.computerhope.com/batch.htm#11" target="_blank">http://www.computerhope.com/batch.htm#11</a> . I'm stuck with the most noobish ever, created a notepad .txt file and i cannot convert it, can't figure out the bloody windows map configuration file to be able to change notepad to .bat file.
<b>Update 5 - GMT +1 (15.47) </b>
Found the solution to view all text format for example: .txt files clicking "alt" in a folder. Brings up a menu called tools, at the button if that option you'll see map alternativ (translating from swedish windows to english, so it may not be the exact word). Struggling now to bind two affinity for one server.exe file using .bat file
<b>Update 6 - GMT +1 (16.43) </b>
I've created a bat file with this specific command:
cd \service\ns2_servers\server_1
c:\windows\system32\cmd.exe /C start /affinity 3 /high server.exe -file "c:\config\server.xml"
When opening the .bat file it automatlic closes. Seems not to work....
<b>Update 7 - GMT +1 (17.05) </b>
Following Skie coding. start /AFFINITY 3 server.exe -file X:\Games\HLSERVER\NS2\server.xml -game X:\Games\HLSERVER\NS2\NS2GmOvrmind - When doing so i get error couldn't initalize game at that specific locatin. So I used the following code:
cd C:\service\ns2_servers\server_1
start /affinity 3 /high server.exe -file C:\Service\ns2_servers\server_1\config\server.xml
Seems to work now, its up and running. Affinity 3 command has locked down cpu 0 and cpu 1. So thats good :)
<b>Update 8 - GMT +1 (17.15) </b>
I learned that you don't have to use numbers but may also used letters. Ex: Affinity 3 locks cpu 0 + 1. While affinity C locks cpu 2 + 3. But according to my affinity option i have cpu 0,1,2,3,4,5,6,7 . So I'm guessing that cpu 0+1 is core 1 , cpu 2+3 is core 2, etc etc. What you guys think?
Anyways i found a good tutorial regarding affinity <a href="http://www.techenclave.com/topic/392508-cpu-affinity-made-easy/" target="_blank">http://www.techenclave.com/topic/392508-cp...nity-made-easy/</a>
<b>Update 9 - GMT +1 (17.35) </b>
Found good affinity explanation, although did not get my answer how to bind the rest cpu's , i got i7 4 cores, so i got 7 cpu in windows i can choose from. Anyone knows this?
CPU3 CPU2 CPU1 CPU0 Bin Hex
================================
OFF OFF OFF ON = 0001 = 1
OFF OFF ON OFF = 0010 = 2
OFF OFF ON ON = 0011 = 3
OFF ON OFF OFF = 0100 = 4
OFF ON OFF ON = 0101 = 5 confirmed via task manager
OFF ON ON OFF = 0110 = 6
OFF ON ON ON = 0111 = 7
ON OFF OFF OFF = 1000 = 8
ON OFF OFF ON = 1001 = 9
ON OFF ON OFF = 1010 = A confirmed via task manager
ON OFF ON ON = 1011 = B
ON ON OFF OFF = 1100 = C
ON ON OFF ON = 1101 = D
ON ON ON OFF = 1110 = E confirmed via task manager
ON ON ON ON = 1111 = F
<b>Update 10 - GMT +1 (17.55) </b>
So if I understand this correctly, i got i7 4 core cpu. Which is 2 thread per 1 core = 0,1,2,3,4,5,6,7 cpu in total
Writing /affinity F locks down cpu 0,1,2,3 = which means 2 cores. Now comes the tricky question, how to lock down the remaining 4,5,6,7 ? with affinity command....
<b>Update 11 - GMT +1 (21.55) </b>
<u>Found an explanation by strunker att mmo-champions.com about why i got 7 different cpu on affinity:</u>
This is what is called hyper threading which basically splits each core into 2. 1 physical core and 1 virtual core. Which means that on quad cores we have a total of 8 cores. It isn't really a virtual core, but for the sake of argument we can call it that. Each core on the chip has circuitry on it that splits that core into two separate entities in software. Look up hyper threading if you want more of an explanation its to long to write out and really off topic for this. This is also the reason the default value of 3 is not recommended. If you reference the above chart, a value of 3 has wow running over only the first core. Which means that's, even in a dual core system, the second core is not being utilized. If you have a dual core processor with hyper threading you can stop reading here and set your CVAR value for affinity mask to 5. What this does is force wow to run over the actual hardware cores of your computer instead of having it run over 1 physical and 1 virtual. Make sense? Dual core set your value to 5 and your done. This will force WoW to run on cores 1 and 3 which in actuality represent the 2 physical cores in a single processor w/ dual cores.
<b>Update 12 - GMT +1 (22.33)</b>
The correct affinity number is F0 for using cpu 4,5,6,7 . Jippi THX SKIE !!!!!!!!!! :D
<b>1.</b> How do you create a server using a specific core for cpu. Example: Core 2 - ns2 server , core 3 - another ns2 server.
<b>2.</b> Each time uwe releases an update I want my servers to auto-update its software.
<b><u>
Progress report:</u></b>
<b>Update 1 - GMT +1 (15.22) </b>
I wrote this specfic command ""C:\Service\NS2 Servers\Server 2\server.exe -file "c:\Service\NS2 Servers\Server 2\config\server.xml"" and it tells me it doesn't work in windows.
<b>Update 2 - GMT +1 (15.24)</b>
Getting frustrated, hitting my keyboard....
<b>Update 3 - GMT +1 (15.28) </b>
Viewing carefully ScardyBob post and notice that all director was name intact with no space. for instance: "C:\ns2_configs\west1.xml" .
Rechanged coding to the following: C:\Service\NS2_Servers\Server_2\server.exe -file "c:\service\ns2_servers\server_2\config\server.xml"
IT WORKED!!
<b>Update 4 - GMT +1 (15.43) </b>
Struggling to create a bat file, found this tutorial <a href="http://www.computerhope.com/batch.htm#11" target="_blank">http://www.computerhope.com/batch.htm#11</a> . I'm stuck with the most noobish ever, created a notepad .txt file and i cannot convert it, can't figure out the bloody windows map configuration file to be able to change notepad to .bat file.
<b>Update 5 - GMT +1 (15.47) </b>
Found the solution to view all text format for example: .txt files clicking "alt" in a folder. Brings up a menu called tools, at the button if that option you'll see map alternativ (translating from swedish windows to english, so it may not be the exact word). Struggling now to bind two affinity for one server.exe file using .bat file
<b>Update 6 - GMT +1 (16.43) </b>
I've created a bat file with this specific command:
cd \service\ns2_servers\server_1
c:\windows\system32\cmd.exe /C start /affinity 3 /high server.exe -file "c:\config\server.xml"
When opening the .bat file it automatlic closes. Seems not to work....
<b>Update 7 - GMT +1 (17.05) </b>
Following Skie coding. start /AFFINITY 3 server.exe -file X:\Games\HLSERVER\NS2\server.xml -game X:\Games\HLSERVER\NS2\NS2GmOvrmind - When doing so i get error couldn't initalize game at that specific locatin. So I used the following code:
cd C:\service\ns2_servers\server_1
start /affinity 3 /high server.exe -file C:\Service\ns2_servers\server_1\config\server.xml
Seems to work now, its up and running. Affinity 3 command has locked down cpu 0 and cpu 1. So thats good :)
<b>Update 8 - GMT +1 (17.15) </b>
I learned that you don't have to use numbers but may also used letters. Ex: Affinity 3 locks cpu 0 + 1. While affinity C locks cpu 2 + 3. But according to my affinity option i have cpu 0,1,2,3,4,5,6,7 . So I'm guessing that cpu 0+1 is core 1 , cpu 2+3 is core 2, etc etc. What you guys think?
Anyways i found a good tutorial regarding affinity <a href="http://www.techenclave.com/topic/392508-cpu-affinity-made-easy/" target="_blank">http://www.techenclave.com/topic/392508-cp...nity-made-easy/</a>
<b>Update 9 - GMT +1 (17.35) </b>
Found good affinity explanation, although did not get my answer how to bind the rest cpu's , i got i7 4 cores, so i got 7 cpu in windows i can choose from. Anyone knows this?
CPU3 CPU2 CPU1 CPU0 Bin Hex
================================
OFF OFF OFF ON = 0001 = 1
OFF OFF ON OFF = 0010 = 2
OFF OFF ON ON = 0011 = 3
OFF ON OFF OFF = 0100 = 4
OFF ON OFF ON = 0101 = 5 confirmed via task manager
OFF ON ON OFF = 0110 = 6
OFF ON ON ON = 0111 = 7
ON OFF OFF OFF = 1000 = 8
ON OFF OFF ON = 1001 = 9
ON OFF ON OFF = 1010 = A confirmed via task manager
ON OFF ON ON = 1011 = B
ON ON OFF OFF = 1100 = C
ON ON OFF ON = 1101 = D
ON ON ON OFF = 1110 = E confirmed via task manager
ON ON ON ON = 1111 = F
<b>Update 10 - GMT +1 (17.55) </b>
So if I understand this correctly, i got i7 4 core cpu. Which is 2 thread per 1 core = 0,1,2,3,4,5,6,7 cpu in total
Writing /affinity F locks down cpu 0,1,2,3 = which means 2 cores. Now comes the tricky question, how to lock down the remaining 4,5,6,7 ? with affinity command....
<b>Update 11 - GMT +1 (21.55) </b>
<u>Found an explanation by strunker att mmo-champions.com about why i got 7 different cpu on affinity:</u>
This is what is called hyper threading which basically splits each core into 2. 1 physical core and 1 virtual core. Which means that on quad cores we have a total of 8 cores. It isn't really a virtual core, but for the sake of argument we can call it that. Each core on the chip has circuitry on it that splits that core into two separate entities in software. Look up hyper threading if you want more of an explanation its to long to write out and really off topic for this. This is also the reason the default value of 3 is not recommended. If you reference the above chart, a value of 3 has wow running over only the first core. Which means that's, even in a dual core system, the second core is not being utilized. If you have a dual core processor with hyper threading you can stop reading here and set your CVAR value for affinity mask to 5. What this does is force wow to run over the actual hardware cores of your computer instead of having it run over 1 physical and 1 virtual. Make sense? Dual core set your value to 5 and your done. This will force WoW to run on cores 1 and 3 which in actuality represent the 2 physical cores in a single processor w/ dual cores.
<b>Update 12 - GMT +1 (22.33)</b>
The correct affinity number is F0 for using cpu 4,5,6,7 . Jippi THX SKIE !!!!!!!!!! :D
Comments
<a href="http://www.unknownworlds.com/ns2/forums/index.php?showtopic=113414" target="_blank">http://www.unknownworlds.com/ns2/forums/in...howtopic=113414</a>
Stickied, but hiding in plain sight on the modding forum.
To make it use only specific core, you need to start the server.exe with the 'start' command, such as:
start /AFFINITY 3 server.exe
Which would bind it to CPU core 3 (counting 0, 1, 2, 3)
Might as well add, that the batch file (ns2serv.bat) that I use to start ns2update + gmovrmind + server.exe is the following:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->@echo OFF
echo "Start server"
cd X:\Games\HLSERVER\NS2
ns2update.exe -file X:\Games\HLSERVER\NS2\server.xml --restartwhenempty -game X:\Games\HLSERVER\NS2\NS2GmOvrmind
start /AFFINITY 3 server.exe -file X:\Games\HLSERVER\NS2\server.xml -game X:\Games\HLSERVER\NS2\NS2GmOvrmind<!--c2--></div><!--ec2-->
2. answered above.
If there is no multi threading, not bounding it to a core will not slow it down.
<b>2.</b> I've started up a test server and i didn't not get server.xml file, it should b e lockated in %APPDATA%/Natural Selection 2/server.xml . So I manually created one. Hope this works.
<b>3.</b> I've installed the ns2 server in one directory which is the first command below, now i want to install it again in another diretor using the same command but different -dir command. This doesn't work, it closes up. Anyone else has this issue?
hldsupdatetool -command update -game naturalselection2 -dir "c:\service\ns2 servers\server 1\"
hldsupdatetool -command update -game naturalselection2 -dir "c:\service\ns2 servers\server 2\"
start /AFFINITY 3 server.exe
Which would bind it to CPU core 3 (counting 0, 1, 2, 3)<!--QuoteEnd--></div><!--QuoteEEnd-->
So this is not correct, because, as I understand it, how the affinity command works is that it converts the number to binary which then tells the OS which cores to run the program on (starting with Core 0 from the right). So affinity 3 converts into 0011 (for a four-core) which means that its telling your OS to run server.exe on cores 0 and 1. Here's all of the affinity -> which cores it uses for a four-core CPU
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->1 = 0001 Core(s) 0
2 = 0010 Core(s) 1
3 = 0011 Core(s) 0, 1
4 = 0100 Core(s) 2
5 = 0101 Core(s) 0, 2
6 = 0110 Core(s) 1, 2
7 = 0111 Core(s) 0, 1, 2
8 = 1000 Core(s) 3
9 = 1001 Core(s) 0, 3
10 = 1010 Core(s) 1, 3
11 = 1011 Core(s) 0, 1, 3
12 = 1100 Core(s) 2, 3
13 = 1101 Core(s) 0, 2 ,3
14 = 1110 Core(s) 1, 2 ,3
15 = 1111 Core(s) 0, 1, 2, 3<!--c2--></div><!--ec2-->
So, if you wanted to set a server.exe for each core, you'd have to use Affinity 1, 2, 4, 8 for Cores 0, 1, 2, 3.
For the 156 West server's, we have our .bat file setup like such:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->REM Start NS2 - WEST 1 (Server.exe) on CPU0
cd \ns2_west1
c:\windows\system32\cmd.exe /C start /affinity 1 /high Server.exe -file "C:\ns2_configs\west1.xml"<!--c2--></div><!--ec2-->
Where the server files are installed in C:\ns2_west1 and the config for that server in C:\ns2_configs\west1.xml
Also, I've been doing some benchmarking with running the client-version of NS2 by setting the affinity to different cores and so far the best I can say is that restricting NS2.exe to one core brings a pretty significant drop in FPS for the client (understandable, since there is some multithreading occurring). However, I haven't tested this on the server-side, so it may or may not be true. Though, just to be safe, you might consider setting the affinities for servers to two cores (like server 1 = core 0,1, server 2 = core 1,2, server 3 = core 2,3).
hldsupdatetool -command update -game naturalselection2 -dir "c:\service\ns2 servers\server 1\"
hldsupdatetool -command update -game naturalselection2 -dir "c:\service\ns2 servers\server 2\"<!--QuoteEnd--></div><!--QuoteEEnd-->
I've solved this issue by removing the " \ " at the end of the text. But now when I have 2 servers up and running from the same computer I only see one folder for natural selection 2 in roaming. So right now I cannot find an option to have seperate server.xml files for both servers .... Any solution?
It seems that both server is connected to the same roaming folder for natural selection 2 giving me two log files. Is there any command for server.exe file to load a specific server.xml file ? One solution is to add -file [path] on the server.exe file, but how do you do that? To create a shortcut and then you're able to write the specific code? <b>Got this solved, wohoo thx for help guys :)</b>
Affinity help:
CPU3 CPU2 CPU1 CPU0 Bin Hex
================================
OFF OFF OFF ON = 0001 = 1
OFF OFF ON OFF = 0010 = 2
OFF OFF ON ON = 0011 = 3
OFF ON OFF OFF = 0100 = 4
OFF ON OFF ON = 0101 = 5 confirmed via task manager
OFF ON ON OFF = 0110 = 6
OFF ON ON ON = 0111 = 7
ON OFF OFF OFF = 1000 = 8
ON OFF OFF ON = 1001 = 9
ON OFF ON OFF = 1010 = A confirmed via task manager
ON OFF ON ON = 1011 = B
ON ON OFF OFF = 1100 = C
ON ON OFF ON = 1101 = D
ON ON ON OFF = 1110 = E confirmed via task manager
ON ON ON ON = 1111 = F