keepcalculator

06 Numbers and Powers

DST Server Caves Setup Guide

Card No. 06·73985 · Updated · Standard formula, shown below

This guide walks you through enabling and configuring caves for a dedicated Don’t Starve Together (DST) server. You’ll learn how to generate a cave world, adjust its settings, and ensure your server runs both the surface and cave shards smoothly. You’ll need access to your server’s command line or file manager, and a basic understanding of DST server configuration files.

What You’ll Need

  • A dedicated DST server (Windows or Linux) with the base game files installed.
  • Server administration access (SSH, remote desktop, or a control panel).
  • Basic familiarity with editing text files (like settings.ini and worldgenoverride.lua).
  • Optional: A tool like WinSCP or a terminal editor (nano, vim) for file editing.

Step-by-Step

  1. Stop your server if it’s currently running. You’ll be modifying configuration files that are read at startup, so make sure the process is fully stopped.
  2. Locate your server’s configuration directory. This is usually the folder where your settings.ini and cluster.ini files are stored. On a typical Linux install, this is under ~/.klei/DoNotStarveTogether/ followed by your cluster name (e.g., MyDedicatedServer).
  3. Open cluster.ini in a text editor. This file controls the overall cluster settings. Look for the [SHARD] section. If it doesn’t exist, create it. Add or modify the following lines:
    [SHARD]
    shard_enabled = true
        

    This enables the shard system, which is required for caves.

  4. Create a new folder for the caves shard. Inside your cluster folder, create a directory named Caves. The name is case-sensitive on Linux. This is where the cave world data and configuration will live.
  5. Create the cave shard configuration. Inside the Caves folder, create a file named server.ini. Paste the following basic configuration:
    [NETWORK]
    server_port = 11000
    
    [SHARD]
    is_master = false
    name = Caves
    id = 1
    
    [ACCOUNT]
    encode_user_path = true
    
    [STEAM]
    master_server_port = 27018
    authentication_port = 8768
    
    [SETTINGS]
    intent = cooperative
        

    Note: The server_port and master_server_port must be different from the surface shard’s ports. The surface typically uses 10999 and 27017, so 11000 and 27018 are safe choices. If you have multiple caves (e.g., a second cave), increment these numbers.

  6. Create the cave world generation file. In the same Caves folder, create a file named worldgenoverride.lua. This file defines the cave world’s settings. A minimal example:
    return {
      override_enabled = true,
      presets = {
        "DST_CAVE",
      },
    }
        

    This uses the default cave preset. You can customize cave-specific options later, like cave_preview, start_location, or branching, by adding them under the worldgen table. For now, the preset is enough to get started.

  7. Set up the surface shard (if not already done). Your main world (the surface) should already have a server.ini in its own folder (e.g., Master). Ensure that in that file, the [SHARD] section has is_master = true and an id = 0. Also, make sure the server_port is set (e.g., 10999) and the master_server_port is set (e.g., 27017).
  8. Start your server. Launch your server as you normally would. The server will now attempt to start both shards. The first time you start, it will generate the cave world based on worldgenoverride.lua. This can take a few minutes.
  9. Verify caves are running. Check your server logs. You should see messages indicating that the Caves shard has started. In the game client, when you join the server, you’ll see a cave entrance (a large hole in the ground) that you can jump into to access the caves.

Common Mistakes

  • Forgetting to enable sharding in cluster.ini. If shard_enabled is missing or false, the server will only run the surface and ignore the Caves folder.
  • Using the same ports for both shards. This causes a conflict and the server will fail to start. Always use distinct port numbers for each shard.
  • Incorrect folder name. The cave shard folder must be named Caves (capital C) on Linux. A typo like caves will cause the server to not recognize it.
  • Missing worldgenoverride.lua. Without this file, the cave shard may generate a default world, but it’s better to be explicit. If the file is absent, the server might generate a cave with default settings, which is fine, but you lose control.
  • Not stopping the server before editing files. The server reads these files at startup. If you edit them while the server is running, changes won’t take effect until a restart, and you might accidentally overwrite your changes if the server writes to the same files.

Tips

  • Back up your world files before making major changes. Copy the entire cluster folder to a safe location. This saves you from a corrupted world.
  • Use a dedicated server tool like dontstarve_dedicated_server_nullrenderer on Linux or the Windows batch files to manage shard startup. They handle the shard boot order automatically.
  • Tune cave settings in worldgenoverride.lua to your liking. For example, you can set branching = "most" for more cave branches, or adjust cave_preview to control how much of the cave map is visible at start. Refer to the DST wiki for a full list of options.
  • Monitor memory usage. Caves add a significant amount of memory overhead. Ensure your server has enough RAM (at least 2GB for a small server with caves, more for larger groups).
  • Test with a small group first. Before opening to the public, join with a friend to make sure the cave entrance works and the world is stable.

Troubleshooting

  • Server won’t start after adding caves. Check the server logs for errors. Common issues include port conflicts (change the ports in server.ini), missing files (ensure worldgenoverride.lua exists), or incorrect folder permissions. Also verify that shard_enabled = true is in cluster.ini.
  • Caves are not generating. If the server starts but you don’t see a cave entrance, the Caves shard might have failed to start. Look for errors in the log that mention “Caves” or “shard”. Make sure the server.ini in the Caves folder has is_master = false and a unique id. Also, ensure the worldgenoverride.lua is valid Lua syntax.
  • Players get disconnected when entering caves. This usually indicates a network issue. Check that the cave shard’s ports are reachable from the client. If you’re using a firewall, open the TCP and UDP ports you assigned (e.g., 11000 and 27018). Also, ensure encode_user_path = true is set in the cave’s server.ini.
  • Cave world is too small or too big. Adjust the world size in worldgenoverride.lua by adding a world_size parameter. For example, world_size = "medium" or "large". You’ll need to regenerate the cave world (delete the Caves folder’s save data) to apply changes.
  • Mods not working in caves. If you use mods, they need to be enabled on both shards. Check that the modoverrides.lua file is present in the Caves folder, or add the same mods to the cave’s server.ini under [MODS] section. Some mods are not cave-compatible; check the mod’s description.

Frequently Asked Questions

Do I need a separate server for caves?

No, the same server process can run both the surface and caves as separate shards. You just need to configure them properly as described above.

Can I add caves to an existing world without losing progress?

Yes, you can enable caves on an existing cluster. The surface world will remain intact, and the cave world will be generated fresh when you start the server with the new configuration. Your surface progress is preserved.

What are the default ports for DST shards?

The surface shard typically uses server_port = 10999 and master_server_port = 27017. The first cave shard should use server_port = 11000 and master_server_port = 27018. If you add a second cave, increment to 11001 and 27019, and so on.

How do I change cave world settings after generation?

You can edit worldgenoverride.lua in the Caves folder, but changes only apply to a newly generated world. To regenerate, delete the save folder inside the Caves directory (be careful—this erases all cave progress). Alternatively, you can use the in-game console to change some settings on the fly, but that’s more advanced.

Why does my server use more RAM with caves enabled?

Caves are a separate world that runs simultaneously, doubling the world simulation. This requires more memory and CPU. Ensure your server has enough resources; 2GB RAM is a minimum for a small group, but 4GB is safer.

Can I run multiple caves (e.g., two cave levels)?

Yes, DST supports multiple cave shards. You would create additional folders (e.g., Caves2) with their own server.ini and worldgenoverride.lua, and assign unique IDs and ports. However, the game client only supports one cave level per server, so additional caves are not accessible in standard gameplay. This feature is mainly for modding or experimental setups.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →