You are on page 1of 1

Creature Mod Tutorial 8 - "World Spawning"

In this tutorial we're going to learn how to spawn our creatures as part of the
game's procedural world generation. Worlds in 'Don't Starve' are generated from a
list of tasks, each of which adds different things to the world such as trees,
creatures, items etc. Since we really only want to add our creature to the list,
we're going to create what's called a room, fill it with one of our creatures and
ask one of the tasks to include this room in it's generation. Let's get started!

* Step 1 - Hooking into World Generation.


For our mod to hook into world generation, we need to create a new file
called 'modworldgenmain.lua'. Anything found in this file happens before our world
is generated which allows us to customize how the world is built. This file lives
in the same folder as 'modmain.lua'.

* Step 2 - Creating a New Room.


A room is a way to define what gets spawned as part of world generation. Our
room is going to contain just one of our creatures. You can see how to create a
room at the top of 'modworldgenmain.lua'.

* Step 3 - Adding our Room to World Generation.


To add our room to the world generation, we will add it to the list of room
choices for a given world generation task. For this tutorial, we'll hook our room
into the "Forest Hunters" task which is a task that gets run for every survival
world that gets generated. We do this at the bottom of 'modworldgenmain.lua'.

And that's it! Our brand new creature now gets spawned across the world and his
location is even saved along with your save file!

You might also like