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

Материал из Metrostroi
Перейти к: навигация, поиск
 
(не показаны 3 промежуточные версии этого же участника)
Строка 5: Строка 5:
 
| en = Server configuration
 
| en = Server configuration
 
}}
 
}}
 +
For the best Metrostroi experience you should set up a dedicated server using Source Dedicated Server (srcds). This page contains instructions on how to set up a server, populate it with Metrostroi content and play on it.
  
{{Important|Turbostroi is only supported on Windows. Servers hosted on other platforms will perform poorly.}}
+
{{Important|The machine on which you intend to run this server should be running Windows or a Windows virtual machine. This is because it is highly recommended to install Turbostroi, a Windows-only binary that allows far greater performance. Servers hosted on other operating systems will perform poorly without Turbostroi.}}
[http://wiki.garrysmod.com/page/Downloading_a_Dedicated_Server 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 [https://developer.valvesoftware.com/wiki/SteamCMD from this page].
+
=Setting up a basic server =
 +
Follow [https://wiki.facepunch.com/gmod/Downloading_a_Dedicated_Server this guide] to install a basic Garry's Mod server. This server will have no extra content other than the base game. There are lots of high-quality server setup and maintenance guides available on Google/Bing/Yandex/etc.
 +
{{Important|You must set the server tickrate to 33 or Metrostroi may be unstable. Add this to the server launch command-line: <pre>-tickrate 33</pre>}}
  
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:
+
=Installing Metrostroi=
 +
The easiest way to install addons on a dedicated sever is to connect the server to a Steam Workshop collection.  
  
<pre>login anonymous</pre>
+
If you will only be playing Metrostroi on this server, the [https://steamcommunity.com/sharedfiles/filedetails/?id=1660685783 default Metrostroi collection] (ID 1660685783) will be adequate.
  
= Installing & Updating Garry's Mod Dedicated Server =
+
Alternatively, you can add more content, even content not related to Metrostroi, by making your own collection. You can can do this [https://steamcommunity.com/workshop/editcollection/?appid=4000 here]. (Make sure you are signed in to Steam on your browser before clicking this link or it will redirect you somewhere else) This collection should contain at an absolute minimum:
If you want to specify a download folder then before you update enter this command:
+
* [http://steamcommunity.com/workshop/filedetails/?id=261801217 Metrostroi (Subway Simulator)]
{| class="ambox-notice"
+
* Metrostroi Subway Simulator - Content Packs:
| {{ambox/message
+
** [https://steamcommunity.com/workshop/filedetails/?id=1095094174 Part 1]
| 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
+
** [https://steamcommunity.com/workshop/filedetails/?id=1095098251 Part 2]
}}
+
** [https://steamcommunity.com/workshop/filedetails/?id=1095100683 Part 3]
|}
+
** [https://steamcommunity.com/workshop/filedetails/?id=1095105863 Part 4]
 +
** [https://steamcommunity.com/workshop/filedetails/?id=1095109617 Part 5]
 +
** [https://steamcommunity.com/workshop/filedetails/?id=1095111608 Part 6]
 +
* [https://steamcommunity.com/workshop/filedetails/?id=1095130789 Metrostroi Subway Simulator -  Scripts]
 +
* Any of the Metrostroi maps from [https://wiki.metrostroi.net/wiki/List_of_maps here] or [https://steamcommunity.com/workshop/browse/?appid=4000&searchtext=Metrostroi&childpublishedfileid=0&browsesort=textsearch&section=items&requiredtags%5B%5D=Map here].
  
<pre>force_install_dir c:\my_garrysmod_server\</pre>
+
You must then append the server startup command-line with the following:
You can then install or update the Garry's Mod Dedicated Server by using the command:
+
<pre>+host_workshop_collection WORKSHOPID</pre>
<pre>app_update 4020</pre>
+
{{Important|'''Replace WORKSHOPID with either 1660685783 (the default collection) or your own collection ID.''' A collection's ID is found at the end of the collection's URL.}}
It will slowly download or update.
+
 
 +
==Configuration==
 +
A list of available convars is available [https://wiki.metrostroi.net/wiki/Console_Commands#Server-side_Commands here].
 +
 
 +
As a server administrator you can enable the use of Metrostroi trains on non-Metrostroi maps by unchecking the box "Require third rail" in the spawn menu (hold Q) under Utilities, Metrostroi, Admin. Many trains will still expect an ARS signal and may not work well without it.
  
If you wish to verify your server, enter this instead of the above:
+
The [https://steamcommunity.com/sharedfiles/filedetails/?id=1838480881 Metrostroi Advanced] addon provides additional facilities for server administrators, as well as quality-of-life enhancements for players such as station teleports and an automatic train re-railer. It requires [https://steamcommunity.com/workshop/filedetails/?id ULX], which in turn requires [https://steamcommunity.com/workshop/filedetails/?id=557962238 ULib].
<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
+
=Installing Turbostroi=
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.
+
Turbostroi speeds up the Metrostroi simulations by allowing the simulations to use multiple CPU threads, improving performance. A dedicated server with Turbostroi installed is often over 5x as fast as playing Metrostroi in the built-in Singleplayer mode in Garry's Mod.
  
<pre>steamcmd.exe +login anonymous +app_update 4020 validate +quit</pre>
+
{{Important|'''Turbostroi is only compatible with the Windows version of the Garry's Mod server. It is not compatible with Garry's Mod servers on other operating systems or the game itself.'''}}
  
= Installing The Addons =
+
Download the Turbostroi binary from [https://metrostroi.net/turbostroi here] and place it into the "/garrysmod/lua/bin/" folder in your server. Create the "bin" folder if it isn't already present.
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!
+
{{Important|Because it is a DLL file, some web browsers may mark the Turbostroi file as harmful. This is a false positive and can be safely ignored. VirusTotal results for Turbostroi can be viewed [https://www.virustotal.com/gui/file/fca58b3700d2753db783bb1d9cdec399ce5e3a8cb92eae6f47555093954982f0/detection here].}}
Or for the first time you can use default [https://steamcommunity.com/sharedfiles/filedetails/?id=1660685783 Metrostroi collection].
 
  
== Applying the command-line parameter ==
+
==Configuration==
Append the following parameter to the server startup command-line:
+
'''It is recommended to disable hyper-threading if possible.'''
  
<pre>+host_workshop_collection WORKSHOPID</pre>
+
You can set what threads Turbostroi should use to get even better perfomance:
An example could be:
 
  
<pre>+host_workshop_collection 1660685783</pre>
+
This command sets the SRCDS main thread to x, where x is a binary or bitwise value.
== Example ==
+
<pre>turbostroi_main_cores x</pre>
The example below starts a dedicated server with 10 player slots and 33 tickrate. It downloads or updates all of the addons in [https://steamcommunity.com/sharedfiles/filedetails/?id=1660685783 collection 1660685783] and loads one of the maps. This collection includes basic Metrostroi server addons.
 
  
<pre>srcds.exe -console -tickrate 33 +maxplayers 10 +host_workshop_collection 1660685783 +map gm_metrostroi_b50</pre>
+
This command sets the Metrostroi train threads to x, where x is a binary or bitwise value.
Every time you restart your server it will check that these addons are all up to date.
+
<pre>turbostroi_train_cores x</pre>
  
{{important|Metrostroi should be run at a tickrate of '''33'''. Other tickrates may cause the mod to be unstable!}}
+
For example, on a 4-core system you should set turbostroi_main_cores and turbostroi_train_cores to 8 and 7 respectively, or 128 and 127 respectively with hyperthreading enabled. This setup will run the main SRCDS thread on the last CPU thread, leaving the rest for Metrostroi.
  
= Turbostroi =
+
=Connecting to the server=
Turbostroi lets the server use multithreading for the Metrostroi trains calculations and increase perfomance as result.
+
The method for connecting to the Metrostroi server varies depending on your circumstances.
  
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.
+
==Localhost LAN==
 +
If you are playing by yourself and hosting the server on the same computer you are playing on, the game server should appear in the LAN section of the server browser in Garry's Mod. Alternatively, you can run this in the Garry's Mod developer console: <pre>connect localhost</pre>
  
{{Important|Turbostroi is only supported on Windows. Servers hosted on other platforms will perform poorly.}}
+
==LAN==
== Turbostroi Convars ==
+
If you are playing by yourself and hosting the server on a different computer to the one you are playing on, the game server should appear in the LAN section of the server browser in Garry's Mod. Alternatively, if you know the other computer's local IP address (normally starting with 192) you can connect to it by running this in the Garry's Mod developer console: <pre>connect IPADDRESS</pre> (where IPADDRESS is replaced with the other computer's local IP)
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.
+
You can find a computer's local IP address by running the [https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/ipconfig ipconfig] command in Command Prompt on Windows.
  
'''turbostroi_train_cores''': Train threads.
+
==WAN==
 +
If you are hosting the server on a computer on a different network to the computer on which you will be playing, or you wish to make your server open for multiplayer, you will need to forward ports 27005 and 27015 on the router for both TCP and UDP. The exact process for this varies between routers; [https://portforward.com/ portforward.com] hosts comprehensive guides for thousands of routers.
  
{| class="ambox-notice"
+
Once you have forwarded ports 27005 and 27015, you can connect to the server with its public IP address. You can find its public IP by opening [https://www.whatismyip.com/ this link] on the server computer. Run this command in the Garry's Mod developer console to connect:
| {{ambox/message
+
<pre>connect IPADDRESS</pre>
| 2 = The value for each of these convars must be a binary, or bitwise value.
+
(where IPADDRESS is replaced with the server's public IP). The server should also automatically appear in the server browser.
It also recommended to '''disable''' the "Hyper-threading" if possible.
 
}}
 
|}
 
  
=== Best config for 4 core CPU: ===
+
You can password protect your server to prevent strangers from joining by adding the following to the /garrysmod/cfg/server.cfg file in the server: <pre>sv_password "PASSWORD"</pre> where PASSWORD is replaced with a password of your choice.
''It will use all threads/cores except the last one for trains, and the last for main''
 
* With '''enabled''' "Hyper-threading":
 
** turbostroi_main_cores 128
 
** turbostroi_train_cores 127
 
* With '''disabled''' "Hyper-threading":
 
** turbostroi_main_cores 8
 
** turbostroi_train_cores 7
 

Текущая версия на 04:16, 24 апреля 2021

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


For the best Metrostroi experience you should set up a dedicated server using Source Dedicated Server (srcds). This page contains instructions on how to set up a server, populate it with Metrostroi content and play on it.

Important:The machine on which you intend to run this server should be running Windows or a Windows virtual machine. This is because it is highly recommended to install Turbostroi, a Windows-only binary that allows far greater performance. Servers hosted on other operating systems will perform poorly without Turbostroi.


Setting up a basic server

Follow this guide to install a basic Garry's Mod server. This server will have no extra content other than the base game. There are lots of high-quality server setup and maintenance guides available on Google/Bing/Yandex/etc.

Important:You must set the server tickrate to 33 or Metrostroi may be unstable. Add this to the server launch command-line:
-tickrate 33


Installing Metrostroi

The easiest way to install addons on a dedicated sever is to connect the server to a Steam Workshop collection.

If you will only be playing Metrostroi on this server, the default Metrostroi collection (ID 1660685783) will be adequate.

Alternatively, you can add more content, even content not related to Metrostroi, by making your own collection. You can can do this here. (Make sure you are signed in to Steam on your browser before clicking this link or it will redirect you somewhere else) This collection should contain at an absolute minimum:

You must then append the server startup command-line with the following:

+host_workshop_collection WORKSHOPID
Important:Replace WORKSHOPID with either 1660685783 (the default collection) or your own collection ID. A collection's ID is found at the end of the collection's URL.


Configuration

A list of available convars is available here.

As a server administrator you can enable the use of Metrostroi trains on non-Metrostroi maps by unchecking the box "Require third rail" in the spawn menu (hold Q) under Utilities, Metrostroi, Admin. Many trains will still expect an ARS signal and may not work well without it.

The Metrostroi Advanced addon provides additional facilities for server administrators, as well as quality-of-life enhancements for players such as station teleports and an automatic train re-railer. It requires ULX, which in turn requires ULib.

Installing Turbostroi

Turbostroi speeds up the Metrostroi simulations by allowing the simulations to use multiple CPU threads, improving performance. A dedicated server with Turbostroi installed is often over 5x as fast as playing Metrostroi in the built-in Singleplayer mode in Garry's Mod.

Important:Turbostroi is only compatible with the Windows version of the Garry's Mod server. It is not compatible with Garry's Mod servers on other operating systems or the game itself.


Download the Turbostroi binary from here and place it into the "/garrysmod/lua/bin/" folder in your server. Create the "bin" folder if it isn't already present.

Important:Because it is a DLL file, some web browsers may mark the Turbostroi file as harmful. This is a false positive and can be safely ignored. VirusTotal results for Turbostroi can be viewed here.


Configuration

It is recommended to disable hyper-threading if possible.

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

This command sets the SRCDS main thread to x, where x is a binary or bitwise value.

turbostroi_main_cores x

This command sets the Metrostroi train threads to x, where x is a binary or bitwise value.

turbostroi_train_cores x

For example, on a 4-core system you should set turbostroi_main_cores and turbostroi_train_cores to 8 and 7 respectively, or 128 and 127 respectively with hyperthreading enabled. This setup will run the main SRCDS thread on the last CPU thread, leaving the rest for Metrostroi.

Connecting to the server

The method for connecting to the Metrostroi server varies depending on your circumstances.

Localhost LAN

If you are playing by yourself and hosting the server on the same computer you are playing on, the game server should appear in the LAN section of the server browser in Garry's Mod. Alternatively, you can run this in the Garry's Mod developer console:

connect localhost

LAN

If you are playing by yourself and hosting the server on a different computer to the one you are playing on, the game server should appear in the LAN section of the server browser in Garry's Mod. Alternatively, if you know the other computer's local IP address (normally starting with 192) you can connect to it by running this in the Garry's Mod developer console:

connect IPADDRESS

(where IPADDRESS is replaced with the other computer's local IP)

You can find a computer's local IP address by running the ipconfig command in Command Prompt on Windows.

WAN

If you are hosting the server on a computer on a different network to the computer on which you will be playing, or you wish to make your server open for multiplayer, you will need to forward ports 27005 and 27015 on the router for both TCP and UDP. The exact process for this varies between routers; portforward.com hosts comprehensive guides for thousands of routers.

Once you have forwarded ports 27005 and 27015, you can connect to the server with its public IP address. You can find its public IP by opening this link on the server computer. Run this command in the Garry's Mod developer console to connect:

connect IPADDRESS

(where IPADDRESS is replaced with the server's public IP). The server should also automatically appear in the server browser.

You can password protect your server to prevent strangers from joining by adding the following to the /garrysmod/cfg/server.cfg file in the server:

sv_password "PASSWORD"

where PASSWORD is replaced with a password of your choice.