# Don't Starve Together modding

Don't Starve Together mods use Lua and distinguish **client** changes from **server/world** changes. Klei's [modding policy and overview](https://support.klei.com/hc/en-us/articles/360029555992-Modding-Don-t-Starve-and-Don-t-Starve-Together) confirms that mods can add characters, items, creature behavior, world-generation rules and UI. Those features have different loading and multiplayer consequences, so start with a single visible change in a disposable world.

> **Quick start:** create a local mod folder with `modinfo.lua` and `modmain.lua`, enable it in the game's Mods screen, enter a test world, and confirm that a small change appears. Only then add prefabs, assets or server requirements.

## Make a discoverable package

The Klei-hosted [modding introduction](https://kleiforums.com/forums/topic/50773-guide-modding-practices-introduction-to-modding/) describes `modinfo.lua` as the metadata file and `modmain.lua` as a principal entry point. Use a distinctive folder name under the installed game's mods directory and keep the project separate from Steam Workshop's downloaded copies. Metadata includes a name, description, author, version and compatibility flags. Compare a current, simple mod with the current game build before copying numeric API values from an old forum post.

Do not publish a project that only happens to work on the author's machine. Klei's [guidelines](https://support.klei.com/hc/en-us/articles/360029555992-Modding-Don-t-Starve-and-Don-t-Starve-Together) ask for a working description and permission for any non-original assets. Use your own art or clearly licensed material.

## Choose client or server scope

A **client mod** changes that player's interface or presentation. A **server mod** changes shared world behavior and must load for the world. Metadata controls whether clients must install it; that decision affects joining and dedicated servers. Test the mod in a local hosted world first, then in a dedicated server with a second client if you claim multiplayer support. A change seen only by the host is not automatically synchronized.

The [Klei modding forums](https://forums.kleientertainment.com/forums/forum/79-dont-starve-together-mods-and-tools/) and the community-maintained [DST Lua reference](https://vietnd69.github.io/dst-api-webdocs/docs/getting-started) describe common hooks for prefabs and components. Treat community API pages as version-sensitive: inspect the currently installed game scripts when using a hook, prefab name or tuning value. A hook that runs before its target is available may appear to do nothing.

## Extend one existing behavior

For the first gameplay change, choose a known existing prefab and add one small post-initialization adjustment. Verify the prefab's name in the installed scripts before hardcoding it. Put the hook in `modmain.lua`, print a startup marker, enable the mod, and spawn or encounter that prefab in a fresh test world. Observe both the original behavior and your intended difference. If there is an error, remove the hook and verify that the empty mod still loads; then check the exact callback and component state.

For a new item or creature, the work expands to a prefab file, asset registration, crafting or spawn access, strings, and possibly server/client networking. The community [getting-started reference](https://vietnd69.github.io/dst-api-webdocs/docs/getting-started) explains how `PrefabFiles` points to prefab scripts. Keep namespaced file and prefab names, and test clients that have not cached your artwork.

## Test and release

Test enable, world creation, save/reload, multiplayer join, and removal from a throwaway world. Check the game's log after each failure and disable only your mod to isolate conflicts. Document server/client requirements and any game version used. For Steam Workshop, publish only after the mod works with a clean installation and Klei's [content guidelines](https://support.klei.com/hc/en-us/articles/360029555992-Modding-Don-t-Starve-and-Don-t-Starve-Together) are met.

This guide is **unfinished**: it describes the package and safe test path but does not yet supply a current-version, fully tested new prefab or character. Those need game-build-specific scripts and assets.
