Editing strategic resource accessibility

Deussu

The Omniscient
Joined
Oct 21, 2010
Messages
167
Location
Finland
Hi all,

I'm planning on doing some XML modifications for a multiplayer game, and there are some things I'm not so quite sure of.

First thing is to increase the amount of iron tiles available. Way too often the lack of iron can cause one player to drop completely out of league. In addition to this I wish to decrease the amount of iron given in a tile; 2, 4, and 6 is quite a lot. In Thal's balance mods iron can only be found in quantities of 1 and 2, which actually feels quite good.

So can you reproduce these effects just by doing XML modifications? Last time I tried to do this I was unsure whether increasing the availability worked. I tried changing <RandApp1> and <RandApp2> values in \XML\Terrain\CIV5Resources.xml. Also changing quantities didn't work, I changed values for RESOURCE_IRON from 6 to 4, and still found plots yielding 6 iron. I planted a city on top of one and did get 6 irons, so it wasn't just showing it wrong.

Thanks in advance!
 
So can you reproduce these effects just by doing XML modifications?

No. (That was easy, wasn't it?)

Those XML values you mention simply aren't used. The only way to adjust resource availability is through editing AssignStartingPlots.lua.

Within ASP, there are a few separate things you'd have to adjust. Specifically:
> There are two subroutines, GetMajorStrategicResourceQuantityValues and GetSmallStrategicResourceQuantityValues. These control how many units of a strategic resource are placed in a single deposit. (Exception: Oil in the ocean. That's handled through a separate PlaceOilInTheSea subroutine.)
The good news is that you can edit these subroutines without screwing around with the rest of the script. As an example, go look at the Lakes, Highland, or Great Plains map scripts. These contain blocks of code that override at least one of those two routines with different values. (This, unfortunately, makes those maps incompatible with any mod that adds new strategic resources, such as my own mod.)

> If you want to adjust how rare the deposits themselves are, that's a whole different mess. The way the game assigns resources is in PlaceStrategicAndBonusResources:
1> Loop over every land tile on the map. For each terrain type, do a random draw. (Example: Marsh tiles have a 1 in 9 chance of having a strategic resource.) If this succeeds, then see WHICH resource it is by looking it up in a table. (For Marsh, it's 65% oil, 35% uranium, although there's a clustering logic in there too.) Place a MAJOR deposit.
2> Once every tile on the map has been checked for that, then add 23 Small deposits to random land tiles on the map.
3> Then place some Oil in the water (equal to half the amount placed on land).

So, if you want to adjust the rarity of the deposits themselves, you'd just need to edit the numbers in that particular block of code.
 
Sounds nifty. Wonder if that works in multiplayer. Considering it'd be the job of the host to create the map (maybe), only the host should do the LUA modifications. Nevertheless it seems it's obfuscated. Hooray for obsolete values!
 
Hmm, I've now opened the lua file and looked at it a bit. I think I understand what the things do, but the sparse setting puzzles me.

It states a bonus_multiplier of 1.5, and later all the PlaceSmallQuantitiesOfStrategics routine kicks in where this bonus multiplier will make 23 -> 34.5. I'm confused, does this mean the sparse setting creates fewer Major quantities but more Small quantities? If so, it'd be closer to what I try to achieve.
 
Hmm, I've now opened the lua file and looked at it a bit. I think I understand what the things do, but the sparse setting puzzles me.

It states a bonus_multiplier of 1.5, and later all the PlaceSmallQuantitiesOfStrategics routine kicks in where this bonus multiplier will make 23 -> 34.5. I'm confused, does this mean the sparse setting creates fewer Major quantities but more Small quantities? If so, it'd be closer to what I try to achieve.

Not quite. First, the Abundant/Sparse settings affect the size of each deposit; if a Major is 6 units of Iron and a Small is 2 on Standard, then it might be 8/3 on Abundant and 4/1 on Sparse.
Second, the setting will also affect the number of Small deposits, but not the number of Majors. As far as I can tell, the number of Major deposits doesn't depend on that setting at all. Now, that does have something like the effect you describe, where the relative weighting of big/small varies with the setting, but it's not actually decreasing the number of majors.
 
At this point I want to clarify I have absolutely no coding experience, and make my way by staring the code hoping the logic would drill into my brain. For now the code does look somewhat comprehensible.

Not quite. First, the Abundant/Sparse settings affect the size of each deposit; if a Major is 6 units of Iron and a Small is 2 on Standard, then it might be 8/3 on Abundant and 4/1 on Sparse.
Second, the setting will also affect the number of Small deposits, but not the number of Majors. As far as I can tell, the number of Major deposits doesn't depend on that setting at all. Now, that does have something like the effect you describe, where the relative weighting of big/small varies with the setting, but it's not actually decreasing the number of majors.
Thus decreasing the Major deposit value to lower and increasing the bonus_multiplier from sparse, it would result in more Small deposits, but still a normal amount of (lessened) Major deposits. This would be more in the way of what I try to achieve; to provide a more equal basis for everyone. No sudden "Boom, Russia improved iron, now I has 12 iron!"

I think I'll try that. Thanks!
 
Back
Top Bottom