How to increase occurrence of resources?

lordsurya08

class-A procrastinator
Joined
Oct 22, 2010
Messages
547
Location
california
Hi fellow modders,

I want to increase the occurrence of resources in this game. I don't want to increase resource quantity (e.g. 6 iron to 10, I already know how to do that) but increase the percentage of tiles that have a resource on it. In other words, make the land more rich.

I looked in the XMLs and AssignStartingPlots.lua but didn't find what I want (largely due to poor documentation). I know it's there somewhere - if any of you can help, it would be appreciated.

___
also, some side questions:

1. is it possible to increase the max radius of tiles a city can work, from say 3 to 4?
2. is any of the ai code available for us to modify? more precisely, i want to improve the ai's atrocious algorithm for city placement.
3. when will civ 5 source code be released?
 
I looked in the XMLs and AssignStartingPlots.lua but didn't find what I want (largely due to poor documentation).

It's all in AssignStartingPlots.lua. The documentation's fine, you just have to have a rough idea of what the routine's trying to do before you can get started, but that doesn't take long. There's also a huge block of comments at the very end of the file designed to walk you through the important bits, so it's really not hard to learn. That file's a pain to work with for other reasons, but not because of documentation.

The thing is, the resource allocation is broken up into a half dozen or so separate bits. Given your statement about numbers, I'm assuming that you're only asking about the Strategics. For those, three parts of the code matter:
1> Large land-based deposits of each strategic are placed through one block near the end of the file. This is done probabilistically; 1 in 33 grassland hexes will have a large strategic, and if the hex passes this check then it'll do a random draw from 1 to 100 to see which resource it gets. These are right down at the bottom of the file, hard to miss.
So to increase the chance of a certain terrain type having some kind of strategic, change the "33" to a lower number. This'll increase all resources on that terrain type equally, so you'd then need to tweak the percentages if you want to bias one resource and not the others. (Or, if you're adding a new resource, like I've done.)
2> Small land-based deposits are a bit different; the game will place 23 of these (assuming standard abundances), picking 23 random hexes on the map, and then doing a draw from 1 to N (where N varies with the terrain type) to figure out which one to place. You can change the 23 to something bigger, or you can tweak the chance tables for each terrain type.
This part's about halfway up the file, but the calling statement to it (where the number 23 is set) is down at the bottom right at the end of the Large strategics part.
3> Water-based deposits (i.e., Oil) are handled through a completely separate "PlaceOilInTheSea" routine within AssignStartingPlots. The game places half as many water-based units as their are land-based Oil.
Again, the call to this is right at the bottom, after the Large and Small distributions.

1. is it possible to increase the max radius of tiles a city can work, from say 3 to 4?

There are values for some of these things in GlobalDefines, but generally speaking, no.

2. is any of the ai code available for us to modify? more precisely, i want to improve the ai's atrocious algorithm for city placement.

No, the AI code is not available. But the AI's algorithm for city placement is based on the weightings in the GlobalDefines file, so if you were to say exactly how you think it's "atrocious", we can tell you what to change in that file to put it more to your liking.

3. when will civ 5 source code be released?

We've heard an answer of "soon" for the last four months, but no one knows anything beyond that. A simple search of this board would find plenty of threads discussing this topic.
 
Back
Top Bottom