Server configuration
Available languages: Русский · English |
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.
It also recommended to disable the "Hyper-threading" if possible. |
Best config for 4 core CPU:
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