Setting up a Space Engineers Dedicated Server

From Space Engineers Wiki
Jump to navigation Jump to search

The Space Engineers Dedicated Server (SE DS) allows players to connect to a third-party host, rather than using a player-host, in a peer-to-peer set-up.

DS are intended for hosting long-time multiplayer games. But for larger worlds, you want to avoid one player’s PC being a client and server at the same time.

  • DS run game instances on a separate PC (that you must provide). This way the game doesn’t depend on the hosting player’s PC being on.
  • DS run without graphics card and without calculating visual/audio effects which results in a more fluent multiplayer performance with less lag.[1]
  • Both PC and Console players can connect to the same DS.
  • Enhance your server administration experience on PC by adding Torch to your DS to get live management tools and a plugin manager. More info on getting started with Torch here.

Alternatively, you can rent a Space Engineers Dedicated Game server from one of the official hosting providers.

In order to run a dedicated server, players don't require a licensed copy of the game. However to legally obtain the game server files, at least one Steam account needs to have a valid license.

Server Mods Troubleshooting: The Steam download of mods using the button doesn't work anymore by default. This is because the Steam DLLs included with the dedicated server are out of date. Fix this by copying the latest DLL versions from an up-to-date version of Steam or SteamCMD, e.g. `C:\Program Files (x86)\Steam`. Copy the following DLLs, and overwrite the DLLs in the DedicatedServer64 folder of your server.

  • steamclient64.dll
  • tier0_s64.dll
  • vstdlib_s64.dll

Dedicated Server Guide

Requirements

  1. Windows PC (if you want to run the server as a "service" you need to use administration account)
  2. .NET Redistributable (version 4.6.1 or higher) https://dotnet.microsoft.com/download/dotnet-framework
  3. Visual C++ (VC++) Redistributable packages 2013 and 2015-2019 64bit. (2017 version is included in the 2015-2019 package. https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
  4. Static IP address, if you intend to host the game publicly, so that anyone from the Internet can connect to it. (not required, but makes it easier for regular players to find your server in Favourites or History tab)

DS Minimum: CPU 3.2GHz, 3 logical cores 6G RAM

DS Recommended: CPU 4.5GHz, 3 logical cores 10G RAM

Installation

If you are logged into the Steam client, simply make a shortcut to SE DS on your desktop, and give it one of these location paths:

 steam://install/298740 [2]
 https://steamdb.info/app/298740/[3]

(Many thanks to u/Jeiwyn and u/ElyrianVanguard on Reddit for this information.)

​ Alternatively, if you can’t download it through the Steam client, install the dedicated server using SteamCMD. The app ID for the SE DS is 298740.

Choose somedirectorypath where you want to save it and enter the following on the command line:[4]

 steamcmd.exe +login anonymous +force_install_dir somedirectorypath +app_update 298740 +quit

Quick Server Setup

You have two options, foreground app or background service:

A foreground application is the easier method if you don’t have admin permissions. The game server runs normally as an active program, only one instance at a time. But when you restart the PC, all foreground apps are closed, and someone has to manually start the game server again.

A service keeps running in the background, even if you close its application window. You can run several services (= several game worlds) at the same time on one host PC — only limited by its memory and performance. After a reboot, a game server running as a service starts itself, and players can immediately log in again.

Setup as a foreground process:

  1. Run SpaceEngineersDedicated.exe.
  2. Choose “Local/Console” item in list of servers.
  3. Click “Continue to server configuration”.
  4. Here you can set variety of options. They work the same way as in the game.
  5. Give your server a name.
  6. Press “Save and start” and you are ready to play.

Setup as a service:

  1. Run SpaceEngineersDedicated.exe as Administrator.
  2. Press the “Add new instance” button.
  3. Give your service a name (must be unique system-wide).
  4. Choose the service you just created from the list of server instances.
  5. Set up your game the same way as when running it as a foreground process.
  6. Pay attention to ports in “Server settings” and make sure each port is only used by one server instance.

User Interface

Dedicated Server User Interface

1. Server List

  • Here you can see the list of the server instances. There’s always one instance named “Local/Console” and optionally several other instances with custom names.
     
  • The “Local/Console” instance is run on foreground as a standard application and is always there, while the other instances that the user creates are run in the background as Windows services.
     

2. Global Configuration

  • Here you can set, whether the game log files should have dates appended to them and whether the server should automatically send the log files to Keen Software House upon crash.
     

3. Service Management

  • This message is shown when the application is not run with administrator permissions.
     
  • If you want to create or manage the server as a service you need administrator rights. The button “Run as Admin” will restart the application with administrator rights.
     

4. Buttons

"Add new instance"
Creates a new instance of the dedicated server as a Windows service.
"Remove instance"
Continue to server configuration - Starts server instance configuration utility for the selected instances.
"Continue to server configuration"
Starts server instance configuration utility for the selected instances.
"Exit"
Closes the configuration utility

Server Management

Dedicated Server User Interface - Server Management

1. Connect to Steam Some of the features of the UI are using Steam to help users to fill correct values. You can connect to Steam to get your friends and mods lists. To be able to use this you have to be logged into Steam on that machine.

2. Features There are 4 main features on the UI:

  • Server Settings
  • Plugins - Server plugin management
  • Remote Client
  • Console - Console output for running server


3. New game / Saved worlds option Lets you choose between starting a new world generated from a scenario, or loading a previously saved world. The previously saved worlds are loaded either from the “AppData\Roaming\SpaceEngineersDedicated\Saves” folder in your home directory (e.g. “C:\Users\John.Doe”) or from the “ProgramData\SpaceEngineersDedicated” folder in the system root. To be able to play a local world that you previously created and saved on the dedicated server, copy it from your save game directory “AppData\Roaming\SpaceEngineers\Saves” to the respective SpaceEngineersDedicated folder.

4. Game settings Scenario - Can only be chosen for the “New game” option. Other settings work as you know them from the game with the added bonus that you can set the numerical options to any value you want. (Warning: Values out of the range allowed by the game user interface are not tested and officially unsupported. They can seriously affect the game experience and performance)

5. Server settingsGeneral Listen IP - Address of network interface that the server will listen on. This can be set to “0.0.0.0” (which is the default value) to listen on all interfaces, which should work fine in most cases Port – Number of the port that the server will listen on Server name - Name that will be shown in the server list World name - Name of the world, which shows up in the server list Steam Group ID – If set to non-zero value, the dedicated server will only be visible for the given Steam group Password - Password for the server, if you need protected private server Remote API - Remote API for controlling server with VRage Remote Client Server Description - Describes your server

Users You can select Admins, Banned and Reserved slots users on this tab. You can use your friends list or from history of the world. Note: By “Steam ID” we mean the unique numerical identifier for a Steam account in the 64-bit format. Your Steam ID in this format can be found in the game log after running the game with Steam logged-in to your Steam account (see above) or using external tools like http://steamid.co/ or http://steamidfinder.ru/

Mods You can select Active Mods on this tab. You can use your Subscribed Mods list from Steam.

MotD - Message of the Day You can fill Message of the Day and Message of the Day URL on this tab. This message will show up to every player, when connected to the server. You can use variables in the content of the MotD. Use the context menu of the text field to insert a variable of your choice. This variable will be replaced by actual value, when it shows to the player.

Maintenance You can setup Auto Restart and Auto Update features on this tab.

6. Configuration and Server controls

  • Save config - Saves the configuration for the current server instance
  • Edit config - Opens the current instance’s configuration file in a text editor for manual editing
  • Save & start - Saves the current configuration and starts the server
  • Restart – Restarts the server
  • Stop – Stops the server
  • Back to instances - Returns to the screen with the list of server instances

Exit - Closes the configuration utility (but not the dedicated server, if it is running as a service) Setup Actions - this feature can Stop/Restart server with delay and chat message on the server.

Plugins Management

Plugins Management

You can use plugins management for server side plugins setup. Add plugin assembly and then select plugin.

Remote Management

Remote Management

Remote Client helps you with the administering of your server without connecting to it. There is a monitoring tab with information about simulation speed and game play state. Admin tools tab is similar to Admin Screen (alt-F10). You can see global server chat, connected, banned or kicked players, list of all grids, characters, floating objects, planets and asteroids.

Standalone executable There is standalone version of Remote Client in the Dedicated Server directory. You can start it by executing VRageRemoteClient.exe file. Standalone version has more features like Profiles or Notifications.

Standalone remote management
Standalone Remote Management

Command Line Tool

You can run SpaceEngineersDedicated.exe with the following arguments:

  • -console skips instance selection dialog, dedicated server configuration dialog, and goes directly to console application.
  • -noconsole will run without black console window.
  • -path <path> will load config and store all files in path specified ("D:\Whatever\Something" in example).
  • -ignorelastsession ignores last automatic save of the world and uses values from config file.
  • -session:<worldPath> overrides last session with this world path.
  • -maxPlayers <num> overrides maximum players that can be in session.
  • -ip <ip> overrides ip address of dedicated server stored in config file.
  • -port <num> overrides port value stored in config file.
  • -plugin <filepath> loads a .dll as a plugin for DS (requires a password for game client).
  • -eos forces use of EOS network.
  • -np <key:value> sets optional network parameters for EOS network only, see SpaceEngineers-Dedicated.cfg for keys and defaults.
  • -selectInstance <name>
  • -checkAlive
  • -start

The <param> means you're required to replace it by something (don't include < and >), for more on this: Command Line Interface: Command description syntax.


Can also use taskkill /IM SpaceEngineersDedicated.exe (not as an argument to anything) to stop the dedicated server correctly, saving the world etc.
To stop it immediately add argument /f, which will kill the server without asking to stop and without saving the world.

Changing data directory on dedicated server

To change data directory for dedicated server, mklink command may be used.

  1. Make sure 'D:\Something\DirForData' exists
  2. Make sure 'C:\ProgramData\SpaceEngineersDedicated' does not exists
  3. Run command: mklink /J C:\ProgramData\SpaceEngineersDedicated D:\Something\DirForData

More information here (see Junction)

Router and Firewall Settings

  1. Static IP: If you intend to run a game that people from all over the Internet can connect to, you will need a static public IP address. Your internet service provider should tell you whether you have one or not. Without the static IP address, you will be able to host a dedicated server on your LAN, but people from outside the LAN won’t be able to connect to it.
  1. Port forwarding: The game uses UDP protocol to communicate. The default listen port is 27016, but this can be changed in the config tool. In order for people to be able to reach your server, you will have to configure your router to forward all incoming UDP traffic on port 27016 (or any other that you have specified) to the computer where your dedicated server is running.
  1. Firewall settings: Make sure to set the firewall on your server computer to allow incoming UDP traffic on the listen port.

Note: If you don't know how to open ports go to http://portforward.com/

How to find your group ID

If you want to find your Group ID, this is a way how to do it:

  1. First you have to be a member of the group
  2. On the group's page (e.g. http://steamcommunity.com/groups/rps), click "Invite Friends"
  3. On the new page that will open, you can find your Group ID (long number in bold) in the page's URL: http://steamcommunity.com/id/pikacc/friends/?invitegid= 103582791429554934

SpaceEngineers-Dedicated.cfg

This file is in the server's AppData and contains all the settings you see in the GUI and a few extra that are not in the GUI.

One such hidden configurable is <NetworkParameters>.
It is only used by EOS networking mode, and these are the available options and their defaults:

<NetworkParameters>
  <Parameter>globalMaxUpload:600</Parameter>
  <Parameter>peerMaxUpload:600</Parameter>
  <Parameter>statWindow:60</Parameter> <!-- seconds -->
  <Parameter>peakStatWindow:60</Parameter> <!-- seconds -->
</NetworkParameters>

These can also be assigned using startup argument -np <key:value>, repeated for every thing you wish to set.
For example: SpaceEngineersDedicated.exe -console -np globalMaxUpload:1000 -np peerMaxUpload:1000

This was found in game code with a decompiler, for quick reference it's at MyP2PQoSAdapter's constructor.

Remote API

Remote API is RESTful web API, which you can use to get information about the server and running world. You can use VRage Remote Client to get the data or you can make your own client. These are available resources:

VRage remote management resources

You can get information about API by calling GET on api resource (for example http:\\localhost:8080\vrageremote\api )

Custom Client If you want to make your own client you have to properly create a request. Remote API is using HMAC (HMACSHA1) to compute hash from specific data. HMAC is using private key. Don’t share this key with anyone.

You have to compute hash from string (lines): URL - including query parameters Nonce - random string, can be used only once, can be a number Date - UtcNow, format r, RFC1123 pattern, must be added to header

This is converted to byte buffer from UTF8 string and then used to compute hash. Hash is converted to Base64 string and added to header to Authorization field in format “nonce:hash”.


Example of code in C# (using RestSharp library) :

private readonly string m_remoteUrl = "/vrageremote/{0}";

       public RestRequest CreateRequest(string resourceLink, Method method, 
       params Tuple<string, string>[] queryParams)
       {
           string methodUrl = string.Format(m_remoteUrl, resourceLink);
           RestRequest request = new RestRequest(methodUrl, method); 
           string date = DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture);
           request.AddHeader("Date", date); 
           m_nonce = random.Next(0, int.MaxValue);
           string nonce = m_nonce.ToString();
           StringBuilder message = new StringBuilder();
           message.Append(methodUrl); 
           if (queryParams.Length > 0)
           {
               message.Append("?");
           }

           for (int i = 0; i < queryParams.Length; i++)
           {
               var param = queryParams[i];
               request.AddQueryParameter(param.Item1, param.Item2);
               message.AppendFormat("{0}={1}", param.Item1, param.Item2);
               if (i != queryParams.Length - 1)
               {
                   message.Append("&");
               }
           }

           message.AppendLine();
           message.AppendLine(nonce);
           message.AppendLine(date);
           byte[] messageBuffer = Encoding.UTF8.GetBytes(message.ToString());

           byte[] key = Convert.FromBase64String(m_securityKey);
           byte[] computedHash;
           using (HMACSHA1 hmac = new HMACSHA1(key))
           {
               computedHash = hmac.ComputeHash(messageBuffer);
           }

           string hash = Convert.ToBase64String(computedHash);
           request.AddHeader("Authorization", string.Format("{0}:{1}", nonce, hash));
           return request;
       }

References