Microsoft Windows dedicated server

From SDG Wiki
Revision as of 20:03, 20 February 2019 by MoltonMontro (talk | contribs)
Jump to: navigation, search

Guide icon.png This is a community guide.
This page is maintained by the community, and will walk you through a specific task or mechanic. As this guide is maintained by the community, it may fail to provide the most reliable support on the subject.

This is a setup guide for hosting a Microsoft Windows dedicated server for Unturned (version 3). With Microsoft Windows, hosting a dedicated server is relatively straightforward and intuitive.

Game shortcut method

The quickest method of hosting a dedicated server on Microsoft Windows is by creating a game shortcut of the Unturned.exe downloaded by the Steam client when the game was locally installed. However, this method cannot be used with modules such as RocketMod.

Navigate to the game directory

The first step in this method is to navigate to the game directory. Without knowing how to reach the Unturned directory from File Explorer manually, Steam can be used to navigate there directly instead.

Open Steam, and navigate the Steam library. Find Unturned, and right-click on it. From the context menu, left-click on "properties" and go to the "local files" tab. From there, left-click on "browse local files..." and the game directory will open in File Explorer.

Making the shortcut

In the game directory, find the file named Unturned.exe. Right-click on the executable, and select "create shortcut". The resulting file will be named Unturned.exe - Shortcut, but can be renamed to anything.

Right-click on the shortcut, and open up its properties. The "target" field must be modified for the server to be able to run. The target field will initially appear similar to the following line of text, although it may differ based on the install directory chosen for Steam.

"C:\Program Files (x86)\Steam\steamapps\common\Unturned\Unturned.exe"

At the end of the text currently in the target field, a set of commands must be appended. "<server's folder name>" is where the desired name of the server's folder should go. This does not have an impact on the server name shown to players publicly, and is only important for personal organization.

 -nographics -batchmode +secureserver\<server's folder name>

After appending the previous line of text, final result will allow for the server files to be generated when the shortcut is ran.

"C:\Program Files (x86)\Steam\steamapps\common\Unturned\Unturned.exe" -nographics -batchmode +secureserver\Server

Run the shortcut

By running the shortcut, with its target field now modified, all of the essential server files will be generated. Once all of the files are done being generated, use the shutdown command to close the server.

SteamCMD method

In order to use modules in conjunction with the server, a separate installation of Unturned is required. This is most easily achieved through using SteamCMD.

Installing SteamCMD

To start, SteamCMD must first be downloaded for Windows. Once downloaded, the package must be extracted. When steamcmd.exe is ran, it will generate new files. So, the executable should be stored in an otherwise empty folder (the initially extracted folder would be suitable for this), and that folder should be stored in an easily accessible area. For this guide, the initially extracted folder named steamcmd is used, and placed in the ...\Documents directory.

Now, run steamcmd.exe and let it generate the various files needed to function properly. It will also download, apply, extract, and install various updates.

Downloading Unturned

In order to download the necessary files, logging in with a Steam account and its proper login credentials is required. Logging in anonymously will not work.

If the Steam account has enabled Steam Guard two-factor authentication, then it will not be fully compatible with the optional "Update" script, and will require proper account authentication every time that account attempts to update the server. To fully take advantage of the Update script, it may be advisable to create a separate Steam account, that does not use Steam Guard, rather than to disable Steam Guard on the main account.

login <username> <password>

Replace "<username>" and "<password>" with the account's username and password, respectively. After having logged in, a directory path must now be set. The following command line entry will set the directory path to a folder called unturned, set in the current directory.

force_install_dir .\unturned\

Run app_update 304930 in order to generate the game files. These files will appear in the most recently accessed directory, which should be at .\unturned\. After the game files finish downloading, use quit to close SteamCMD. The files may take some time to download, as it is installing the entire game at the specified directory.

Update script

Create a new file called UpdateUnturned.bat. A BAT (batch) file is a type of script file that consists of a series of commands (stored in an otherwise plain text file) to be executed by a command-line interpreter. If the file is being treated as a TXT instead, either manually save it as the desired file type, or enable the viewing of file name extensions in File Explorer and then attempt to rename it as a batch file.

Right-click the batch file, and open it with a text editor (such as Notepad++). Adding the following line of text to it.

steamcmd +login <username> <password> +force_install_dir .\unturned\ +app_update 304930 +quit

Once again, "<username> <password>" must be replaced with the account's username and password, respectively. If the account has Steam Guard enabled, it will not be able to utilize this script as intended. However, if Steam Guard is not enabled on the account, these commands will cause SteamCMD to check for updates to Unturned whenever the script is executed.

Save the file, and close out of it.

Verification script

There is no reason to tamper with the game files that have been downloaded through SteamCMD. However, if they are tampered with, and subsequently damaged, it is important to be able to easily fix the files.

By creating a batch file in a similar method to the aforementioned "Update script", a script can be created that will verify the integrity of the game files when ran (and subsequently repair anything missing or damaged). The "Verification script" should contain the following line of text, which are the same as the Update script's with the exception of having SteamCMD validate files rather than just check for updates.

steamcmd +login <username> <password> +force_install_dir .\unturned\ +app_update 304930 validate +quit

If it is preferred, this can be used in place of the Update script. However, it will always take significantly longer to run, even if there has been no update to the game and no files are damaged. Both scripts are entirely optional, and are only provided to make maintaining the server easier.

Creating the server

Creating the server is nearly identical to the "Game shortcut method" detailed at the top of the page, with the exception of an entirely different directory being used. The instructions provided below will be a briefer version of the instructions provided for the game shortcut method. For more information, refer to the game shortcut method.

  1. Still inside the steamcmd folder, navigate to the game directory. In this guide, it was named unturned.
  2. Create a shortcut of Unturned.exe. Open its properties, and append the following line of text to the very end of the target field: -nographics -batchmode +secureserver\Server.
  3. Save the changes made to the target field and run the shortcut. This will generate all of the necessary server files.
  4. When the files are done being generated, use shutdown to close the server.