Quantitative Resources

ww2commander said:
1. Not every resource needs to use this system. Resources that are classed as strategic should use this system, and further to this, those that are in a controlled environment (produced by the civ via building conversion or strategic in quantity).

From a coding standpoint, I'm actually quite leery about having a hybrid system. The fact is it would be easier to replace the existing system than to create a new system that sort of piggybacks on the old one. Saying this resource will be binary and this one quantitative... it just runs into problems... it's better just to wipe the slate clean and build something new.

If you only want a couple of resources to be quantitative, my advice is to simply remove those resources you want and make them yields instead... then create yield requirements for units both in terms of construction and also for continued maintenance in the field (oil for tanks, food for troops, etc.)

RE Point 1:

I'm not sure I'm clear on this. If you're talking about food resources not needing to be quantitative, then I kind of agree, but hesitatingly. I could see other modders out there who might want to implement famines and whatnot, and this would be of interest to them. I know of one WW2 scenario where someone wanted to link food supplies to units, such that if all your food runs out your units start to die of starvation. Let's try to keep this open for all resources now. As you said, strategic is in the eye of the beholder. If we're going to do it for some, we might as well go all the way. ;)

I was going to basically disagree with ww2commander here, but I also have to disagree with your example as well. The best way, IMO, to implement units requiring food is not to have a Bonus supply requirement but rather a Yield supply requirement. I mean, it would be a lot easier to say that a unit needs 1 Food Per Turn than 1 Corn OR 1 Wheat OR 1 Rice OR 1 Pig OR 1 Cow OR, etc. etc.

That said, there's a few other issues to be addressed: How will health and happiness bonuses from resources be handled? It wouldn't make sense to have +1 health or +1 happiness from each unit of a resource unless you dramatically devalued an individual point of happiness or health. You could set it so that you get +1 for every five units or ten units or whatever you want it to be, but does that mean you'd be able to stockpile it and get tons of extra happiness or health? You could set it so that you get the +1 if you have at least one unit of the resource in a city inventory, but that seems rather unrealistic as well...

The other possibility is that you have consumption rates like with food. Resources would be consumed by the citizens of a city, and if you meet the consumption rate, you get the +1 happiness or health, and if you fail to meet it, you don't get it. If you have a stockpile, it will continue to take from the stockpile if the consumption demands exceeds the supply rate.

While we're on the subject, I would also suggest that it would be a good idea to add some storage constraint options. The idea here would be that certain resources could not be stored.. or at least not very well. So instead of 100% of the resource carrying over into the next turn, some other variable percentage would carry over instead. That variable percentage could be influenced by different things... techs, civics, difficulty level and map size for example. For example, Refrigeration could be used to increase the storage capacity for the food resources. And for civics, certain civics reduce the quantity carrying over to represent a society where more stuff falls off the back of the truck.

There should also probably be some kind of decay value for resources so that you don't establish too massive a stockpile... over the years, time will erode your storage supplies... but you could set that decay rate for different resources, so food would keep for a lot less time than Iron or Stone.

These last two things are a bit beyond the scope of some of the basic problems, but I think they'll become important in the long run for economy management.
 
I’m not too keen on the idea of linking units to food supply myself, because this would create a lot of logistical problems in the epic game with supply and whatnot, so I wasn’t advocating implementing that here. I would like to preserve the basic framework for other modders, though, so they can do it later for a WW2 scenario, which would necessitate going all the way as you said and making everything quantified. But since you’re for that anyway there doesn’t seem to be much of a conflict of interest.

The food issue opens up another can of spam… ;)

I have to admit the bonus problem has thrown me for a loop. This is definitely where the binary system works best, but like you mentioned having a hybrid setup would be too convoluted. I suppose the simplest solution would be to set each food bonus to yield a net sum per turn, like with the iron mine, and each city that is connected consumes part of it (either proportional to population, or more simply, a flat sum like -1 corn per city). As for the health/happiness bonuses, you just set the code such that if iCorn != 0 then you get the bonuses, otherwise not.

You could set it so that you get +1 for every five units or ten units or whatever you want it to be, but does that mean you'd be able to stockpile it and get tons of extra happiness or health? You could set it so that you get the +1 if you have at least one unit of the resource in a city inventory, but that seems rather unrealistic as well...

Agreed. The player should not be able to exploit the system by stockpiling massive amounts of food, leading to ridiculous bonuses. It should be another case of “either you got it or you don’t.” When you say city inventory, I’m assuming you mean the city is connected to the resource and hence has access to the “nationwide” stockpile. This is where it gets tricky, because if we do it like I just said in the preceding paragraph there’s a glaring problem: if it’s geared so that you have -1 corn per city per turn in exchange for +1 :health:, and if you only have 4 corn left but 10 cities, which ones get the bonus? It’s hard to say.

The solution: instead of setting it on a city-by-city basis, make it empire-wide. That is, so long as you have a surplus of a food resource in your global stockpile, you get the bonus for every city that is connected to it. (We could also make the demand based on your global population, if necessary, though that might be overdoing it.) Yes, this will lead to the situation described in your quote, but remember that a food bonus represents a huge quantity in reality. 1 unit of corn is not a dozen package in your supermarket’s freezer ;) but rather many, many gross of them. So even if you have only one unit, that could still represent sufficient quantity to justify the health bonus until the next turn, when it gets depleted to zero.

We should take Vrenir’s words of advice to heart. The whole purpose of this mod, of course, is to make Civilization more realistic and fun in the process. But it shouldn’t be done at the expense of gameplay. About Vrenir’s concerns over too many resources and requirements: perhaps I went a little overboard in my description earlier. I certainly don’t intend to have the terrain covered from head to toe; however, QR does necessitate getting rid of the old system, where you might have only one supply of iron or oil on an entire continent, in favor of multiple sources per civ for production purposes. This in the end is another balance issue, not a coding one, so that’s not too much of a problem. The basic system can still work however we specify the terrain distribution. I’m more concerned with fleshing out all the programming stuff so that we have a basis for other modders to use.

One last quick note: I am very much in agreement with Dom Pedro II’s storage system. You don’t want the counters running away such that you have 10,000,000 stone by the time you’re in the space age. It sounds best to limit it at the outset to a certain number, based on map size probably, which is then increased by certain techs as you advance.
 
I want to applaud your efforts, and I hope you can make this work.

But my biggest concern with quantifying resources is there are almost 40 different resources in Civilization 4. As it stands now, the player has to keep track of their treasury, maybe their research rate... that's it. Imagine the kind of player who would enjoy keeping track of 40 different values, trying to decide whether they can afford to build a certain building, or whether they have enough bananas to support building a new settlement.

I'm not saying that 40 different values will cause this mod to fail. But I think it would relegate this mod to niche territory: something that would never catch on with a wide audience, or inspire Firaxis to finally implement this missing feature (which is ambitious, but possible if you've seen some slight similarities between Civ 4 and some Civ 3 mods). That's something you have to think about.
 
Certainly I would want this to be considered for future Civ games, if we do a good job, so I hope you're wrong when you say it'll just be a niche. I completely understand, though. Keep in mind we're still at the earliest stages -- I'll repeat it, many of these concerns are balancing issues that we can play around with later, like the building resource prereqs.

You raise a good issue about 40 different quantities to keep track of, though. (Perhaps it would be an incentive for Firaxis to cut down on the already excessive number? ;)) Maybe ww2commander was right after all and the best idea is to limit it to strategic resources, not food or luxuries, and to have a hybrid system. But that's a nightmare from a coding perspective. Still, it doesn't make as much sense to be dealing with say, 500 movies produced by the Hollywood wonder, but needing 20 steel and 5 oil to build a tank is quite logical.

I can see it now:

Roosevelt: "Hello there, Hatshepsut. We'd like to make you a trade: you give us 50 iron in exchange for 280 movies. What do you say?"

Hatshepsut: "All right, just as long as Tom Cruise is not in any of them..."
 
To reiterate something that was already hit on, a lot of the things being disputed are surface alterations rather than coded features. Rather than debate which resources should be quantified and how they should be used, let's focus on quantifying the things that we need coded in order to make any of this work.

1) The ability of a resource to produce X per turn instead of a universal quanitity.
2) The ability of a building to require X resource as a prerequisite
3) The ability of a building to consume X resource per turn
4) The ability of a unit to require X resoucre as a prerequisite
5) The ability of the AI to trade X resources instead of total access
6) The existence of a National Treasury to store surplus resources

Did I miss anything?

Once those are taken care of, individual modders can decide which resources to apply the code to and which (if any) to leave blank. They can also individually alter the resource distribution, provided you tell them how, so that they have more or less resources than the default game.

About the only thing being argued that is necessary is whether to have the resources as a prerequisite for the linked production or to stream it along. I'd personally go for prerequisite as it seems simpler for all concerned, both modder and player.
 
Vrenir, it's actually a bit more complicated than that because there are certain bonuses (i.e. the happiness and health bonuses) that are going to create real problems because how the mechanics is supposed to work for that is a bit tricky...
 
Question: if we end up going with a dual system, I assume there would be some kind of XML/Python tag to specify which type a resource is, e.g. <bQuantitative>1</bQuantitative> ?
 
Limiting it to strategic resources is a solid idea, IMO. Mind you, that's still 10 resources (if you include Ivory). I'd say that a 10 resource system is more likely to inspire Firaxis than a 40 resource system. But I'm not Firaxis. I tend see them as very conservative, and "7" appears to be their magic number.

I might streamline it even more, to be quite honest:

- Building Materials (stone, marble, even lumber...)
- Metals (copper, iron, aluminum)
- Fuel (uranium, oil, coal)

And each could be more valuable than another. For example, iron could be "like" copper, but just provide "more". I know this is a pretty high level of abstraction, but iron would give you a better army than copper -- it just so happens that it would also be bigger. It might be easier to buy into for coal vs oil, though.

Mind you, there's no way to streamline horses or elephants.

I'm just throwing my 2 cents into the brainstorm.
 
I wrote this long post that the computer ate... so I'm going to try to get all of my original points covered...

dh_epic said:
Limiting it to strategic resources is a solid idea, IMO. Mind you, that's still 10 resources (if you include Ivory). I'd say that a 10 resource system is more likely to inspire Firaxis than a 40 resource system. But I'm not Firaxis. I tend see them as very conservative, and "7" appears to be their magic number.

I might streamline it even more, to be quite honest:

- Building Materials (stone, marble, even lumber...)
- Metals (copper, iron, aluminum)
- Fuel (uranium, oil, coal)

And each could be more valuable than another. For example, iron could be "like" copper, but just provide "more". I know this is a pretty high level of abstraction, but iron would give you a better army than copper -- it just so happens that it would also be bigger. It might be easier to buy into for coal vs oil, though.

I've just been working on a modcomp that would add BonusClass requirements and BonusClass modifiers so that you could set it so that something would require only Metals or Draft Animals rather than Iron or Horses specifically. Another reason I wanted to use it was to give +2 Food to Farms when you have a supply of Grains. Also, once you hook up a grain supply, the supply is permanent because crops can be replanted elsewhere... so the bonus to all farms would simulate that superior crop replacing low nutrient-yield indigenous crops as the staple for the civilization.

However, all that hard work will (mostly) be lost with my new system...

Ok, so this is my thought regarding what we should do. I'm opposed to using both binary and quantitative Bonuses... it would just be too much of a hassle. Additionally, it would cause serious problems with trades to have some resources that are quantitative and others that are binary... Also, we'd have the game cycling through 30 to 40 Bonuses to manage the new inventory system with only 10 or 11 of those Bonuses actually being quantitative...

So instead my suggestion is the strip Bonuses and their info files to just dealing with the map and map placement and instead make newly derived info types the real forces in the economy.

Resource: We'll have a new one called "Resource" which is basically quantitative resources. This will include the potentially 10 or 11 resources people want to be quantitative.

Luxuries: This will basically refer to all the Happiness-producing commodities. I also think this is a great opportunity to include any new properties, bonuses, penalties, or other effects that they might cause that wouldn't have really worked as Bonuses.

Food: This will be for commodities that give health bonuses primarily (although the luxuries will have the ability to give health bonuses too). Food is really a problem since we have both specific food commodities like Wheat, Rice, Corn, Clams, Fish, Pigs, Sheep, etc. and we also have a generic Food yield. I would like to find a way to harmonize the two. The above mentioned strategy of a BonusClass modifier for grains is one way of accomplishing this, but I hope that with a specific FoodType, I can work out an even better way...

this is what I have thus far
 
I really like the idea of having different groupings: Strategic, Luxury, and Food. That would also allow you to have some like Strategic run out eventually, while Food remains renewable.

Just a random thought, but perhaps adding a slider somewhere that allows you to alter how much of each class of resource you stockpile would be good. I'm not quite sure where you'd put it, but with the interface completely alterable in BtS, I'd think you could make room.

Example:
Food = 90% use / 10% stockpile (enhances growth)
Luxuries = 30% use / 70% stockpile (for trading and hoarding)
Strategic = 20% use / 80% stockpile (saving up for stuff)
 
Dom, I have to say your idea for splitting them into three categories is growing on me. I think we'd all agree that the ideal way to do QR in the current Civ 4 frame would be to have some quantitative and keep others "as is", but that's just too hard. I looked at the resource code and I can tell everybody that's basically out the window without some MAJOR work -- certainly beyond me.

There was a game about 10 years ago called Destiny that had resources down pat, better than any other other implementation I've ever seen, and it sort of did it the way Dom Pedro suggested. Essentially, there were groups of "strategic" resources (iron ore, oil/gas, copper...) but also "manufactured" goods like what we'd call luxuries, and then there was food. A typical terrain tile might have very different kinds of "raw" food resources, e.g. game and berries, arable land, and so on, but when you built a farm and harvested them it would all go into one counter, Food.

So if I read you correctly, what you're saying is that we can still have 20 or so different food resources AND a system that works this way. Instead of having 20 different counters, where you'd have to keep track of them all ("Dang, my corn supply is running low!"), they'd all go into one global Food resource. Then you only have to deal with, "Do I have enough food reserves, or is my civilization starving?" without worrying about individual stockpiles. I like it. Of course, we'd have to distinguish it from the current city-growth food yield, but I think you're on to something.

I'm not sure I understand fully what you mean by the "Resource" classification. (I'm assuming there would be individual counters for each of these, based on your comments.) I do have one question: is this going to create problems later on if modders wanted to add in additional resources and/or building-produced ones? That is, would we have to develop new code or can we just plug-and-chug into the existing format? (I realize these may be a hard to answer because it's not fleshed out yet.)

Luxuries, I assume would be kind of in between strategic and food resources. I'll be curious to see how you want to do this.

There's one potential problem: many buildings in Civ currently give bonuses for only specific resources, e.g. the broadcast tower gives happiness for Hit Singles, and a Grocer gives health bonuses for a few select foods. I'm not sure how you'll be able to preserve that without compromising the new system, but there's got to be an easy way to distinguish between type and quantity.

Vrenir also brought up a good point: will these QRs be finite or unlimited? In the current "resource migration" system there's a chance of it running out (or a new one being discovered) every turn. Do we wish to change that in favor of, "This oil plot provides +5000 oil. When it's gone, the oil bonus vanishes." ? That's an interesting idea, but it might be beyond the scope of our aim here, and using the current setup wherever possible will certainly save work. Speaking for myself, I'd be content either way.
 
Did not have time to check the forum yesterday....but boy has this thread grown ;)

Its good to see we are fleshing out ideas left, right and center :)

Question: if we end up going with a dual system, I assume there would be some kind of XML/Python tag to specify which type a resource is, e.g. <bQuantitative>1</bQuantitative> ?

That was the original intention I had when it came to selecting which resources are strategic. My view on using the hybrid system is based on the view of most resource dependant games that choose a few specific resources that are quantiative instead of the lot.

As dh_epic mentioned, it is very off putting to think that you have to manage every resource in a similar manner as the game turns into resource acounting rather than strategy. :(

I think we need to accept that this system would work perfectly in scenarios only and not on a grand 'whole' game scale as that would require all the resource system being quantiative as horses were strategic earlier but steel replace weaponry later and so on....

When writing my responses I try to visualise the Soviet Union in my mod and how they would use this system so thats probably why I tend to focus only on strategic resources used during world war 2 such as aluminium, steel, coal, timber, oil and uranium (for later years).

Everything else in my opinion (I know I can be wrong :lol: ) is not relevent apart from possibly food (wheat, cattle, sheep). The assumption is that luxury goods are important but not important enough to worry about quantity as the source can vary and the luxury resources on the map should representative of the resources and not to end all. Perfumes, furniture, appliances, cloths and so on are all important to your civ but you should not have to worry about how they are made and in what quantity.

I feel I am rambling......so in a nut shell, I think your civ should only quantify 'strategic' goods that impact infrastructure and military needs as these are the 'bones' of your society....everything else is simply the flesh on the outside :crazyeye:

EDIT:

You might want to take a look this this mod that quantifies oil:
http://forums.civfanatics.com/showthread.php?t=194293

This is Duke176's mod that I mentioned and plan to use in my ww2 Eastern Front scenario. Unfortunately Duke has been off the scene for a while (I think he is on holidays)....but he would have loved this thread ;)
 
As dh_epic mentioned, it is very off putting to think that you have to manage every resource in a similar manner as the game turns into resource acounting rather than strategy. :(

There is one way to deal with this... just make it so that each luxury resource usually produces more than you will use, meaning you'll never have to check it...

I think we need to accept that this system would work perfectly in scenarios only and not on a grand 'whole' game scale as that would require all the resource system being quantiative as horses were strategic earlier but steel replace weaponry later and so on....

When writing my responses I try to visualise the Soviet Union in my mod and how they would use this system so thats probably why I tend to focus only on strategic resources used during world war 2 such as aluminium, steel, coal, timber, oil and uranium (for later years).

I'm kind of the opposite; for a long time I have been planning a mod that spans almost 10 millennia of human history but was waiting for this last issue to be addressed. I think the key is to make it so that, as you say, earlier resources like horses are quantitatively implemented, but as the game goes on they become less important. That way you're not burdened with 40 stockpiles to manage.

Remember saltpeter from Civ III? Musketmen required it, but not riflemen. I can still see the civilopedia explanation: "By the time you can build riflemen, saltpeter is in large supply and is not required." That's kind of the way I was thinking about it here.

So my idea (in having just about every resource quantitative) is that you would never have 40 resource counters to check constantly because it's era-relevant. For example, stone is important when you're going after the Pyramids, but in 1900 AD it really is no longer a supply issue. Hence, even if an enemy pillages a quarry and some buildings still require stone to be built (like the Factory) reestablishing the link isn't a high priority because you've already got a huge stockpile, just like in real life. (How many stone quarries were targetted in recent wars? Not many I bet.)

I should point out that stone and other "ancient" resources are already irrelevant by the modern era, so there's no real change here. It just makes the game more interesting at various intervals.
 
OK, basically, what we're doing here is creating new info files for each of the different categories we want...

So now we'll have CIV4ResourceInfos.xml, CIV4LuxuryInfos.xml and CIV4FoodInfos.xml...

All Bonus requirements and modifiers from the Unit, Buildings, etc. files are removed. They are replaced instead by things like this:

Code:
<RequiredResources>
   <RequiredResource>
     <ResourceType>RESOURCE_IRON</ResourceType>
     <iAmount>10</iAmount>
   </RequiredResource>
</RequiredResources>

OR

Code:
<PrereqLuxury>LUXURY_GOLD</PrereqLuxury>

We could set up multiple luxury requirements too, but there would not have to be an amount value since the Luxuries would remain binary instead of quantitative.

A ResourceType here is simply for any commodity that we want to be quantitative and stored. A LuxuryType is basically the standard binary commodity that once you hook up the Bonus, it applies civ-wide. This way you can just say that if a city has that Luxury, it gets +1 Happiness.. not that you have to A FoodType would work slightly differently since once you get it, you'll always have it... it's main function is to simply augment the yields of Farms and provide the health bonuses to the cities.

This last one, the FoodType, is the one I'm most iffy on... but I can't really think of a better way to do things...

BonusTypes, however, will now only refer to the map object... so manufactured commodities like Hit Singles, Movies and Broadway Plays or Bronze and Steel if someone added those, would no longer be Bonuses. The BonusTypes would only be required so that it shows up on the map. Improvements then will have the ability to produce quantified Resources, binary Luxuries, or binary Food supplies or all three if you wanted... for example, if you wanted a Sheep Pasture to produce Wool and Meat, you could do that. Or you could even have multiple Resources coming from the same tile.

For example... you could say that any Mine will give you +1 Iron... but if you're on an Iron Bonus tile.. which could be renamed to "Iron Vein" or something... it will produce +5 Iron. Maybe you don't want it.. it's your choice. Once it's done in the SDK, one will only need to adjust the XML to make it the way one wants. So yes, you can add more ResourceTypes or LuxuryTypes or FoodTypes.

And in trade, the Bonus category (I think it's actually called Resources) will instead be Resources, Resources Per Turn, Luxuries and Food. When trading Resources, you can trade a bulk one-time quantity of the resource, a set quantity per turn, or with Luxuries it works pretty much exactly as now. You trade one source of the Luxury.
 
Another nice thing would be that you could make it so that worked Features generate a number of resources... like say Lumber. So if you have a Citizen working a Forest, you'd get a number of Lumber per turn for that.
 
:agree: :worship: :worship: :worship: :cheers:

Dom Pedro II, this is EXACTLY what I was looking for when I started this thread. I agree 100% with what you said.
 
Further to your tags on the resource, could you use an additional tag such as <ObseleteTechQty> which specifies the tech that makes the resources strategic use or quantity irrelevent. Once this tech is reached, the quantity is set to -1 and becomes unlimited in quantity. This way old buildings and units that still require the resource instantly get the amount required whilst the newer resources remain quantative.

A few extra flags for consideration.

Trading:
<PercentageTradable> could be used to tell the AI how much of its total output can be traded, thus 50&#37; on coal resource would mean that if the AI produces 40 coal per turn, only 20 coal can be traded max. This figure could also be adjusted on trait, so the more you annoy them, the less the perecntage becomes.

Buildings:
<ResourcesRequred>
...<ResourceRequired>BONUS_STEEL</ResourceRequired>
...<ResAmtRqd>10</ResAmtRqd>
...<ResourceRequired>BONUS_TIMBER</ResourceRequired>
...<ResAmtRqd>20</ResAmtRqd>
</ResourcesRequred>

For power plants:
<PowerAmtReqPerTurn>

For units:
same structure as buildings to construct as well as
<ResourceFuelSource>, you could specify wheat for foot soldiers, oil for armour or even krytonium!!!! for spaceships :lol:

I am just brainstorming!
 
Top Bottom