Noise & Peaks Guide?
Noise & Peaks Guide?
Hi, i would like to get into making a mod for factorio and was wondering if anyone could give an explanation of how the ore generation code works. I have been looking at the code for a few mods to see if I can make sense of it but I don't quite get what all the variables are doing to affect the generation. I would like to be able to make some ore spawn outside the spawn area and I would like to be able to make some deposits really small etc.
-
- Fast Inserter
- Posts: 204
- Joined: Tue Feb 25, 2014 7:22 am
- Contact:
Re: Noise & Peaks Guide?
I would like to second that, because I would love to tune some resources to my needs (mainly stone, dytech uses so much of it), but I don't want to do it the wrong way around.
Re: Noise & Peaks Guide?
Looks like I'll just have to have a stab in the dark with some trial and error. Maybe I'll write a little test mod and post it up with a load of commented code on my findings.
Re: Noise & Peaks Guide?
Ill look forward to reading up on your findings when your done.PsudoSage wrote:Looks like I'll just have to have a stab in the dark with some trial and error. Maybe I'll write a little test mod and post it up with a load of commented code on my findings.
Re: Noise & Peaks Guide?
Factorio wiki-> auto place
Re: Noise & Peaks Guide?
https://forums.factorio.com/wiki/inde ... aceControlficolas wrote:Factorio wiki-> auto place
https://forums.factorio.com/wiki/inde ... on#control
Re: Noise & Peaks Guide?
this are my findings from a while back (2 months or so)
some things might be wrong, but i guess most is accurate
note: the random values are no longer working correctly. and this is from factorio 0.8, so things have been added since
Edit: extended it a bit.
some things might be wrong, but i guess most is accurate
note: the random values are no longer working correctly. and this is from factorio 0.8, so things have been added since
Code: Select all
autoplace =
{
control = "sand", -- this is the control group. You need to add it also to autoplace-controls.lua. The generator (when starting a new map) has then the richness, size and frequenty options.
sharpness = 0.8, -- this value corrisponds to the clutterness of a deposit. Meaning at 1 they will be like iron or copper ores spots. 0 is everywhere. 0.8 here shows a normal ore spot, but a bit more spaced apart
richness_multiplier = math.random(75000), -- this give the multiplier a random number between 0 and 75000 (means richness_base * multiplier * richness setting (setting richness to very rich gives it a 2x or 3x bonus i believe (based on my observations)
richness_base = math.random(5000,15000), -- this gives a number between 5000 and 15000. This is the base value of a deposit, and the rest is calculated above (at multiplier) and below (at the influences)
peaks = {
{ -- this first peak is special. this is not added normally to the game. The way it works is as follows:
influence = 0, -- this does nothing. but if set to a nonzero value, it would change drastically (a shitload of ore well appear in the world, and we dont want that to happen :P)
richness_influence = 1.2, -- this is the changeling. this makes sure that no single tile of resource is the same. that works simple, like this (noise value) * richness_influence * richness_multiplier = the size of deposit. the noise value is a random value between -1,5 and 1,5 with a prefered likeness of around 0
noise_layer = "random" -- this is a surrogate layer. it does not correspond with any resource, thus rendering its layer useless. but it needs to be added, otherwise it gives and error
},
{ --for the rest, i dont know the exact formulas for calculating, but i know what they do.
influence = 0.21, -- these things are really tricky. changing them by even 0.01 is enough to spawn 5000 more tiles in only 50 chunks!
starting_area_weight_optimal = 0, -- these 3 things are the starting area influences. they specify the range and weigth of the resource in the starting area. it thus corresponds to how many resources there will be in your starting area
starting_area_weight_range = 0, -- the starting range of the starting area
starting_area_weight_max_range = 2, -- the maximum allowed size of the starting area. Making this higher, means more ore in your starting area, and a larger radius in which they spawn
},
{
influence = 0.3, -- same as above
starting_area_weight_optimal = 1,
starting_area_weight_range = 0,
starting_area_weight_max_range = 2,
},
{
influence = 0.65,
noise_layer = "sand", -- this checks for sand in the vicinity. if it found some, it adds 0.4 to each multiplier the further away they are. but very close, they remove 1.9 multiplier for each tile.
noise_octaves_difference = -1.9,
noise_persistence = 0.4,
starting_area_weight_optimal = 0,
starting_area_weight_range = 0,
starting_area_weight_max_range = 2,
},
{
influence = 0.55,
noise_layer = "sand",
noise_octaves_difference = -2.3, --same as above
noise_persistence = 0.4,
starting_area_weight_optimal = 1,
starting_area_weight_range = 0,
starting_area_weight_max_range = 2,
},
{
influence = -0.2,
max_influence = 0, --i havent quite found out what this does xD
noise_layer = "iron-ore", -- this works the same as above, but checks for iron instead of sand
noise_octaves_difference = -2.3,
noise_persistence = 0.45,
},
{
influence = -0.2,
max_influence = 0,
noise_layer = "copper-ore", -- this works the same as above, but checks for copper instead of sand
noise_octaves_difference = -2.3,
noise_persistence = 0.45,
},
{
influence = -0.2,
max_influence = 0,
noise_layer = "coal", -- this works the same as above, but checks for coal instead of sand
noise_octaves_difference = -2.3,
noise_persistence = 0.45,
},
{
influence = -0.2,
max_influence = 0,
noise_layer = "stone", -- this works the same as above, but checks for stone instead of sand
noise_octaves_difference = -3,
noise_persistence = 0.45,
},
},
},
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
Re: Noise & Peaks Guide?
Thanks for the help guys, I have been having a tinker with this all night. I think I have loosely figured it out, I cant stress loosely enough though. It seems the peaks are all combined to create one final result, which is not what I thought at first. The first peak that's completely random seems to be either a raw map seed or a blank noise layer, then the next peaks adds the specific noise layers for the resource. The last ones stop overlapping by reducing influence where it finds other resources.
I'll write a quick summary of my guesswork using the default copper peaks, corrections & confirmations are welcome as this is still very confusing and I might be completely wrong.
Default Copper Ore:
First Peak (Random Or Empty)
Second Peak: (Main copper generation)
Third Peak: (Starting area boost)
Fourth Peak: (Starting area increasing boost)
Fifth peak (Avoid Iron):
I'll write a quick summary of my guesswork using the default copper peaks, corrections & confirmations are welcome as this is still very confusing and I might be completely wrong.
Default Copper Ore:
First Peak (Random Or Empty)
Code: Select all
influence = 0.2, -- 0.2 of an empty layer would mean the map would be 20% filled with 'noise'.
starting_area_weight_optimal = 0,
starting_area_weight_range = 0,
starting_area_weight_max_range = 2,
Code: Select all
influence = 0.65,
noise_layer = "copper-ore",
noise_octaves_difference = -1.9, -- Increase copper generation the further from start
noise_persistence = 0.3, -- Increase by this much
starting_area_weight_optimal = 0, -- No starting bonus
starting_area_weight_range = 0,
starting_area_weight_max_range = 2,
Code: Select all
influence = 0.3, -- Small amount of influence
starting_area_weight_optimal = 1, -- Affects starting area only
starting_area_weight_range = 0,
starting_area_weight_max_range = 2,
Code: Select all
influence = 0.55,
noise_layer = "copper-ore",
noise_octaves_difference = -2.3, -- Increased ores towards the outer edge of the starting area
noise_persistence = 0.4,
starting_area_weight_optimal = 1, -- Another starting area only
starting_area_weight_range = 0,
starting_area_weight_max_range = 2,
Code: Select all
influence = -0.2, -- Negative influence reduces value near iron
max_influence = 0, -- Max of 0 stops copper from generating on iron
noise_layer = "iron-ore", -- Noise layer determines what to avoid
noise_octaves_difference = -2.3, -- Increased effect further from start to match irons own increase
noise_persistence = 0.45,
Re: Noise & Peaks Guide?
I found some other useful tags that may be used for rare ore generation too inside the biter spawner peaks:
Code: Select all
influence = 0.5,
noise_layer = "enemy-base",
noise_octaves_difference = -1.8,
noise_persistence = 0.5,
tier_from_start_optimal = 20, -- These 3 properties are used to keep enemy bases from spawning inside the starting area, could be useful for rare ores (diamonds, gold etc)
tier_from_start_top_property_limit = 20,
tier_from_start_max_range = 40,
-
- Fast Inserter
- Posts: 204
- Joined: Tue Feb 25, 2014 7:22 am
- Contact:
Re: Noise & Peaks Guide?
Nice, so you can make it as if the bitters settled on specific resources by forcing them to spawn near enemy bases.
This opens up decent potential in setting more lore about those bitters, by making them spawn near specific resources, as if they needed it to live.
This opens up decent potential in setting more lore about those bitters, by making them spawn near specific resources, as if they needed it to live.
Re: Noise & Peaks Guide?
I think that is a possibility, you could either make an ore use the same noise layer as the biters, or have another noise layer thats just influenced by the biter noise layer like the opposite of the 'iron avoid' peak above. Just with increased influence instead of reduced.
Re: Noise & Peaks Guide?
If ypu are going to release a mod with custom ores, make sure tou check out other mods that bring ores. (dyTech and Fmod)
I suggest to use the same internal names to make them compatible with each other
I suggest to use the same internal names to make them compatible with each other
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
Re: Noise & Peaks Guide?
If they have the same name across different mods are they automatically compatible (Like minecrafts ore dictionary) or will compatibility need to be added by each mod through an interface?
I was thinking of making a resource pack mod that contains just resources and associated items then using that mod as a base for any other mods I feel like tinkering with.
I was thinking of making a resource pack mod that contains just resources and associated items then using that mod as a base for any other mods I feel like tinkering with.
Re: Noise & Peaks Guide?
If there internal names are the same, they are automaticly compatible. A good example is that fmod has molten-iron, and so does v2 of dytech, making it compatible with recipes of fmod and dytech. (Only recipes from fmod will disable, but that is intentional)
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
-
- Fast Inserter
- Posts: 204
- Joined: Tue Feb 25, 2014 7:22 am
- Contact:
Re: Noise & Peaks Guide?
What's great about factorio's way of adding items/recipes is that it is all based on the internal name.
You can make a "gold-ore" resource, and only add recipe to smelt it to "gold-plate", and it will happily also use the "gold-ore" generated by f-mod (underground mining only, no surface resource), as well as use your ore to melt it to its "molten-gold".
There are only a few thing to consider, which is that any prototype with the same internal name will overwrite any previous declaration.
For items, it means mostly the icon and where it's placed by the auto-sort in the inventory, but it could change quite a bit for recipes, depending on which mod loads last.
Anyway, it means that if you take a bit of time to check the other mods first, you might be able to make yours so that it complements it by using the same internal names (or even require them and use their resources instead in your recipes, up to you).
You can make a "gold-ore" resource, and only add recipe to smelt it to "gold-plate", and it will happily also use the "gold-ore" generated by f-mod (underground mining only, no surface resource), as well as use your ore to melt it to its "molten-gold".
There are only a few thing to consider, which is that any prototype with the same internal name will overwrite any previous declaration.
For items, it means mostly the icon and where it's placed by the auto-sort in the inventory, but it could change quite a bit for recipes, depending on which mod loads last.
Anyway, it means that if you take a bit of time to check the other mods first, you might be able to make yours so that it complements it by using the same internal names (or even require them and use their resources instead in your recipes, up to you).
Re: Noise & Peaks Guide?
I'm going to follow the base mods coding standards as much as possible in terms of naming things. I have had a quick look at fmod and dytechs names and so far the stuff I have set up is already compatible, the only issue I see is a slight change in my gem names so no probs.
Looks like it will be pretty cool for modding resources in then with good compatibility features.
Looks like it will be pretty cool for modding resources in then with good compatibility features.
Re: Noise & Peaks Guide?
If you release it, ill take a look and we can work something out for compatibility to my new metallurgy systemPsudoSage wrote:I'm going to follow the base mods coding standards as much as possible in terms of naming things. I have had a quick look at fmod and dytechs names and so far the stuff I have set up is already compatible, the only issue I see is a slight change in my gem names so no probs.
Looks like it will be pretty cool for modding resources in then with good compatibility features.
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
Re: Noise & Peaks Guide?
Sounds good. I'll do that.Dysoch wrote:If you release it, ill take a look and we can work something out for compatibility to my new metallurgy system
I have managed to make dual ore generation work.. kinda. I made a galena style deposit with silver and lead combined. I'm gonna try some noise layer tricks tomorrow to see if I can improve it because I want to do this for gems too and I think it will need slightly more advanced control to handle like 5 or 4 ores at once.
Re: Noise & Peaks Guide?
Looks goodPsudoSage wrote:Sounds good. I'll do that.Dysoch wrote:If you release it, ill take a look and we can work something out for compatibility to my new metallurgy system
I have managed to make dual ore generation work.. kinda. I made a galena style deposit with silver and lead combined. I'm gonna try some noise layer tricks tomorrow to see if I can improve it because I want to do this for gems too and I think it will need slightly more advanced control to handle like 5 or 4 ores at once.
But my advise, try with all mods that add ores, and see how the world looks we dont want a floor of only ores
And since silver and lead isnt used quite as much, try to makr the deposits a bit smaller
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
-
- Fast Inserter
- Posts: 204
- Joined: Tue Feb 25, 2014 7:22 am
- Contact:
Re: Noise & Peaks Guide?
Still talking about noise layers, is it possible to state layers that might not exist (like dytech's gems or sand)?
If so, what is the actual effect if that layer is not used (because that mod might not be installed), and how to get around the problem if there is one?
I mean that if we can take compatibility into account right from the start, it might make thing easier in the long run.
If so, what is the actual effect if that layer is not used (because that mod might not be installed), and how to get around the problem if there is one?
I mean that if we can take compatibility into account right from the start, it might make thing easier in the long run.