Jump to content

A few questions about the nature of worldgen


Recommended Posts

I have a few questions about the nature of worldgen in Don't Starve. I could probably find out the answers on my own, through thorough investigation of the code, but it seems much easier and more efficient to ask if anyone already knows.

 

First off, is the worldgen seed based? That is to say, is there a specific, random number that is generated at the start of the world, which causes the world to generate in a specific way? Or is it just generated by repeatedly generating random numbers?

 

Secondly, and this one is a little odd, is the entirety of the data for a world simply as follows?

  • The player's position, inventory, components, etc.
  • The same of all other prefabs in the world
  • The turf grid
  • The Season/Weather Manager

Or is there something else?

 

Finally, as I haven't done any work with worldgen yet, can someone give me a rundown? Or point me towards a good tutorial?

Link to comment
Share on other sites

Yes, the world is based on a single seed. You can find the seed in the meta savedata I think. There's a tool called the seed injector, though several people report awkward useage.

 

As for a rundown on worldgen...

 

A Voronoi-diagram[1] is a special mathematical construct based on points. Those points are (pseudo-)randomly scattered across a surface (or theoretically any x-dimensional space). Next every position on that surface is assigned to a region, which is the region of the nearest point. As a result, you get an interesting map of various shapes.

 

Seems familiar? Good, because the Don't Starve worldgen shapes the landscape in that manner, using previously calculated points. How did those points get calculated? How does the game know what region has what turf and prefabs?

 

Worldgen goes through several steps of detail when determining the exact layout of the voronoi points. Here are the most important words and their essential meanings:

  1. The uppermost thing there is is called the level. Each cave is its own level. So is every adventure mode world.
  2. The branches of the island are called the tasks. Every task holds progression information (in order to generate things somewhat controllable) and a set of rooms it contains, though in no paticular order.
  3. Wait what progression info you ask? There's so called keys and locks that limit task placement. Every task can have unlimited keys and locks. Every key a task has will be enabled when that task got placed. Locks need at least one of a set of specific keys before they open. Once all locks of a task are opened, the task can be placed as well.
  4. Wait what is a room you ask? Rooms are the individual biomes, if you will. For instance, the pig kingdom is its own room, surrounded by a few forest rooms.
  5. There's also so-called blocker-rooms that will always spawn at the beginning of a task. Technically, those don't even need to block. They're just typically used for such.
  6. Surely you've heard of setpieces before. Those are static layouts of turfs and prefabs scattered across the world. Again, tasks can be used to control where they possibly spawn.

So how does that look like on the field? I recommend you try to tweak some things in order to find that out!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...