Difference between revisions of "Documentation/Tools/Dedicated Server"
(Dedicated server how to) |
(Normalized new lines.) |
||
Line 18: | Line 18: | ||
You may get the following error when starting a server with Linux: `[S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.dll.` | You may get the following error when starting a server with Linux: `[S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.dll.` | ||
To launch server on linux `steamclient.so` library is required. You can either use provided launch_server.sh script (located in folder next to to server executable) or create a link to this library using `ln -s steamcmd/linux64/steamclient.so ~/.steam/sdk64/steamclient.so` | To launch server on linux `steamclient.so` library is required. You can either use provided launch_server.sh script (located in folder next to to server executable) or create a link to this library using `ln -s steamcmd/linux64/steamclient.so ~/.steam/sdk64/steamclient.so` | ||
− | |||
=First launch= | =First launch= | ||
Line 32: | Line 31: | ||
Next you will receive following error: "<ERROR> [MP] Error: Server packages file not found. This is required to load proper map, DLCs and mods". | Next you will receive following error: "<ERROR> [MP] Error: Server packages file not found. This is required to load proper map, DLCs and mods". | ||
This means, you have to provide additional server configuration according to following steps. | This means, you have to provide additional server configuration according to following steps. | ||
− | |||
=Required files to run dedicated server= | =Required files to run dedicated server= | ||
Line 57: | Line 55: | ||
In config.cfg (found in game home directory) enable game console - uset g_console "1". | In config.cfg (found in game home directory) enable game console - uset g_console "1". | ||
When game is running press `~` to open game console and run `export_server_packages` or `export_server_packages destination file` command. server_packages.sii will be generated in the game home folder. It is necessary for map to be loaded when this command is called. This will generate server_packages.sii and server_packages.dat. These files carry dlc and mod configuration based on your current game setup. | When game is running press `~` to open game console and run `export_server_packages` or `export_server_packages destination file` command. server_packages.sii will be generated in the game home folder. It is necessary for map to be loaded when this command is called. This will generate server_packages.sii and server_packages.dat. These files carry dlc and mod configuration based on your current game setup. | ||
− | |||
=Runnung server without game installed= | =Runnung server without game installed= | ||
Line 64: | Line 61: | ||
It will contain server.log.txt and server_config.sii. You have to provide generated server_packages.sii and server_packages.dat to this location. | It will contain server.log.txt and server_config.sii. You have to provide generated server_packages.sii and server_packages.dat to this location. | ||
+ | =Data requirements= | ||
− | |||
Dedicated server does not require any additional dlc or mod data. Everything needed is handled via server_packages.sii and server_packages.dat files. It is not required to copy any additional files. As the dedicated server does not use steam client, it cannot access the workshop. | Dedicated server does not require any additional dlc or mod data. Everything needed is handled via server_packages.sii and server_packages.dat files. It is not required to copy any additional files. As the dedicated server does not use steam client, it cannot access the workshop. | ||
− | |||
=Network address translation (NAT)= | =Network address translation (NAT)= | ||
Line 77: | Line 73: | ||
To search for a server use serach field in game server browser. | To search for a server use serach field in game server browser. | ||
+ | =Port setup= | ||
− | |||
`connection_virtual_port` and `query_virtual_port` are virtual ports used for connection to server. Allowed range is <100,200>. | `connection_virtual_port` and `query_virtual_port` are virtual ports used for connection to server. Allowed range is <100,200>. | ||
`connection_dedicated_port` and `query_dedicated_port` are physical ports used by steam game server api to fill sessions browser. For LAN games query_dedicated_port has be in range of <27015,27020>. | `connection_dedicated_port` and `query_dedicated_port` are physical ports used by steam game server api to fill sessions browser. For LAN games query_dedicated_port has be in range of <27015,27020>. | ||
Line 84: | Line 80: | ||
For port forwarding both TPP/IP and UPD rules are required. | For port forwarding both TPP/IP and UPD rules are required. | ||
+ | =Server logon token= | ||
− | |||
By default, whenever a dedicated server is launched it is using an anonymous account. For such an account non-persistent server id is generated (used for direct search). To avoid this you can acquire a logon token on https://steamcommunity.com/dev/managegameservers (game ownership is required). This token has to be placed into server_config. | By default, whenever a dedicated server is launched it is using an anonymous account. For such an account non-persistent server id is generated (used for direct search). To avoid this you can acquire a logon token on https://steamcommunity.com/dev/managegameservers (game ownership is required). This token has to be placed into server_config. | ||
Line 93: | Line 89: | ||
server_logon_token: 6544F7E034119F113526E96474F | server_logon_token: 6544F7E034119F113526E96474F | ||
+ | =Session moderators= | ||
− | |||
As the dedicated server does not have any form or user interface, it is not possible to promote any player to a moderator while the session is running. You can register moderators in server_config using their steam_id to automatically promote them once they join the session. | As the dedicated server does not have any form or user interface, it is not possible to promote any player to a moderator while the session is running. You can register moderators in server_config using their steam_id to automatically promote them once they join the session. | ||
Line 105: | Line 101: | ||
where 123456789 is moderator steam id | where 123456789 is moderator steam id | ||
+ | =Quality of life= | ||
− | |||
Any player who is a moderator can now change the game time or disable radin. This can be done via chat message box by sending message containing admin command. | Any player who is a moderator can now change the game time or disable radin. This can be done via chat message box by sending message containing admin command. | ||
Available admin commands are | Available admin commands are | ||
Line 114: | Line 110: | ||
=How to close server= | =How to close server= | ||
+ | |||
Press Ctrl + C. | Press Ctrl + C. | ||
+ | =Troubleshooting= | ||
− | |||
In game home folder server.log.txt and server.crash.txt (when server crashes) files can be found to help solve any issue with a dedicated server. | In game home folder server.log.txt and server.crash.txt (when server crashes) files can be found to help solve any issue with a dedicated server. | ||
=Known issues= | =Known issues= | ||
+ | |||
When server is closed with message: | When server is closed with message: | ||
Revision as of 08:10, 13 December 2022
Contents
- 1 In construction
- 2 How to download a dedicated server
- 3 How to launch a dedicated server
- 4 How to launch a dedicated server on linux without steam client installed
- 5 First launch
- 6 Required files to run dedicated server
- 7 How to export server_packages
- 8 Runnung server without game installed
- 9 Data requirements
- 10 Network address translation (NAT)
- 11 Port setup
- 12 Server logon token
- 13 Session moderators
- 14 Quality of life
- 15 How to close server
- 16 Troubleshooting
- 17 Known issues
In construction
How to download a dedicated server
How to launch a dedicated server
You can launch the dedicated server either from the Steam client's library tab, or directly by starting its executable. Game ownership is not required. If you want to launch a server with different configuration, you can use following startup parameters:
-server "server packages file name" (loads non default server game setup) -server_cfg "server config file name" (loads non default server configuration) -homedir "path" (redirects game/server home directory) -nosingle (enables multiple instances of server)
If you have redirected home directory for the game (location where server_config, server.log, game.log, server_packages are stored), you have to redirect server home directory as well (this is done with -homedir parameter).
How to launch a dedicated server on linux without steam client installed
You may get the following error when starting a server with Linux: `[S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.dll.` To launch server on linux `steamclient.so` library is required. You can either use provided launch_server.sh script (located in folder next to to server executable) or create a link to this library using `ln -s steamcmd/linux64/steamclient.so ~/.steam/sdk64/steamclient.so`
First launch
First launch will create server home folder and default server_config.sii.
By default server/game home directories are: Windows: c:\Users\XXX\Documents\American Truck Simulator\ or c:\Users\XXX\Documents\Euro Truck Simulator 2\ Linux: ~/.local/share/American Truck Simulator/ or ~/.local/share/Euro Truck Simulator 2/
This location can be changed with -homedir start up parameter, however it must be changed for both game and server.
Next you will receive following error: "<ERROR> [MP] Error: Server packages file not found. This is required to load proper map, DLCs and mods". This means, you have to provide additional server configuration according to following steps.
Required files to run dedicated server
In the server/game home folder the following files are used to set up dedicated server session:
server_config.sii
- contains session description and configuration, connections ports info, logon token and list of moderators
- ports and logon token must be different for each session instance running at the same time
- default configuration, is generated automatically with first launch</nowiki>
server_packages.sii
- contains map details, dlc and mods configuration</nowiki>
server_packages.dat
- contains internal map data
server_packages.sii and server_packages.dat must be generated manually via calling `export_server_packages` command while normal game is running. Generated configuration will mirror your game configuration. These files are necessary for a dedicated server to start. If you are running server without base game being installed, you have manually copy these files to server home directory.
These files are NOT linked to your account in any way.
How to export server_packages
In config.cfg (found in game home directory) enable game console - uset g_console "1". When game is running press `~` to open game console and run `export_server_packages` or `export_server_packages destination file` command. server_packages.sii will be generated in the game home folder. It is necessary for map to be loaded when this command is called. This will generate server_packages.sii and server_packages.dat. These files carry dlc and mod configuration based on your current game setup.
Runnung server without game installed
After first launch server home directory will be created. It will contain server.log.txt and server_config.sii. You have to provide generated server_packages.sii and server_packages.dat to this location.
Data requirements
Dedicated server does not require any additional dlc or mod data. Everything needed is handled via server_packages.sii and server_packages.dat files. It is not required to copy any additional files. As the dedicated server does not use steam client, it cannot access the workshop.
Network address translation (NAT)
Dedicated server does not handle NAT punching and public IP or port forwarding is required to show server in session browser. However, session direct search works even for server that is behind NAT and it is possible to connect to such server.
Search id is listed when dedicated server starts or in convoy info screen for hosted sessions. To search for a server use serach field in game server browser.
Port setup
`connection_virtual_port` and `query_virtual_port` are virtual ports used for connection to server. Allowed range is <100,200>. `connection_dedicated_port` and `query_dedicated_port` are physical ports used by steam game server api to fill sessions browser. For LAN games query_dedicated_port has be in range of <27015,27020>.
For port forwarding both TPP/IP and UPD rules are required.
Server logon token
By default, whenever a dedicated server is launched it is using an anonymous account. For such an account non-persistent server id is generated (used for direct search). To avoid this you can acquire a logon token on https://steamcommunity.com/dev/managegameservers (game ownership is required). This token has to be placed into server_config.
Use game appID to generate token, not server appID!
Example:
server_logon_token: 6544F7E034119F113526E96474F
Session moderators
As the dedicated server does not have any form or user interface, it is not possible to promote any player to a moderator while the session is running. You can register moderators in server_config using their steam_id to automatically promote them once they join the session.
Example for two moderators:
moderator_list: 2 moderator_list[0]: 123456789 moderator_list[1]: 234567891
where 123456789 is moderator steam id
Quality of life
Any player who is a moderator can now change the game time or disable radin. This can be done via chat message box by sending message containing admin command. Available admin commands are
`/set_time <HH:MM>' `/set_rain_factor <value from 0 to 1>' `/help
How to close server
Press Ctrl + C.
Troubleshooting
In game home folder server.log.txt and server.crash.txt (when server crashes) files can be found to help solve any issue with a dedicated server.
Known issues
When server is closed with message:
[MP] Steam disconnected [MP] Session closure requested (reason - 33). [MP] Session closing
It is caused by steam lossing connection. This can happen internet connection is lost, when computer switches to sleep mode. Other reason are under investigation.