Guides/Simple Dedicated Server Setup

From Don't Starve Wiki
Jump to navigation Jump to search
Icon Books.png This article may contain instructional language and subjective recommendations. Readers should read the content carefully, and follow accordingly.

This is a step-by-step guide for setting up a dedicated server that has both Forest and Caves, playable from the in-game Browse Games screen. We will also setup a script file that can be used to easily launch the server. (In technical terms, we are making a cluster of 2 shards) There will be a bare minimum amount of knobs that you can tweak in this process. If you would like to see more configuration options after completing this guide, refer to Guides/Don’t Starve Together Dedicated Servers.

This guide assumes that you own a copy of Don't Starve Together on steam, and have a Klei account bound to it. This guide is applicable to Windows.

This guide will walk through the process step-by-step, creating each configuration file manually rather than providing a "quick start" set of files you can just download. This is done as a complement to the already existing "quick start" files provided by Klei, hoping that you will be able to have a rough idea of what each config file does afterwards.

Installing the Server

  • Click the Library tab
  • Click the Game dropdown menu on the left panel above all your games
  • Check the Tools Filter
  • Scroll to Don't Starve Together Dedicated Server, right-click and select Install Game...
  • Follow the steps to install like any other Steam game

Take note of where the server is installed to. You find this by using Steam's Browse local files function, and copy the location from the file explorer window address bar. By default, this is C:/Program Files (x86)/Steam/steamapps/Don't Starve Dedicated Server.

From now on, this path will be denoted as GAME_DIR, so for example GAME_DIR/bin/dontstarve_dedicated_server_nullrenderer.exe refers to C:/Program Files (x86)/Steam/steamapps/Don't Starve Dedicated Server/bin/dontstarve_dedicated_server_nullrenderer.exe.

Preparing a Cluster Token

Open Don't Starve Together the game client. Press tilde (~) (or ù on Azerty keyboards) in the game client to open the developer console. Execute this command:

TheNet:GenerateClusterToken()

And then navigate to Documents/Klei/DoNotStarveTogether/cluster_token.txt, the content inside this file is your cluster token which will be useful below. Do not share it with others as it is an identification that links the particular server instance with your Klei account.

Server Configuration Files

Pick a location on your disk in which all of the server save files and config files will go. This can be anywhere in the system, for example C:/MyDSTServer. From now on, this path will be denoted as SERVER_DIR.

We will create the following folders and files (a trailing slash '/' means this item is a folder, and without it this is a file):

SERVER_DIR/
|- Master/
|  |- server.ini
|  \- worldgenoverride.lua
|- Caves/
|  |- server.ini
|  \- worldgenoverride.lua
|- cluster.ini
\- cluster_token.txt

SERVER_DIR/cluster.ini

Write this in SERVER_DIR/cluster.ini. You may copy paste all code snippets that appaer in this guide, with the exception that text which are italicized must be replaced by you with reasonable values. What do they do will be documented in the paragraphs above each code snippet.

Replace YOUR SERVER PASSWORD with the password of your server. This is the password that players enter when they join the server in-game. Leave this empty to use no password.

Replace YOUR SERVER NAME with the name of your server. This appears as the server name in the in-game Browse Games screen. Do not leave empty.

Replace YOUR SERVER DESCRIPTION with an apt description. This appears as the server description in the in-game Browse Games screen. Leave empty to not have a description.

Replace GAME MODE with one of survival, endless, or wilderness. This field is the equivalent of the Game Mode field on the“Host Game screen.

[GAMEPLAY]
pause_when_empty = true
game_mode = GAME MODE

[NETWORK]
cluster_password = YOUR SERVER PASSWORD
cluster_name = YOUR SERVER NAME
cluster_description = YOUR SERVER DESCRIPTION
autosaver_enabled = true

[SHARD]
shard_enabled = true
cluster_key = defaultPass1

SERVER_DIR/cluster_token.txt

Copy and paste your cluster token into cluster_token.txt.

SERVER_DIR/Master/server.ini

[NETWORK]
server_port = 10998

[SHARD]
is_master = true
name = Master
id = 1

[STEAM]
master_server_port = 27016
authentication_port = 8766

[ACCOUNT]
encode_user_path = true

SERVER_DIR/Master/worldgenoverride.lua

Replace WORLD PRESET with one of SURVIVAL_TOGETHER (the default in worlds created in the game client), SURVIVAL_TOGETHER_CLASSIC, SURVIVAL_DEFAULT_PLUS, COMPLETE_DARKNESS, or TERRARIA. This field is the equivalent to the world presets option in the Host Game screen.

KLEI     1 return {
  override_enabled = true,
  preset = "WORLD PRESET",
}

SERVER_DIR/Caves/server.ini

[NETWORK]
server_port = 10999

[SHARD]
is_master = false
name = Caves
id = 2

[STEAM]
master_server_port = 12346
authentication_port = 10166

[ACCOUNT]
encode_user_path = true

SERVER_DIR/Caves/worldgenoverride.lua

Replace WORLD PRESET with one of DST_CAVE, (the default in worlds created in the game client), DST_CAVE_PLUS, or TERRARIA_CAVE. This field is the equivalent to the world presets option in the Host Game screen.

KLEI     1 return {
  override_enabled = true,
  preset = "WORLD PRESET",
}

Creating a Server Start Script

Work-in-progress