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:
1
sharding="false"
Copied!
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:
1
./dstserver-1
2
./dstserver-2
Copied!
Server #1
dstserver-1 will be the master shard with an overworld as level.
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
1
[SHARD]
2
shard_enabled =true
Copied!
Set all installation variables BEFORE running the./dstserver-[1,2] installcommands. 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.