I'm currently working on a mod that adds some "biomes" to the world generation. Now I know that there are no real biomes in Factorio but noise-layers instead. However, what I do not understand is how moisture and temperature are involved.
I did quite some research in the API and on the wiki, but couldn't quite figure out how it works. So, first off I want to present you what I think I do understand (correct me here, if I'm wrong):
- Every terrain type has how noise layer. This is effectively a randomly generated (?) 2D-function with the coordinates on the map as input and a value as output. As drawing 2D is hard, I drew what I expect to be a 1D noise-layer (don't hate muh paint skillz):
- With multiple terrain types come multiple noise-layers:
- For each coordinate, the terrain with the highest noise-layer-value is picked and generated:
- There are noise-layers defined in core\prototypes for moisture and temperature (also for some other things, such as elevation).
- This line of code sets some range for a given terrain type in the tiles.lua:
Code: Select all
autoplace = autoplace_settings("grass", {{{35, 0.8}, {0, 0.4}}}),
- In autoplace_utils these values are explained as
Code: Select all
-- Rectangles is a table of rectangle specifications: -- {{max_temp, max_water}, {min_temp, min_water}, influence} -- temperatures range from 35 to -25 (°C), water from 0 to 1. -- Influence is optional and has default value of default_influence or 1.
- On the wiki I found this page: https://wiki.factorio.com/index.php?tit ... laceSheets. I am not sure how up-to-date this is, but it strangely contains biomes and snow tiles, wich I've never heard of (and couldn't find in the game files)
- I created some "snow" tiles (with dummy textures) that had autoplace_settings according to this picture:
I quickly created a few sandbox games and used the chart command to reveal large areas of the map, but i didn't encounter any of the new tiles. I did this 4 times and revealed from -2500 to 2500. I might have been extremely unlucky, but i highly doubt that. To check that i didn't mess up some coding I did the same thing, but changed the rectangle to -25,0 : 35,1 and I had lots of red dummy textures everywhere.
- How does moisture and temperature affect wich tiles are picked? I assume there is a generated moisture and temperature value for each tile on the map and if a type of terrain does not fit into these ranges it's noise-layer will be ignored? However, if that is true I do not understand how multiple terrains with different moistur/temperature requirements can share the same noise-layer.
- Are all temperature and moisture values equally possible, or are extreme temperatures really unlikely? That could explain why I could not find any snow.
- A lot of ranges are not covered by any terrain type. If you look at the picture above, what terrain is generated at a moisture of .8 and a temperature of -10°?
Thanks for reading all of this, I hope your answers will also be helpful to other modders, not just to me.
---
On a side note: I found a deprecated decleration in base\prototypes\entity\demo-trees.lua. In line 2 local biomes is declared as autoplace_utils.biomes. This however does not exist and is therefor nil. local biomes is never called. Should I do a bug report about it, or is this enough?