I'll go for the short and simple answer first :
AssignStartingPlots.lua
...
Well isn't that enough ?
..
Ok, so here's the long one :
There are tables that can customize for the resource quantity/placement. In the
Resource table first, there are a lot of value linked to the resource placement, then there are the 3 tables defining the placement rules. first one is
Resource_TerrainBooleans, it's the simple one : can the resource be placed on this terrain ? true or false. Then there are
Resource_FeatureTerrainBooleans and
Resource_FeatureBooleans, those two are linked, the terrains defined in the first one will need one of the feature defined in the other one to be able to host the resource.
Still here ? good, here's the funny part.
The randomized resource placement used on map created with the WB is defined in the file
WorldBuilderRandomItems.lua, and the resource placement used on map created from script is defined in the file
AssignStartingPlots.lua.
WorldBuilderRandomItems.lua use the value defined in the
Resource,
Resource_TerrainBooleans,
Resource_FeatureTerrainBooleans and
Resource_FeatureBooleans tables
AssignStartingPlots.lua doesn't use the table. Period. The resource placement is directly hardcoded in the file. And not in a simple way.
There's a long explanation of the system in the file itself (I don't like the choice they've made for resource placement, but at least the file is fully documented...)
So, if you're starting a map script or a map made in world builder with the random resource option checked, the placement rule is different and the number of resource placed is different.
But luckily for us, the placement for our WB maps is the one based on the XML, we can modify the rules from here, and that's what is done when the YnAEMP mod is activated.
As I said to you in MP, I think that I can change that to make the rule map dependent, and in the process allow a better control on the number of resources to place for each map. But that'll need some test first...
Ok, general answer made, now for your point:
1/ check the log for the requested resources, if you see a line saying " trying a larger search", it means that there wasn't any plot available for that resource in the 3 tiles radius, so the mod try up to 6 tiles away. If it totally fails to place the resource, it say it on the following line. Fixing that need either a change of the terrain around the starting position, a change of the placement rules, or a change of resource for that civ.
2/ yep, forgot to correct this one, I'll finally fix that in next version
3/ Spice is an example of the difference between WB and script map resource placement :
- WB map use the XML rule, which is the same in vanilla and YnAEMP, Spice can be placed on Grass or Plain as set in Resource_FeatureTerrainBooleans, meaning there's also a feature needed, and the feature is only Jungle as set in Resource_FeatureBooleans
- Script map use this code :
meaning it could place spice on all jungle plot and in forest on tundra...
Oil is changed by YnAEMP, as coal, else those resource couldn't be placed in enough quantity in some region, so they're allowed under forest, and you can found coal in plains.
4/ Again, the number depend of the type of code used : WB or mapscript. I won't describe the mapscript function(s) here, it can change a lot depending of the map, and the "balance" coding to make fair starting position is pretty complex.
For the WB, it's a bit of randomness and value picked from the
Resources table.
Simply it add 4 random value and a constant one, multiply it by the quantity option selected in the menu (YnAEMP addition here), calculate a value based on the number of tile available for this resource on the map, use a percent ratio on that value if defined in
Resources, mix it with another ratio based on the number of player (or a fixed value if you selected the "no scale" option, another YnAEMP addition)), and remove the number of resource already placed by the request or regional placement of YnAEMP. And that's a lot easier that the script placement, believe me
Once I've implemented the custom rule per map, "who" will be "us".
It could already be "us", via a change to the existing table, but it will be a change for all YnAEMP map before the new option is implemented then.
And finally, I'll see if I can post a recap of all resource placed after map generation, the way the code is made, I couldn't simply add it at the end of the line (but If I'm not too lazy, I'll add it in a less simple way)
And don't worry, YnAEMP was made 'cause I wanted it to be customizable
