[MOD 0.15.x] Pretty Fair Resources

Topics and discussion about specific mods
danbliss123
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 16, 2016 5:10 am
Contact:

[MOD 0.15.x] Pretty Fair Resources

Post by danbliss123 »

Description:
Modifies the resource generation to fit a wider variety of playstyles without changing game balance. This mod makes resource patches much larger and less frequent as you go further from the origin. This is balanced to produce the same average amount of resources per land area as vanilla resource generation. This way, expanding in the late game does not require tediously mining out patch after patch.

Key Features:
* Requires no configuration out of the box - it comes prebalanced to produce an experience similar to vanilla in the early game. (even for modded resources)
* Can be configured through the normal map generation settings, just like vanilla map generation.
* Comes with long range scanners to help find ores once you get to the mid or late game.
* Can be turned on or off on a per-map basis.
* Can be applied to an existing map. There is a command you can type to regenerate all resources on the map with PFR.

Details:
Factorio Version: 0.15
Released: Aug 7 2017
Dependencies: None
Website: None
Mod: https://mods.factorio.com/mods/danbliss ... rresources
BitBucket: https://bitbucket.org/danbliss123/factorio-mods
License: https://opensource.org/licenses/MIT
Example Maps
Long Description
Details
FAQ
Last edited by danbliss123 on Fri Aug 11, 2017 1:57 pm, edited 7 times in total.
LarkinOmega
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Aug 04, 2016 1:02 pm
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by LarkinOmega »

Very nice generation mod, a good compromise from vanilla and RSO.

A couple of Requests though:

1) Is it possible to include the customization settings in the Mod Settings in the game itself? It would be more approachable for the "average" user, rather than text editing the mod files itself.

2) PFR generates Dirty Ores from Reika's DirtyMining and it really shouldn't. It appears to generate them in addition to the regular ores.
danbliss123
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 16, 2016 5:10 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by danbliss123 »

Thanks!

1 You can use the normal frequency, size and richness settings to customize your map generation in PFR just like you would in vanilla.
[EDIT] Made this clearer in the description.

2 I will look into that mod.
[EDIT] Reika's DirtyMining does that on vanilla too. If that is not intended, it needs to be fixed in that mod. (I uninstalled PFR and all other mods except Reika's DirtyMining, and it still generated dirty ore patches)
Last edited by danbliss123 on Wed Aug 09, 2017 11:10 pm, edited 2 times in total.
danbliss123
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 16, 2016 5:10 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by danbliss123 »

I will be improving the settings for distribution characteristics for modded resources. Primarily I will be making the mathematics clearer, and providing the ability to exclude a resource from the starting area. If anybody has any special requests let me know.
I am referring specifically to the way a mod can specify to PFR how its resources should be generated (probably no mods do this yet, I am just soliciting comments).
LarkinOmega
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Aug 04, 2016 1:02 pm
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by LarkinOmega »

danbliss123 wrote:Thanks!

1 You can use the normal frequency, size and richness settings to customize your map generation in PFR just like you would in vanilla.
[EDIT] Made this clearer in the description.
I understood that completely, and it works well. I was referring to the further control in your FAQ. Exposing those controls in game would be very nice.

Mainly asked this so it wouldn't be a one line post :-D
danbliss123 wrote:2 I will look into that mod.
[EDIT] Reika's DirtyMining does that on vanilla too. If that is not intended, it needs to be fixed in that mod. (I uninstalled PFR and all other mods except Reika's DirtyMining, and it still generated dirty ore patches)
I was unaware of that, I hadn't actually played with the mod yet. I'll see about contacting Reika then.
danbliss123
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 16, 2016 5:10 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by danbliss123 »

LarkinOmega wrote: I understood that completely, and it works well. I was referring to the further control in your FAQ. Exposing those controls in game would be very nice.

Mainly asked this so it wouldn't be a one line post :-D
I will leave that level of control as text editing for now. I may try to get something more complicated set up in the future. In the meantime, the mapgen settings should be more than enough for most people (you can get up to an 8x increase or 8x decrease by combining size and richness)
LarkinOmega
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Aug 04, 2016 1:02 pm
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by LarkinOmega »

https://github.com/ReikaKalseki/Reika_F ... 1200263289

Reika does not generate ores apparently. :?
danbliss123
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 16, 2016 5:10 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by danbliss123 »

Have you tried installing Reika's DirtyMining without PFR, and generating a map? Try it and you will observe that patches of dirty ore are generated, in addition to regular ore. It takes 5 minutes.
Screenshot
danbliss123
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 16, 2016 5:10 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by danbliss123 »

Explanation of the mathematics of resource generation. Also, a request for comment on upcoming tweaks.
One of the things I find annoying about the vanilla generation is its lack of well defined parameters. You specify things like noise layers and distance bonuses, but it is unclear exactly what these mean, and they do not have units. Basically, they are arcane. I want to provide a resource specification system that lets modders specify exactly how they want their resource to be generated, in universally understandable mathematical terms. Here is what I think the concepts are:
  • Resource Density: average amount of resources per land area
  • Patch Density: average number of patches per land area
  • Patch Size: the width of a particular patch
None of these need to be constant throughout a map.
Resource Density
Resource Density should be a function of distance from the origin.

Code: Select all

ResourceDensity = f(d)
I think that the best mathematics for this would be a hyperbola of this form:

Code: Select all

ResourceDensity = sqrt( A^2 * d^2 + B^2 )
Where d is distance from the origin, A is the slope of the asymptote, and B is the value at the origin. This also allows you to make it constant by setting A to 0. Both vanilla and PFR currently allow you to do something like this, though the units are not really made clear, and there are more variables than necessary in vanilla, with some unclear implications.

If you want to exclude a resource from the starting area, I recommend a simple exclusion approach:

Code: Select all

ResourceDensity = sqrt( A^2 * d^2 + B^2 )  {for d>=R}
ResourceDensity = 0  {for d<R}
Where R is the minimum radius.
Patch Density
Patch Density is more complex. In general I think it should fall off according to 1/d^2. This is what the mod currently uses, and it means that when you double the size of the map, you get a constant number of additional patches. See the example maps for this mod to see what this looks like in practice.

The big question I have about this is: what would people want when they set "frequency" to low or high in this mod? In vanilla, where patch density is constant, it is pretty clear. It means you want more or fewer patches, and it applies equally across the entire map. In PFR, however, patch density decreases with distance. What is the appropriate use of frequency in this situation?

I think that for the part of the map close to the origin, frequency should affect patch density directly. Low frequency, low patch density, high frequency, high patch density. That seems clear. Where it gets complicated is farther out. At great distances, I think PFR already uses pretty much the lowest acceptable PatchDensity. Maybe low frequency should not change patch density at great distance from the origin, but high frequency should increase patch density at great distance from the origin.

Anyways, I am currently thinking of tweaking this.
Patch Size
I think this should be a function of patch amount. So, a patch with more resources is larger. This has no impact on how many resources there are or how many patches there are, just on how concentrated or spread out a single patch is. I am currently using this function:

Code: Select all

PatchSize = cuberoot( a/1000000 ) * S
Where a is the patch amount and S is the size of a 1 million amount patch.

I think this works well and causes patches to get both larger and richer pretty evenly.
Summary
Things that a mod can specify about a resource in the next version of PFR:
  • Starting area resource density. (B from ResourceDensity formula - Units of Resources/Area)
  • Resource density bonus per distance. (A from ResourceDensity formual - Units of Resources/Area/Distance)
  • Resource minimum radius. (R from ResourceDensity formula - Units of Distance)
  • [One or several values to specify PatchDensity - still working on mathematics]
  • Size of 1 million amount patch (S from PatchSize - Units of Distance)
Also, for area units I am planning on using Chunks (32x32 tiles), and for distance units I am planning on using tile widths.

Thoughts?
kevink8
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Oct 19, 2017 5:15 pm
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by kevink8 »

Hey danbliss123, i tried using your mod on the scenarios PVP mode and it doesn't seem to work, do you have any idea why? Is this on purpose or?
When I do Scenarios > Sandbox it works fine, same goes for a normal game.
danbliss123
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 16, 2016 5:10 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by danbliss123 »

I do not. It is not on purpose. I have not done PvP before. I will look into it.

Does PvP clone the starting area for each team? Because I can see how that might be a problem. Honestly this mod might not be a good choice for PvP in general. It could heavily advantage someone if the ended up next to a large valuable patch.

Does PFR prevent you from doing PvP at all, or just not behave right when it is turned on?
kevink8
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Oct 19, 2017 5:15 pm
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by kevink8 »

Hey thanks for your response,

I can start a PvP game just fine with it enabled it just doesn't seem to do anything.
Also the starting option can be cloned but it is an option, I only did PvP with some friends because we wanted seperate research and bases.

I tried RSO, which works fine, but I don't like it that much, I prefer PFR
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2171
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by Ranakastrasz »

This is what I've been looking for since I first tried to use Resource Spawner Overhaul.
The massive Deposits make trains worthwhile, but the lack of small deposits is a pain.
This is literally exactly what I was looking for.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
danbliss123
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 16, 2016 5:10 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by danbliss123 »

Yay! Thank you.
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2171
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by Ranakastrasz »

Resource spawner Overhaul, the first time I tried it, was great. Back then, it actually scattered tiny ore deposits, like 4-10 tiles, around the map, and had massive deposits as it does now. Those small deposits let you avoid full starvation until you found a large deposit.

However, it kept those through the whole map, and you generally just ignored those once you found a proper deposit, so I can see why it was removed and the current dev claimed it was a bug when I asked why it was removed.

This mod however, starts out with small deposits, and they get larger and further apart as you go further out. It scales with gameplay, and overall is just awesome. Planning to start a new game with this as soon as I finish building my modpack.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
danbliss123
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 16, 2016 5:10 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by danbliss123 »

I updated PFR to support PVP. Try the latest version. You can apply it to an existing PVP map by running /pfr_regen if you want.

The problem was that PFR used to only use the starting surface. PVP takes place on a scenario-specific surface. PFR is now surface-aware and will operate on all surfaces.
See the changelog in the mod's zip file for details.

Thanks for all of the feedback, everybody!
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by eradicator »

danbliss123 wrote:PFR is now surface-aware and will operate on all surfaces.
Hi. Haven't used your mod extensively yet so just making sure...if you say "all surfaces" does this affect things like the inside of factorissimo factories? Some surfaces do not have resources as such. I'm not sure if you're basing your new generation off the current map-gen settings (or if factorissimo sets those map-gen settings correctly when creating surfaces :P). So...just a general thought basically.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
danbliss123
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 16, 2016 5:10 am
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by danbliss123 »

It does use the map gen settings, which are surface-specific. I have not tried factorissimo though. If anyone has trouble getting PFR to play nice with that or another mod, let me know.
aklesey1
Smart Inserter
Smart Inserter
Posts: 1862
Joined: Sun May 18, 2014 3:45 pm
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by aklesey1 »

Works very bad with angel's fissures - they just spawn in huge numbers and are superimposed on each other at one point, take a look, that will blow your mind, danbliss123
Nickname on ModPortal - Naron79
MatthewGP
Inserter
Inserter
Posts: 26
Joined: Thu Mar 24, 2016 10:11 pm
Contact:

Re: [MOD 0.15.x] Pretty Fair Resources

Post by MatthewGP »

@aklesey1

You could try unzipping the mod and editing the resourceCustomization.lua file as follows:

Code: Select all

-- This file is for manually tweaking the resource generation in PFR.
-- Add the resources you want to tweak to the PresetResources object.

-- PresetResources is a dictionary of resource name to resource PFR settings.
-- resource PFR settings are:
-- baseDensity = average number of resources per chunk in or around the starting area (chunk is 32x32 tiles)
-- frequency = average number of patches in a ring (see patchLocationHelp.txt)
-- baseAmountPerWell = average resource amount per well (for fluids, obviously) in or around the starting area
-- isFluid = true for fluids

PresetResources = {
-- Examples for base game:
-- Any field can be omitted to use the default
	["angels-fissure"]=	{baseDensity=1500, frequency=1, baseAmountPerWell=650000, isFluid=true},
--	["coal"]=		{baseDensity=8500, frequency=1},
--	["copper-ore"]=	{baseDensity=8500, frequency=1},
--	["crude-oil"]=	{baseDensity=8500, frequency=1, baseAmountPerWell=300000, isFluid=true},
--	["iron-ore"]=	{baseDensity=8500, frequency=1},
--	["stone"]=		{baseDensity=3000, frequency=1},
--	["uranium-ore"]={baseDensity=350 , frequency=1},
}

-- Note that this file will get overwritten when this mod is upgraded.
-- If you make changes, back them up before you upgrade.

-- Tuning characteristics for the map generator.
MapGenerationTuning = {
	-- Number of patches per ring, by default
	defaultPatchCount = 6,
	-- Inverse of the slope of the resource bonus curve
	bonusDistance=460,
	-- Width of a 1 million amount patch (approx)
	oneMilPatchWidth = 25,
	-- max ratio between large and small patches at the same distance
	patchSizeMaxRatio=2,
	-- for randomly choosing cells.  corner cells should be listed less frequently
	cellIdTable = {1,2,2,3,3,4,5,5,6,6,7,8,8,9,9,10,11,11,12,12},
	-- Amount to increase desperation on each failure
	ringDesperationFactor = .2,
	-- Minimum size factor to support the starting area
	minSizeFactor = 1600,
	-- Factor that all richness is multiplied by
	globalFudgeFactor = .36,
	-- Size of "CENTER" area relative to 1 being the cell width (i.e. starting area width)
	centerAreaWidth = .33,
}
I added: ["angels-fissure"]= {baseDensity=1500, frequency=1, baseAmountPerWell=650000, isFluid=true},

You will want to tweak the values until you get the type of distribution that you are interested in having. The above settings have fewer fissures with higher percent per fissure.

I would like to have the ability in the mod to be able and define the minimum starting ring. So that, for instance, the fissures do not start until ring 2 or 3. I thought "baseDensity" controlled if the resource was in the starting area, but when I set it to "0" the fissures did not spawn at all. I would like to be able to move a few of the other Angel's Ores like Jivolite and Crontinnium out a few rings as well. If you come up with some nice settings, it would be great if you shared also. Good luck!

Edit*

I fiddled around a little more to try and make a map I like for use with Rampant AI and Natural Evolution. This made me add what I think are the rest of the angels ores and liquids to the resourceCustomization.lua file. Thought I would paste it here in case someone wanted to flesh out the settings for themselves. For me, I have turned off all of the normal ore generation and just have the infinite ores. On my map, I am liking the distance to the next set of ores and how many biters I will need to work through.

Code: Select all

PresetResources = {
-- Examples for base game:
-- Any field can be omitted to use the default
	["angels-fissure"]=	{baseDensity=1500, frequency=1, baseAmountPerWell=300000, isFluid=true},
 	["angels-ore1"]=	{baseDensity=0, frequency=1},
 	["angels-ore2"]=	{baseDensity=0, frequency=1},
 	["angels-ore3"]=	{baseDensity=0, frequency=1},
 	["angels-ore4"]=	{baseDensity=0, frequency=1},
 	["angels-ore5"]=	{baseDensity=0, frequency=1},
 	["angels-ore6"]=	{baseDensity=0, frequency=1},
	["angels-natural-gas"]=		{baseDensity=8000, frequency=1, baseAmountPerWell=450000, isFluid=true},
	["infinite-angels-ore1"]=	{baseDensity=1100, frequency=0.4},
 	["infinite-angels-ore2"]=	{baseDensity=1000, frequency=0.4},
	["infinite-angels-ore3"]=	{baseDensity=1000, frequency=0.4},
	["infinite-angels-ore4"]=	{baseDensity=1000, frequency=0.4},
	["infinite-angels-ore5"]=	{baseDensity=1000, frequency=0.4},
	["infinite-angels-ore6"]=	{baseDensity=1000, frequency=0.4},
	["coal"]=					{baseDensity=0, frequency=1},
	["infinite-coal"]=			{baseDensity=1500, frequency=0.4},
--	["coal"]=		{baseDensity=8500, frequency=1},
--	["copper-ore"]=	{baseDensity=8500, frequency=1},
-- Crude oil is Angel's Multiphase Oil
	["crude-oil"]=	{baseDensity=8000, frequency=1, baseAmountPerWell=450000, isFluid=true},
--	["iron-ore"]=	{baseDensity=8500, frequency=1},
--	["stone"]=		{baseDensity=3000, frequency=1},
--	["uranium-ore"]={baseDensity=350 , frequency=1},
}
Post Reply

Return to “Mods”