Don't Starve Together
123 ψήφοι
How to setup dedicated server with cave on Windows Server
Από ToNiO και 1 συνεργάτες
This guide is for helping step by step to installed a dedicated server for don't starve together with cave on Windows Server

----

I want to clarify that I will show my method to create a server on windows server,
maybe it's not the best method,but at least it works fine, there are lots of ways to do this,

you can even make your own scripts, I just want to explain the installation with maximum information,
I give just one example but you can customize your install as you wish

----

This guide is making on Windows Server 2008 R2 64 Bits,

I use VMware Workstation for make this guide

this software can virtualize any system on your computer without change your current system

so I don't use FTP client to transfer files as Filezilla or Flashfxp

but you can very well do for cluster.ini, server.ini, worldgenoverride.lua and other file.
   
Βραβείο
Αγαπημένο
Αγαπημένο
Μη αγαπημένο
Summary


THIS GUIDE IS RECOMMAND FOR THE FOLLOWING OPERATING SYSTEMS:

  • WINDOWS SERVER 2008
  • WINDOWS SERVER 2008 R2
  • WINDOWS SERVER 2012
  • WINDOWS SERVER 2012 R2
  • WINDOWS SERVER 2016

IF YOU ARE ON THE FOLLOWING OPERATING SYSTEMS:

  • WINDOWS 7
  • WINDOWS 8
  • WINDOWS 10

I RECOMMAND TO USE MY OTHER GUIDE WITH STEAM TOOLS:

http://steamcommunity.com/sharedfiles/filedetails/?id=635281092
Create user and install SteamCMD:
you need to create user and connect with him on your windows server:

login with account Administrator of your windows server for create user

  • Start => Control panel => User account => User account => Manage Accounts => Create New Account

  • put dst_server (or other username if you want)
  • choose Administrator
  • create account
  • click on your new account
  • create a password





log off of the session Administrator and login with dst_server

create folder steamcmd in C:\ (you can do it on another partition if you have one)

download steamcmd in this folder








Install the files for server don't starve together with SteamCMD
so you just need to execute software steamcmd in folder steamcmd

and install the server don't starve together in new folder with name server

  • go in folder steamcmd (the file folder)
  • launch software steamcmd
  • wait end of update about steamcmd
  • login anonymous
  • force_install_dir C:\Server (Steamcmd going create the folder Server)
  • app_update 343050 validate
  • when install is finish write exit













Script for start server Overworld and Cave
you need to create two batch files for start two instances for each of the servers
(start.bat and start2.bat)

so you need to go in folder of the server and create two batch files

  • go in C:\server\bin
  • create Text Document
  • Open New Text Document
add this:
  • dontstarve_dedicated_server_nullrenderer -console -cluster MyDediServer -shard Master
save with this name: start.bat

stay in start.bat

add this:
  • dontstarve_dedicated_server_nullrenderer -console -cluster MyDediServer -shard Caves
save with this name: start2.bat

close the Text Document

now you can see you have your both batch files (start.bat and start2.bat)






















here the option list for command line:

-persistent_storage_root

  • Change the directory that your configuration directory resides in. This should be an absolute path. The full path to your files will be <persistent_storage_root>/<conf_dir>/ where <conf_dir> is the value set by -conf_dir. The default for this option depends on the platform:

  • Windows: <Your documents folder>/Klei
  • Mac OSX: <Your home folder>/Documents/Klei
  • Linux: ~/.klei

-conf_dir

  • Change the name of your configuration directory. This name should not contain any slashes. The full path to your files will be <persistent_storage_root>/<conf_dir> where <persistent_storage_root> is the value set by the -persistent_storage_root option. The default is: "DoNotStarveTogether".

-cluster

  • Set the name of the cluster directory that this server will use. The server will expect to find the cluster.ini file in the following location: <persistent_storage_root>/<conf_dir>/<cluster>/cluster.ini, where <persistent_storage_root> and <conf_dir> are the values set by the -persistent_storage_root and -conf_dir options. The default is "Cluster_1".

-shard

  • Set the name of the shard directory that this server will use. The server will expect to find the server.ini file in the following location:<persistent_storage_root>/<conf_dir>/<cluster>/<shard>/server.ini, where <persistent_storage_root>, <conf_dir>, and <cluster> are the values set by the -persistent_storage_root, -conf_dir, and -cluster options. The default is "Master".

-offline

  • Start the server in offline mode. In offline mode, the server will not be listed publicly, only players on the local network will be able to join, and any steam-related functionality will not work.

-console

  • Allow lua commands to be entered in the command prompt or terminal that the server is running in.

-bind_ip <bind_ip>

  • Change the address that the server binds to when listening for player connections. This is an advanced feature that most people will not need to use.

-port <port_number>

  • Valid values: 1..65535
  • The UDP port that this server will listen for connections on. This option overrides the [NETWORK] / server_port setting in server.ini. If you are running a multi-level cluster, this port must be different for each server. This port must be between 10998 and 11018 inclusive in order for players on the same LAN to see it in their server listing. Ports below 1024 are restricted to privileged users on some operating systems.

-players <max_players>

  • Valid values: 1..64
  • Set the maximum number of players that will be allowed to join the game. This option overrides the [GAMEPLAY] / max_players setting in cluster.ini.

-steam_master_server_port <port_number>

  • Valid values: 1..65535
  • Internal port used by steam. This option overrides the [STEAM] / master_server_port setting in server.ini. Make sure that this is different for each server you run on the same machine.

-steam_authentication_port <port_number>

  • Valid values: 1..65535
  • Internal port used by steam. This option overrides the [STEAM] / authentication_port setting in server.ini. Make sure that this is different for each server you run on the same machine.

-backup_logs

  • Create a backup of the previous log files each time the server is run. The backups will be stored in a directory called "backup" in the same directory as server.ini.

-tick <tick_rate>

  • Valid values: 15 .. 60
  • This is the number of times per-second that the server sends updates to clients. Increasing this may improve precision, but will result in more network traffic. This option overrides the [NETWORK] / tick_rate setting in cluster.ini. It is recommended to leave this at the default value of 15. If you do change this option, it is recommended that you do so only for LAN games, and use a number evenly divisible into 60 (15, 20, 30).
Start and stop Both Server (it's going create settings folder Master and Caves)
you can launch both batch files for create Server Overworld (folder Master) and Server Cave (folder Caves)
  • execute start.bat and start2.bat
  • stop both DOS prompt when you have "your server will not start"

You need to settings both servers with cluster_token.txt, server.ini, worldgenoverride.lua
For find your token you just need to launch your game and go in your account info:

Go in Play



Go in account info





now you can see your token (Klei Dedicated Server Token)
if you don't see your token,
you just need to add in the white box Klei Dedicated Server Token
and click on Generate Server Token
note and keep your token for use to the next step
Put your token in cluster_token.txt
the token is mandatory without him your server can not be online, it allows for Klei to have the option to remove the server in case of violation or problem with this server
  • go in Documents\Klei\DoNotStarveTogether\MyDediServer
  • create Text Document
  • rename this file as: cluster_token.txt
  • open the cluster_token.txt
  • add your token in this file
  • save the file and quit







Add worldgenoverride.lua on both servers
worldgenoverride.lua represents the settings to generate the world for don't starve together, so you can adjust the season, monsters, or biomes and more

Server Overworld:
  • go in Documents\Klei\DoNotStarveTogether\MyDediServer\Master
  • create Text Document
  • open New Text Document
copy the code lua in the link below and paste in your file:
worldgenoverride.lua for server Overworld[pastebin.com]

now you need to save your file with this name: worldgenoverride.lua (check screenshots) after that you can delete New Text Document











Server Cave:
  • go in Documents\Klei\DoNotStarveTogether\MyDediServer\Caves
  • create Text Document
  • open New Text Document
copy the code lua in the link below and paste in your file:
worldgenoverride.lua for server Caves[pastebin.com]

now you need to save your file with this name: worldgenoverride.lua (check screenshots) after that you can delete New Text Document









List of option for cluster.ini and server.ini
cluster.ini have settings for both servers (server name, slots, gametype)

here the option list for cluster.ini:

[MISC]

max_snapshots

  • Default: 6
  • Maximum number of snapshots to retain. These snapshots are created every time a save occurs, and are available in the “Rollback” tab on the “Host Game” screen.

[SHARD]

shard_enabled

  • Default: false
  • Enable server sharding. This must be set to true for multi-level servers. For single-level servers, it can be omitted.

bind_ip

  • Overridable in server.ini
  • Default: 127.0.0.1
  • Required: If shard_enabled = true and is_master = true
  • This is the network address the master server will listen on for other shard servers to connect to. Set this to 127.0.0.1 if all of your servers in your cluster are on the same machine, or 0.0.0.0 if the servers in your cluster are on different machines. This only needs to be set for the master server, either in cluster.ini, or the master server's server.ini.

master_ip

  • Overridable in server.ini
  • Default: none
  • Required: If shard_enabled = true and is_master = false
  • This is the I.P. address that a non-master shard will use when trying to connect to the master shard. If all servers in a cluster are on the same machine, set this to 127.0.0.1

master_port

  • Overridable in server.ini
  • Default: 10888
  • This is UDP port that the master server will listen on, and that a non-master shard will use when trying to connect to the master shard. This should be set to the same value for all shards by having a single entry in cluster.ini, or omitted completely to use the default.

cluster_key

  • Overridable in server.ini
  • Default: none
  • Required if shard_enabled = true
  • This is a password used to authenticate a slave server to the master. If you are running servers on different machines that need to connect to each other, this value must be the same on each machine. For servers running on the same machine, you can just set this once in cluster.ini.

[STEAM]

steam_group_only

  • Default: false
  • When set to true, the server will only allow connections from players belonging to the steam group listed in the steam_group_id setting.

steam_group_id


steam_group_admins

  • Default: false
  • When this is set to true, admins of the steam group specified in steam_group_id will also have admin status on the server.

[NETWORK]

offline_server

  • Default: false
  • Create an offline server. The server will not be listed publicly, and only players on the local network will be able to join, and any steam-related functionality will not work.

tick_rate

  • Default: 15
  • This is the number of times per-second that the server sends updates to clients. Increasing this may improve precision, but will result in more network traffic.

whitelist_slots

  • Default: 0
  • The number of reserved slots for whitelisted players. To whitelist a player, add their Klei UserId to the whitelist.txt file (Place this file in the same directory as cluster.ini)

cluster_password

  • Default: none
  • This is the password that players must enter to join your server. Leave this blank or omit it for no password.

cluster_name

  • The name for your server cluster. This is the name that will show up in server browser.

cluster_description

  • Default: empty
  • Cluster description. This will show up in the server details area on the “Browse Games” screen.

lan_only_cluster

  • Default: false
  • When set to true, the server will only accept connections from machines on the same LAN

cluster_intention

  • Default: Varies, depending on game mode.
  • The cluster’s playstyle. This field is the equivalent of the “Server Playstyle” field on the “Host Game” screen. Valid values are cooperative, competitive, social, or madness.

[GAMEPLAY]

max_players

  • Default: 16
  • The maximum number of players that may be connected to the cluster at one time.

pvp

  • Default: false
  • Enable PVP.

game_mode

  • Default: survival
  • The cluster’s game mode. This field is the equivalent of the “Game Mode” field on the “Host Game” screen. Valid values are survival, endless or wilderness

pause_when_empty

  • Default: false
  • Pause the server when there are no players connected.

vote_kick_enabled

  • Default: false
  • Set to true to enable the “Vote to Kick” feature.

server.ini have settings for each server (server ports,steam port,activated master or slave):

here the option list for server.ini:

[SHARD]

is_master

  • Default: none
  • Required: If shard_enabled = true
  • Sets a shard to be the master shard for a cluster. There must be exactly one master server per cluster. Set this to true in your master server’s server.ini, and false in every other server.ini.

name

  • Default: none
  • Required: if shard_enabled = true and is_master = false
  • This is the name of the shard that will show up in log files. It is ignored for the master server, which always has the name [SHDMASTER].

id

  • Default: Randomly generated number.
  • This is field is automatically generated for non-master servers, and is used internally to uniquely identify a server. Altering this or removing it may cause problems on your server if anybody’s character currently resides in the world that this server manages.

[STEAM]

authentication_port

  • Default: 8766
  • Internal port used by steam. Make sure that this is different for each server you run on the same machine.

master_server_port

  • Default: 27016
  • Internal port used by steam. Make sure that this is different for each server you run on the same machine.

[NETWORK]

server_port

  • Default: 10999
  • The UDP port that this server will listen for connections on. If you are running a multi-level cluster, this port must be different for each server. This port must be between 10998 and 11018 inclusive in order for players on the same LAN to see it in their server listing. Ports below 1024 are restricted to privileged users on some operating systems.
Create and configure cluster.ini and server.ini
now I'll just going give sample configuration about settings for both servers

cluster.ini:
  • go in Documents\Klei\DoNotStarveTogether\MyDediServer\
  • create Text Document
and add this:

[GAMEPLAY]
game_mode = survival
max_players = 10
pvp = false
pause_when_empty = true

[NETWORK]
cluster_name = TEST Server
cluster_description = Welcome
cluster_password =
cluster_intention = social
autosaver_enabled = true
enable_vote_kick = false

[MISC]
console_enabled = true

[SHARD]
shard_enabled = true
bind_ip = 127.0.0.1
master_ip = 127.0.0.1
master_port = 11001
cluster_key = dst

now you need to save your file with this name: cluster.ini (check screenshots) after that you can delete New Text Document











server.ini for server Overworld:
  • go in Documents\Klei\DoNotStarveTogether\MyDediServer\Master
  • create Text Document
and add this:

[NETWORK]
server_port = 10999


[SHARD]
is_master = true


[STEAM]
master_server_port = 12346
authentication_port = 12345

now you need to save your file with this name: server.ini (check screenshots) after that you can delete New Text Document











server.ini for server Caves:
  • go in Documents\Klei\DoNotStarveTogether\MyDediServer\Caves
  • create Text Document
and add this:

[NETWORK]
server_port = 11000


[SHARD]
is_master = false
name = Caves


[STEAM]
master_server_port = 12348
authentication_port = 12347

now you need to save your file with this name: server.ini (check screenshots) after that you can delete New Text Document









Testing both servers
just need to execute start.bat and start2.bat for see if servers works or not
  • go in C:\server\bin
  • execute start.bat and start2.bat
  • check the log if both servers work together (check screenshots)
  • now go in the game for see if server is online
  • join the server and check if server overworld and cave works
  • if yes you can stop both servers for next step (close both DOS prompt)











if you have this error '[200] Account Failed (6): "E_EXPIRED_TOKEN"'

it's look like problem with token:

Do not simply copy and paste the contents of this file from one machine to another. Move the actual file from one machine to another.

The cluster_token.txt is a null byte terminated ASCII file (no line endings). If the GSA attempts to copy-paste the contents of the token file, the null byte will be omitted and a line ending will be appended to the end. The dedicated server software will not be able to properly parse the cluster_token.txt file in this case.
Create windows service for Batch Files
it's better to used a windows service rather than stay open DOS prompt

so we will create services for each batch file

by default, windows server can not create a service with a batch file,

so let's use the software NSSM

you will quickly understanding, this is going to be very useful for next steps

(i put on the desktop but you can place it where you want)
  • extract all in C:\
  • open DOS prompt run as administrator
  • make: cd C:\
  • make: cd nssm-2.24\win64\
  • now we can install service with this command: nssm install "name of service"

for server Overworld:
  • nssm install server_overworld
  • you just need to give some information about batch file and put your account
    (check screenshots for how make this)

for server Cave:
  • nssm install server_cave
  • you just need to give some information about batch file and put your account
    (check screenshots for how make this)

we can test the service now:
  • we going test server overworld
  • you can delete server_log and server_chatlog for testing
  • go in Documents\Klei\DoNotStarveTogether\MyDediServer\Master
  • delete server_log and server_chatlog
  • go in start => administrative tools => services
  • search service server_overworld, and start the service
  • check if server_log and server_chatlog is created in Documents\Klei\DoNotStarveTogether\MyDediServer\Master
  • of course you can check also if server start correctly in end of log
  • if yes that's mean services of both servers work correctly

PS: you can also start or stop service with DOS prompt run as administrator prompt:
  • net start server_overworld
  • net start server_cave

  • net stop server_overworld
  • net stop server_cave

Download and execute nssm:












Install service for Server Overworld:












Install service for Server Cave:














Testing Service:









Other solution for start or stop service for both servers:

Create Batch Files for stop,update and start both servers
Now that our servers can run as a service, we will create a simple batch file who'll stop both servers then update servers and start the both servers

  • go in C:\server\bin
  • open New Text Document
add this:
  • net stop server_overworld
  • net stop server_cave
  • cd C:\steamcmd\steamcmd
  • steamcmd +login anonymous +force_install_dir C:\server +app_update 343050 validate +quit
  • net start server_overworld
  • net start server_cave
save with this name: update.bat
  • execute update.bat run as administrator for see if it's works
  • you can delete New Text Document

(of course if both servers are already stopped
the batch file update.bat give error in the begin when he trying to stop both servers and it's normal and i have tested update.bat when both servers are running)












Create schedule task for update.bat
now we going create a task to execute update.bat daily at 6:00 am, I going show you a example but you do as you wish
  • click on start => administrative tools => task scheduler
  • click on create basic task
  • put name of the task and description and click on next
  • choose Daily and click on next
  • when you create this task, choose well on the next day (depends when you make this task)
  • choose 6:00:00 AM, and Recur every 1 days and click on next
  • choose start a program
  • go find and choose your update.bat in C:\server\bin and click on next
  • choose "Open The Properties dialog for this task when i click Finish"
  • choose Run with hightest privileges and click on OK






















both servers will be stopped, update, and executed every day at 6:00 am

I hope this guide is good for you and especially to help you for install server DST on Windows Server :)
FAQ - How to reset the map on dedicated server?
when you are in your server DST:

- Press TAB
- Click on Server Actions
- Click on Regenerate World








FAQ - How to make rollback on dedicated server?
when you are in your server DST:

- Press TAB
- Click on Server Actions
- Click on Rollback

this function allows returns to the previous day








FAQ - How banned player if he is not on my dedicated server?
if some players report troll have destroy camp on your server but he is not on the server right now!

you can banned him with SteamID

so you just need name of player and find him in your server_log.txt:


  • Documents\Klei\DoNotStarveTogether\MyDediServer\Master\server_log.txt



now you need copy this SteamID in blocklist.txt

create blocklist.txt here:


  • Documents\Klei\DoNotStarveTogether\MyDediServer\blocklist.txt

just put the SteamID in blocklist.txt:



now restart your server :

go in start => administrative tools => services search service server_overworld, and restart the service



check now in your server_log.txt if your blocklist.txt is loading correctly on your server:

  • Documents\Klei\DoNotStarveTogether\MyDediServer\Master\server_log.txt

you need to find this in your server_log.txt:

  • OnLoadPermissionList: Documents/Klei/DoNotStarveTogether/MyDediServer/blocklist.txt (Success)

so now if player try to join the server, he can't because he is banned!

i have make this test with my SteamID and you can see im banned on my server:




so that's can works for all players
FAQ - How add admin on your dedicated server?
so for add new admin on your server

you need to create adminlist.txt here:


  • Documents\Klei\DoNotStarveTogether\MyDediServer\adminlist.txt

you need to find KU_****** of player in log of your server:

  • Documents\Klei\DoNotStarveTogether\MyDediServer\Master\server_log.txt

( KU_***** matches its identifier on server don't starve together as SteamID on steam )



now you need to add KU_***** in your adminlist.txt:



restart your server:
  • go in start => administrative tools => services search service server_overworld, and restart the service



check now if your adminlist.txt is loading correctly on your server:

  • Documents\Klei\DoNotStarveTogether\MyDediServer\Master\server_log.txt

you need to find this in your server_log.txt:

  • OnLoadUserIdList: APP:Klei/DoNotStarveTogether/MyDediServer/adminlist.txt (Success)

so now you can test with your friend if he have admin permission

you can see if your friend is admin on your server like the following screenshots:




FAQ - How to reserved slots on your dedicated server?
this allows to reserve a number of slots for your friends or an admin of server,

this based on number slots of your server example if you reserved 5 slots and you have 15 slots on your server only 10 players from public can connect on the server

so for my example i going put 2 slots on my server and going put 2 KU_***** in my whitelist.txt

you need to create whitelist.txt here:

  • Documents\Klei\DoNotStarveTogether\MyDediServer\whitelist.txt

as adminlist.txt you need to find KU_***** in log.txt of your server:



now you need to add KU_***** in your whitelist.txt:



(i have add also another KU_***** of other friend for make this test)

so you need also to add this option in your cluster.ini:

below of [NETWORK] add this:

  • whitelist_slots = 2


now restart your server:
  • go in start => administrative tools => services search service server_overworld, and restart the service


check now if your whitelist.txt is loading correctly on your server:
  • Documents\Klei\DoNotStarveTogether\MyDediServer\Master\server_log.txt

you need to find this in your server_log.txt:
  • OnLoadUserIdList: APP:Klei/DoNotStarveTogether/MyDediServer/whitelist.txt (Success)

so now you can test with your friend if reserved slots works

my friend connect on the server before me and then when I try to connect:




that's mean your reserved slots work fine now

this was just an example, but you can change the number of slots as you want
82 σχόλια
technologyfreak 7 Σεπ 2023, 19:58 
A tip for anyone having trouble port forwarding, you need to port forward the server_port[\b] in each of your shards' server.ini[\b] files to get them to be visible within the server browser. Took me an age to figure this out because the only port anyone directly mentioned for port forwarding anywhere that I could find was 10999, which did nothing (and is not needed).
ig881000 1 Δεκ 2022, 14:49 
Just did this right now and my server is online and running. Be careful about the file names that you make, have to be correct. Thank you for this guide, very smart and well explained. I appreciate this.
[nibgib] Darklegend222 16 Ιουλ 2022, 20:51 
This guide needs to be updated, when you start the server(s) it deletes the worldgenoverride files and replaces them every time. Removing +validate for SteamCMD does not affect this.
Joew 9 Φεβ 2021, 6:50 
steamcmd isn`t working on my windows 2008 server. How fix it, please?
It work nice on my home pc with win 10, but don't work on my dedicated with win 2008 server.
The problem is that after exec the bat to update the server, steamcmd opens, but it stills with the same screen:

Steam>

I tried manually put the comand:

login anonymous +force_install_dir C:\server +app_update 343050 validate +quit

But the screen just flashed very fast and stills on the same screen:

Steam>

Like it don't accepted the command and don't run nothing.

How fix it, please?

ty!
Louis XXX 28 Μαρ 2020, 21:08 
My newly created service executes nullrenderer.exe with high CPU load, log file does not appear. Can't imagine where I could mistake.
Hybridizer 15 Δεκ 2019, 13:05 
EXCELLENT guide, wow. Well done.
dromedar 8 Μαρ 2018, 14:27 
[00:00:04]: [200] Account Failed (6): "E_INVALID_TOKEN"
[00:00:04]: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[00:00:04]: !!!! Your Server Will Not Start !!!!
[00:00:04]: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[00:00:04]: No auth token could be found.
[00:00:04]: To generate a cluster_token you must
[00:00:04]: open the console from a logged-in game
[00:00:04]: client with the tilda key (~ / �) and type:
[00:00:04]: TheNet:GenerateClusterToken()
[00:00:04]: This will create 'cluster_token.txt' in
[00:00:04]: your client settings directory. Copy this
[00:00:04]: into your cluster settings directory.
[00:00:04]: [Connect] PendingConnection::Reset(true)
[00:00:04]: ... FilesExistAsyncThread complete
this is happening to me, can somebody help me please?
i doubble-checked everything
Left 4 Sharkbait 17 Νοε 2017, 20:15 
am i able to do this without caves? Im going to make a server for the vs. deerclops alpha mod
Fish 15 Οκτ 2017, 23:39 
Thank you very much!
Ooga Booga 22 Ιουν 2017, 6:11 
Now i have my own dedicated server.But,I can only browse my server and i can't manage my server.For example,I can't find my server on host.