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

Материал из Metrostroi
Перейти к: навигация, поиск
(overhaul)
Строка 53: Строка 53:
 
You can set what threads Turbostroi should use to get even better perfomance:
 
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.
 
<pre>turbostroi_main_cores x</pre>
 
<pre>turbostroi_main_cores x</pre>
This command sets the SRCDS main thread to x, where x is a binary or bitwise value.
 
  
 +
This command sets the Metrostroi train threads to x, where x is a binary or bitwise value.
 
<pre>turbostroi_train_cores x</pre>
 
<pre>turbostroi_train_cores x</pre>
This command sets the Metrostroi train threads to x, where x is a binary or bitwise value.
 
  
 
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.
 
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.

Версия 23:21, 25 марта 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

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.