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.
Notice how the resource spawning is very similar near the origin, but the resource patches get much larger and more sparse as you get farther from the origin.
Long Description
I made this because I got very frustrated trying to mine out large areas in the super-late game. There are just so many patches to mine.
I know I can set resources to very-big, and that would solve my problem. That would also make the early game too easy, though. I wanted a standard early
game that would transition into a late game that did not force me to mine out a bajillion patches.
Also, I do not like the idea of choosing between rail-oriented map and non-rail-oriented map at map generation time.
With PFR, the map starts out non-rail oriented, and transitions to more and more rail oriented as patches become farther apart.
Also, since this is my first mod let me just say: this game is so great!
Details
* Near the origin, the map will look very similar to what you would get in vanilla.
As you get farther from the origin (starting at around 500 tiles = 2 screens), patch size starts growing significantly while the number of patches starts dropping significantly.
* All of this is balanced to give the same average density at any distance as you would get without PFR.
PFR resources will actually overwrite water, meaning land will be created under the resource if it happens to end up in water.
* This adds resource islands to the game, which I am curious to hear if people like.
* Note that landfill is part of the game now, so getting to the islands should not be a problem.
* PFR will never place resources on top of eachother.
PFR reads and obeys the map generation settings from the map generation screen. So, for example, it will obey if you set stone to "very-good" richness.
* This also means that the presets like "Rail World" still work with PFR.
* To be specific, both size and richness do the same thing. Size multiplies the average amount of resources by a factor of .25, .5, 1, 2, 4, and richness is less impactful with these ratios: .5, .7, 1, 1.4, 2.
* Increasing/decreasing frequency makes for more/fewer patches total. It is balanced by making the patches smaller/larger by the same ratio, so that the average is the same.
PFR can be turned on or off on a per-map basis. You can do this under mod settings on the map generation screen.
* This does NOT require restarting the game!
* Pre-existing maps will have PFR off, so your old maps will be unaffected by installing PFR.
* PFR can be activated on old maps if you want. Open the command line with ~ and run /pfr_regen. Note that this will wipe out all existing patches!
* PFR can be used with other resource spawn mods like RSO, as long as it is turned off. RSO cannot be turned off so it needs to be uninstalled to use PFR.
PFR will generate all resources, including modded resources.
* The algorithm for determining placement characteristics for modded resources is clumsy, (sorry) but it works pretty well. (or pretty fair?)
** It works well for bob's ores, but I cannot guarantee it will work out of the box for every mod. Let me know in the forums if PFR generates a modded resource wrong.
* Mods can specify to PFR what their generation characteristics should be like. See the FAQ below.
* Any player can specify what the placement of any resource should be like, if you want. All you need is a text editor. See the FAQ below.
PFR obeys the general design principles of Factorio map generation. In particular:
* Maps generated with the same seed will be the same.
* Map generation is the same no matter in what order you explore the map. (A surprisingly difficult principle to adhere to for infinite maps)
There are two levels of long range radar included with this mod.
* One is 2x the range and one is 4x the range.
* Only the scanning aspect of the radar is long range, the active revealed area is the same as a normal radar.
* The speed of scanning is not increased, despite the massive increase in scanning area. You will therefore want to build a lot of them if you expect to scan at a reasonable speed.
FAQ
I want to tweak the resource generation for my game. What can I do?
You can use the normal frequency/size/richness controls - they work for PFR the same as they do for vanilla.
If you want more control, the file you are looking for is resourceCustomization.lua
It is typically in C:\Users\yourself\AppData\Roaming\Factorio\mods\prettyfairresources-...zip
You will need to unzip the archive to edit it.
Comments in that file explain what you need to do in more detail.
My mod has resources, but PFR generates them wrong. How can I fix this?
Your mod can specify resource settings directly to PFR. You do this by creating a
remote interface and giving it a function called get-pfr-resources. This should then return
an object similar to the object in resourceCustomization.lua.
PFR scans all of the interfaces and calls every get-pfr-resources function it finds.
The settings returned this way will override PFR's automatically determined settings.
I may write up a full explanation at some point. In the mean time, the best way to understand is to
look at the file patchLocationHelp.txt, which explains the coordinate system. Then look at the log produced
by a call to /pfr_log_map_cheats.
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Wed Aug 09, 2017 2:10 am
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.
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Wed Aug 09, 2017 1:39 pm
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)
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Wed Aug 09, 2017 10:33 pm
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).
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Thu Aug 10, 2017 12:30 am
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
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.
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Thu Aug 10, 2017 12:36 am
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
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)
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
Reika's is the only installed mod at this time. PFR is NOT installed:
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Sat Sep 02, 2017 1:50 pm
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.
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:
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:
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?
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Thu Oct 19, 2017 5:19 pm
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.
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Tue Oct 24, 2017 6:15 pm
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?
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Thu Oct 26, 2017 6:35 pm
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
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Tue Nov 07, 2017 12:48 am
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.
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Tue Nov 07, 2017 5:42 pm
by danbliss123
Yay! Thank you.
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Tue Nov 07, 2017 6:14 pm
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.
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Sat Nov 11, 2017 8:50 pm
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!
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Sun Nov 12, 2017 9:19 am
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.
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Sun Nov 12, 2017 6:48 pm
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.
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Sat Nov 25, 2017 10:27 am
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
Re: [MOD 0.15.x] Pretty Fair Resources
Posted: Sat Nov 25, 2017 9:26 pm
by MatthewGP
@aklesey1
You could try unzipping the mod and editing the resourceCustomization.lua file as follows:
-- 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.