Server configuration: различия между версиями

Материал из Metrostroi
Перейти к: навигация, поиск
Строка 6: Строка 6:
 
}}
 
}}
  
{{Important|Turbostroi is only supported on Windows. Servers hosted on other platforms will perform poorly.}}
+
{{Important|Turbostroi only supported on Windows. Servers hosted on other platforms will perform poorly.}}
 +
[http://wiki.garrysmod.com/page/Downloading_a_Dedicated_Server Main article from Garry's Mod Wiki]
 
= Installing SteamCMD =
 
= Installing SteamCMD =
SteamCMD is a command line tool that makes setting up servers for Garry's Mod (and most other Source engine based games) very easy. You can download it for Windows and Linux from the [https://developer.valvesoftware.com/wiki/SteamCMD#Downloading_SteamCMD Valve Developer Wiki].
+
Dedicated servers are now downloaded using SteamCMD. This is a command line version of Steam.
= Installing the Server (Windows) =
 
To download and install your server enter the following script into command prompt or save it as a batch file (paste it into notepad, click "Save As..", set the "Save as type" to "All Files (*.*)" and append ".bat" or ".cmd" to the filename).
 
<pre>
 
"PATH_TO_STEAMCMD\steamcmd.exe" +login anonymous +force_install_dir "PATH_FOR_SERVER" +app_update 4020 validate +quit
 
pause
 
</pre>
 
Running the batch file will start to download a Garry's Mod to the "PATH_FOR_SERVER" directory you specified. This process may take some time depending on the speed of your internet connection.
 
= Creating a Collection =
 
The most straightforward way to add mods to your server is to create a steam workshop collection. You can do this by navigating to the [http://steamcommunity.com/workshop/browse/?section=collections&appid=4000 Garry's Mod Steam Workshop "Collections" section] and clicking [http://steamcommunity.com/workshop/editcollection/?appid=4000 "Create Collection"]. When you've named and branded your collection head over to the Workshop pages for any of the mods you want to add and click "Add to Collection" then choose the name of your server collection. To install Metrostroi you add the following mods to your collection:
 
* [http://steamcommunity.com/workshop/filedetails/?id=261801217 Metrostroi (Subway Simulator)]
 
* Metrostroi Subway Simulator - Content Pack part (1 to 6)
 
* [https://steamcommunity.com/workshop/filedetails/?id=1095130789 Metrostroi Subway Simulator -  Scripts]
 
* A Metrostroi map you want to use (mostly listed [https://wiki.metrostroi.net/wiki/%D0%A1%D0%BF%D0%B8%D1%81%D0%BE%D0%BA_%D0%BA%D0%B0%D1%80%D1%82 here])
 
= Installing Mods =
 
Using command line arguments you can configure your server to automatically install/ update all of the items in a collection. Save the following script as a batch file in the same path as your Garry's Mod server is installed.
 
<pre>
 
srcds.exe +maxplayers 20 -console +host_workshop_collection YOUR_COLLECTION_ID +gamemode sandbox +map NAME_OF_THE_MAP_YOU_WANT
 
</pre>
 
You can find the names of most metrostroi maps [https://wiki.metrostroi.net/wiki/%D0%A1%D0%BF%D0%B8%D1%81%D0%BE%D0%BA_%D0%BA%D0%B0%D1%80%D1%82 here] to replace "NAME_OF_THE_MAP_YOU_WANT".<br>
 
'''Please note that the "gm_metrostroi_b50" has a lighting issue that may cause your server fail when starting up due to a "Engine hunk overflow!". To fix this add " +r_hunkalloclightmaps 0" to the end of your command line arguments.'''<br>
 
If you have followed the above steps correctly you should now have a fully functional Metrostroi server. If you don't, for whatever reason, the Garry's Mod wiki has a more general (but more detailed guide) on how to set one up [https://wiki.garrysmod.com/page/Category:Server_Owners here].
 
  
= Turbostroi =
+
You can download it [https://developer.valvesoftware.com/wiki/SteamCMD from this page].
You can download the "Turbostroi" binary from [http://metrostroi.net/turbostroi here]. Without it, your server will perform quite poorly. Unzip the downloaded file and then place the ".dll" file into your "garrysmod\lua\bin" directory. Make sure to do this for your game client as well if you haven't already.
+
 
 +
The first time you run it it will update and you will be left at a STEAM> console. You will want to log in. You can log into an anonymous account by typing:
 +
 
 +
<pre>login anonymous</pre>
 +
 
 +
= Installing & Updating Garry's Mod Dedicated Server =
 +
If you want to specify a download folder then before you update enter this command:
 +
{| class="ambox-notice" style="margin: auto"
 +
| {{ambox/message
 +
| 2 = This is known to cause problems when updating your server to a newer version. If your server fails to update, try not using the force_install_dir feature, or try reinstalling your server into another folder
 +
}}
 +
|}
 +
 
 +
<pre>force_install_dir c:\my_garrysmod_server\</pre>
 +
You can then install or update the Garry's Mod Dedicated Server by using the command:
 +
<pre>app_update 4020</pre>
 +
It will slowly download or update.
 +
 
 +
If you wish to verify your server, enter this instead of the above:
 +
<pre>app_update 4020 -validate</pre>
 +
Once it's done you can type quit at the console to exit or just close the SteamCMD window.
 +
 
 +
Automated
 +
You probably don't want to do that every time you want to install/update a server. Don't worry - it supports command lines too.
 +
 
 +
<pre>steamcmd.exe +login anonymous +app_update 4020 validate +quit</pre>
 +
 
 +
= Installing The Addons =
 +
Dedicated servers can install addons straight from workshop collections, but it requires an addition to the startup parameter. The server will download the collection at startup.
 +
 
 +
First of all create a collection and find your collection ID. Do note that your collection needs to be public, else, srcds won't be able to access it!
 +
Or for the first time you can use default [https://steamcommunity.com/sharedfiles/filedetails/?id=1660685783 Metrostroi collection].
 +
 
 +
== Applying the command-line parameter ==
 +
Append the following parameter to the server startup command-line:
 +
 
 +
<pre>+host_workshop_collection WORKSHOPID</pre>
 +
An example could be:
  
 +
<pre>+host_workshop_collection 1660685783</pre>
 +
== Example ==
 +
The example below starts a dedicated server with 20 player slots. It downloads or updates all of the addons in collection 1660685783. This collection includes basic Metrostroi server addons. It loads one of the downloaded maps.
  
== Turbostroi Convars ==
+
<pre>srcds.exe +maxplayers 20 -console +host_workshop_collection 1660685783 +map gm_metrostroi_b50</pre>
Turbostroi offers even better performance when configured correctly. It offers 2 primary convars available to change:
+
Every time you restart your server it will check that these addons are all up to date.
  
'''turbostroi_main_cores''': SRCDS thread allocation. Turbostroi changes the SRCDS thread to the specified thread.
+
= Turbostroi =
 +
Turbostroi lets the server use multithreading for the Metrostroi trains calculations and increase perfomance as result.
  
'''turbostroi_train_cores''': Train thread allocation. Most, if not all, Metrostroi systems will register in Turbostroi and will receive the benefit of multithreading. This is the main benefit of Turbostroi being installed.
+
You can download the "Turbostroi" binary from [https://metrostroi.net/turbostroi here]. Put it into "garrysmod/lua/bin", create a "bin" folder if it's not present.
  
The value for each of these convars is converted into a binary, or bitwise, value. A simple process is described below.
+
== Turbostroi Convars ==
 +
You can set what threads Turbostroi should use to get even better perfomance.
  
#First, figure out how many cores your processor has. We will assume our processor has '''4''' cores.
+
'''turbostroi_main_cores''': SRCDS thread. Turbostroi changes the SRCDS thread to the specified.
#Represent each core with a binary digit. Our processor will be represented as such: 0000
 
#Which cores do you want dedicated to train threads? I will use the first 3 cores, which means I "turn them on" and represent them as follows: 1110
 
#Any remaining core(s) may be used for the SRCDS thread. This will be represented as 0001
 
#Now, you must convert those bitwise values into decimal values. It is recommended to use the built-in Windows calculator in the "Programmer" mode. When doing this, you may enter the bitwise values by clicking on "BIN" and type in the bitwise values for each convar. For example, I will type in 1110, which results in the decimal value 14. I will then type in 0001, which results in the decimal value 1.
 
#Next, take your decimal values and input them into the console for your desired convar. I wanted to use the first 3 cores for trains, so I will type in the console "turbostroi_train_cores 14". The same procedure follows with the other convar.
 
  
After this is all done, you should restart the server. If Turbostroi starts outputting a bunch of errors about affinity and whatnot, you have configured the convars incorrectly.
+
'''turbostroi_train_cores''': Train threads.
  
= Connecting to the Server =
+
The value for each of these convars must be a binary, or bitwise value.
You should be able to connect to your server using the "LAN" tab in your Garry's Mod server browser or by using the "LAN" tab in the steam "Servers" window. If you use any form of firewall or your router has a built in firewall other players probably won't be able to connect to your server. To solve this you need to tell your firewall to allow certain network traffic though to your game server. <br>
 
'''Do not complete the following steps unless you know what you are doing- adding firewall exceptions can make your computer and network less secure.'''<br>
 
The exact process of adding "exceptions" to your networks firewalls depends heavily on what hardware/ software you are using. You are probably best looking up a guide of how to "Port Forward" on your specific router and how to add firewall exceptions to your antivirus. By default Garry's Mod will use the ports 27005 and 27015 (UDP and TCP) however if you choose to run more than one server at the same time you will need to unblock two ports for each server (eg 27006 and 27016)
 
  
= Tips =
+
If also recommended to '''disable''' the "Hyper-threading" if possible.
== Server.cfg ==
 
You can set the name, password, wagon limit and other important things by editing the "server.cfg" in "garrysmod\cfg". Below are some useful lines to put in this file:
 
* hostname "SERVER_NAME_HERE"
 
* metrostroi_maxwagons "WAGON_LIMIT_HERE"
 
* metrostroi_maxtrains "TRAIN_LIMIT_HERE"
 
* metrostroi_maxtrains_onplayer "MAX_TRAINS_PER_PLAYER_HERE"
 
A more extensive list of console commands [[Console_Commands|here]].
 
  
== ULX ==
+
Best config for 4 core CPU:
[http://steamcommunity.com/sharedfiles/filedetails/?id=557962280 ULX] is an admin tool that will make dealing with players and changing maps much easier.
+
* With '''enabled''' "Hyper-threading":
== WUMA ==
+
** turbostroi_main_cores 127
[http://steamcommunity.com/sharedfiles/filedetails/?id=1117436840 WUMA] allows server administrators to restrict entities and loadouts to particular usergroups or players.
+
** turbostroi_train_cores 128
== Garry's Mod Wiki ==
+
* With '''disabled''' "Hyper-threading":
Check out the [https://wiki.garrysmod.com/page/Category:Server_Owners "Server Owners" section on the Garry's Mod Wiki]. It has some helpful tutorials on [https://wiki.garrysmod.com/page/Loading_URL setting a loading screen] and other more advanced topics not covered here.
+
** turbostroi_main_cores 7
 +
** turbostroi_train_cores 8

Версия 18:04, 19 июня 2019

Available languages: Русский · English



Important:Turbostroi only supported on Windows. Servers hosted on other platforms will perform poorly.

Main article from Garry's Mod Wiki

Installing SteamCMD

Dedicated servers are now downloaded using SteamCMD. This is a command line version of Steam.

You can download it from this page.

The first time you run it it will update and you will be left at a STEAM> console. You will want to log in. You can log into an anonymous account by typing:

login anonymous

Installing & Updating Garry's Mod Dedicated Server

If you want to specify a download folder then before you update enter this command:

This is known to cause problems when updating your server to a newer version. If your server fails to update, try not using the force_install_dir feature, or try reinstalling your server into another folder
force_install_dir c:\my_garrysmod_server\

You can then install or update the Garry's Mod Dedicated Server by using the command:

app_update 4020

It will slowly download or update.

If you wish to verify your server, enter this instead of the above:

app_update 4020 -validate

Once it's done you can type quit at the console to exit or just close the SteamCMD window.

Automated You probably don't want to do that every time you want to install/update a server. Don't worry - it supports command lines too.

steamcmd.exe +login anonymous +app_update 4020 validate +quit

Installing The Addons

Dedicated servers can install addons straight from workshop collections, but it requires an addition to the startup parameter. The server will download the collection at startup.

First of all create a collection and find your collection ID. Do note that your collection needs to be public, else, srcds won't be able to access it! Or for the first time you can use default Metrostroi collection.

Applying the command-line parameter

Append the following parameter to the server startup command-line:

+host_workshop_collection WORKSHOPID

An example could be:

+host_workshop_collection 1660685783

Example

The example below starts a dedicated server with 20 player slots. It downloads or updates all of the addons in collection 1660685783. This collection includes basic Metrostroi server addons. It loads one of the downloaded maps.

srcds.exe +maxplayers 20 -console +host_workshop_collection 1660685783 +map gm_metrostroi_b50

Every time you restart your server it will check that these addons are all up to date.

Turbostroi

Turbostroi lets the server use multithreading for the Metrostroi trains calculations and increase perfomance as result.

You can download the "Turbostroi" binary from here. Put it into "garrysmod/lua/bin", create a "bin" folder if it's not present.

Turbostroi Convars

You can set what threads Turbostroi should use to get even better perfomance.

turbostroi_main_cores: SRCDS thread. Turbostroi changes the SRCDS thread to the specified.

turbostroi_train_cores: Train threads.

The value for each of these convars must be a binary, or bitwise value.

If also recommended to disable the "Hyper-threading" if possible.

Best config for 4 core CPU:

  • With enabled "Hyper-threading":
    • turbostroi_main_cores 127
    • turbostroi_train_cores 128
  • With disabled "Hyper-threading":
    • turbostroi_main_cores 7
    • turbostroi_train_cores 8