Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Advanced World Gen Science -- Mesh sizes, weighted ranges and variances  (Read 5200 times)


  • Bay Watcher
    • View Profile

Hello everybody,

I was recently creating worlds with advanced parameters, and noticed that the information about mesh sizes didn't seem to fit. Well, one thing led to another, I was taken by a fey mood and did some science with weighted ranges and variances. The result is this piece of work.

Now, I really hope this isn't all common knowledge yet, but since the wiki says something else I assume it's not. Given the warning that I don't consider myself a good writer, I suspect many of you don't necessarily want to read through the whole thing so I'll paste the abstract and conclusion below. If you want to know exactly how I came to the conclusion you'll have to look at the report. I also uploaded most of the worlds I generated and my "lab journal" here.

Feel free to suggest improvements to my writing or whatever and ask questions if anything is unclear.

I'm not familiar with wiki editing of any sort, so I hope someone else will include the new information in the wiki.

Without further ado:

At the time of this writing the Dwarf Fortress wiki's information about mesh sizes and weighted ranges is false, or at least incomplete and misleading. In this work, I systematically try to find out exactly how weighted ranges work and how they interact with variances. For this purpose I created many different worlds where I changed single parameters and analysed the results. I describe the process of how I understand world generation with weighted ranges works and hope that other people can profit from this knowledge.

Conclusion (slightly edited):
The basic steps of world generation with weighted ranges are as follows:
  • Create a grid with 2^(MeshSize - 1) tiles in both X and Y direction.
  • Set the intersection points of the grid lines to a random value according to the parameters set with the weighted ranges.
  • Interpolate between the intersection points.
  • Add noise according to the variance parameters.
MeshSize is here the raw parameter value found in the world_gen.txt. Note that the highest possible value will always create grid tiles that are 8 * 8 world tiles large.

There are still several things that are unclear about how the noise is added but some things are quite certain:
  • Setting the variance too high means that the effect of the weighted ranges can be completely negated.
  • A larger mesh size means a larger variance is necessary to have a visible effect.
  • The variance's effect is constant across world sizes with the same mesh size. It is NOT dependent on the absolute number of world tiles between grid lines.
  • A larger mesh size seems to make the variance affect smaller areas overall. For elevation, this means that large oceans and mountain ranges (relative to map size) can only be created with smaller mesh sizes.

In conclusion, if you want to use weighted ranges effectively, you should always consider adjusting the corresponding variances. Especially low mesh sizes mean that variances should be set rather low (I'd personally recommend no higher than 500 for mesh size 2).

EDIT: I updated the wiki. Feel free to offer any suggestions for improvement.
« Last Edit: July 15, 2014, 10:18:30 am by JoeJoe »


  • Bay Watcher
    • View Profile

Quick addendum, because it fits with the topic but I don't feel like this warrants a separate thread. Also, I'm not sure if it's maybe a bug or if it should be included to the wiki at all:

When OROGRAPHIC_PRECIPITATION is turned on, not only elevations have an influence on rainfall, but drainage does as well.
I created a completely flat world with min and max rain set to 50 and OROGRAPHIC_PRECIPITATION turned on. Below are the drainage and rain maps.

Spoiler (click to show/hide)

As you can see, when the drainage values are higher than 50, patches of stronger and weaker rainfall are created, shifted a bit east. When OROGRAPHIC_PRECIPITATION is turned off rain is completely uniform across the entire map, as expected. I find this rather unintuitive, because I would expect that when there is more surface water, i.e. lower drainage values, more water will evaporate and come down somewhere else. Maybe someone with a better understanding of geography can clarify this?
« Last Edit: July 04, 2014, 05:58:35 am by JoeJoe »