For the complete documentation index, see llms.txt. This page is also available as Markdown.

Dont Starve Together

Authentication Token

Don't Starve Together server requires an Authentication Token.

  1. Go to the Klei website https://accounts.klei.com.

  2. After logging into your account visit this page to get your game server authentication token.

  3. Enter a friendly name for your server and copy the access token and paste it into the file cluster_token.txt.

You can quickly do this by running the following command, replacing [AUTHTOKEN] with your authentication token.

echo '[AUTHTOKEN]' > ~/.klei/DoNotStarveTogether/[CLUSTER]/cluster_token.txt

Clusters and Shards

A Don't Starve Together server consists of clusters and shards.

One cluster can contain multiple shards. A shard is simply a map/level. Multiple shards are connected by cave entrances/exits found on the map. These are functioning as portals to allow players to travel between actual game servers.

Each shard (level of the world) has to be run as an individual game server instance.

Single-Shard

By default, the cluster will be single-sharded. So you only need one server but you will also only have one map.

Default start parameter setting:

sharding="false"

Multi-Shard

Take a look at Multiple-Servers to get a general idea of how to create multiple game servers.

There are two types of shards:

  1. master shard: the shard you enter when joining the server / the shard/server you have to join (one per cluster)

  2. slave shard: shard that will connect to the master (arbitrary number per cluster)

In this example, we will only use two shards, one overworld shard and one cave shard, on the same machine using the same installation. If you want to use more shards or run the shards on different machines, take a look at the guides mentioned at the bottom. First of all we need two scripts:

Server #1

dstserver-1 will be the master shard with an overworld as level.

~/.klei/DoNotStarveTogether/Cluster_1/Master/server.ini

Server #2

dstserver-2 (this will be the slave shard with a cave as level):

~/.klei/DoNotStarveTogether/Cluster_1/Caves/server.ini

If you want to Caves and Overworld to display on the same server, you also to change the cluster.ini, otherwise it will run two instances, one with the Overworld and another with the Caves:

~/.klei/DoNotStarveTogether/Cluster_1/cluster.ini

Set all installation variables BEFORE running the ./dstserver-[1,2] install commands. Feel free to change these settings but make sure that you set them to the same clusters. You also should not change them afterwards.

For clarity it is recommended recommend naming the master shard Master.

Lastly you have to start both servers. The order does not matter because the slave server will auto-retry connecting to the master server which is listening.

Caves

Setting cave="true" on a shard is all that is required to turn it into an actual cave, LinuxGSM handles the rest automatically during install.

cave only affects world generation. It has no effect unless sharding="true" and shard is set to a unique name for that instance, as shown in the dstserver-2 example above.

When a server is installed with cave="true", LinuxGSM writes the following file for you:

~/.klei/DoNotStarveTogether/Cluster_1/Caves/worldgenoverride.lua

This is what tells the game to generate an underground cave map for that shard instead of a normal overworld. Without it, a "Caves" shard would just generate a second overworld map. Since this file is only written on install, changing cave on an already-installed shard requires a fresh install (or a reinstall) of that instance to regenerate the world with the new preset.

Installing Mods

LinuxGSM does not install or manage Don't Starve Together mods automatically, this has to be done manually in three steps.

1. Enable mods for download

Add each mod's Steam Workshop ID to dedicated_server_mods_setup.lua so the dedicated server downloads it from the Workshop.

~/serverfiles/mods/dedicated_server_mods_setup.lua

Run ./dstserver update (or install) afterwards so the mods get downloaded.

2. Enable mods per shard

Each shard (Master and Caves) needs its own modoverrides.lua listing which mods are enabled for that shard.

~/.klei/DoNotStarveTogether/Cluster_1/Master/modoverrides.lua

Copy the same file into the Caves shard directory if you want the mod active there too, most world/gameplay mods need to be enabled on both shards to behave consistently.

3. Configure mod settings (optional)

Some mods expose extra configuration options (difficulty, spawn rates, etc). The easiest way to generate a correctly formatted modoverrides.lua with these settings is to temporarily host a non-dedicated client server with the same mods enabled, configure the mods through the in-game mod options UI, generate the world once, then copy the resulting modoverrides.lua from that client's save folder over to both the Master and Caves shard directories on the dedicated server.

Guides / Documentations:

Last updated

Was this helpful?