• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Quantitative Resources

production bonuses are cummulative and are optionaly applied durring construction.

For example, let say you want to build a Tank which has a 50% production bonus with 10 total Iron and 50% production bonus with 10 total Oil. Then the maximum production bonus you can recieve will be 100% (which effectively allows you to coinstruct it twise as fast) when you have suffucient stockpiled resources durring construction. If you run short of one resource you simply recieve less then the maximum bonus equal to the relative quanity you fall short. For example, then you came 5 oil short durring construction, you would only have recieved a total production bonus of 75%, but it would have costed you 5 less oil.

Personaly, I think the system is beautifull in it's simplicity to improve resource balance without introducing complexity for the user or AI

Now to make things more intresting I will also introduce special XML tags for buildings, which will allow you get local/global discounts on certain resources cost. For example, a steel mill in the city will offer a 50% discount on Iron cost and a Refinery offers a similar 50% discount on Oil cost.

These allows mod makers to create building that improve city specialisation. For example, you could give infantry a food pruction bonus of 50% at a cost of 10 food. THis will allow you to construct infantry with food, but still be able to grow the city if it has sufficient food production.
 
Well this thread may be to old now. But just wanted to say in the WoC Mr. Genie figured out how to have unlimited resources in the TGA.
 
I mean the rest of the symbols will stay correct no matter how many resource symbols you add to the gamefont.tga.
 
hey guys... i think this is a must for a civilization game. I have not yet taken the time to read the whole thread (learning chinese takes so much time!!!!) but in case this hasnt been suggested, could we have a geographical location for resource stockpiling? for instance, i attack city A which is the egyptians main "warehouse" of iron in order to pillage their stores and use them for myself. I do not bring an occupation force because i have no desire to keep the city, i just want to take the resources.

a scenario like that is what i imagine. so is this possible? would it be fun to anyone other than me? i understand that you would need to designate a storage site but that seems like it could be easy to do, though obviously i dont know. anyway, just thought i would give my two cents. let me know what you think.
 
The only mod we currently have that does anything near a full QR system is Fanatic Demon's Resource Construction Mod. It is still in its infancy, however.

So this means no local geographical resource storage.
 
Hmmm, perhaps the way Corporations work could give us a clue as to a means of producing 'Semi-Quantitative' resources.

For example, take the luxury resources. Instead of giving you a flat 1 happy face, maybe they could generate +0.5 :) & +0.5 :culture: per "deposit".

Your production resources-like iron, copper, Stone, Marble, Oil, Coal etc could grant +0.5 :hammers: & +0.5 :science: per deposit.

Your Food Resources could generate +0.5 :food: & 0.5 :gold: per "deposit".

Obviously the numbers could be lower than this, or maybe adjusted for map size, & not every resource has to fit the pattern of its category. For instance, Cows could generate +0.5 :food: & +0.5 :hammers: per deposit, wheras Oil might generate +0.5 :gold: instead of :science:.

As I said though, I think the secret is cracking the code relating to Corporations & going from there. Only problem I could foresee is how it would interact with actual Corporation effects-except that maybe corporations could be additive or just provide a bigger bonus per resource!

Aussie_Lurker.
 
I've done some work that might interest those here. Thus far I've added a fourth yield type that accumulates in cities, and with a little more work will, with certain buildings, be made available empire-wide.

It's part of my Frontier Awaits mod.
 
I, too, have been thinking about this a lot. The Resource Construction Mod does not go far enough with its benefits, and expanding it is not simply a matter of making it broader (i.e. encompass more resources) so much as adding new features. Fanatic Demon has also not been on in over a month and the mod itself is still largely in the development stage.

I am currently trying to formulate my own mod for Q.R., though I do not yet know how successful it may be... stay tuned.
 
Well this is not an answer to all of the problems. I posted some example of the new TGA's in WoC.

http://forums.civfanatics.com/showthread.php?t=260636

My reasoning for posting hear is it might help in some way of having multiples of the same resource. Like for an example instead of just one cow and having cow 1, cow 2, and etc. But than you would have to limit the value of each resource, and have multiple resources that can be used to make something.

There are better ways but this opens the possible of duplicating resources.
 
Okay, I have successfully developed a quantitative resource system with stockpiles in Python. It's currently only in the testing phase, but it does actually work. :D

Each turn the game looks to see how many of a resource you have, including trades. It then adds the per-turn value to your stockpile. Negative per-turn flows are currently not supported, but can be made possible easily. On the main interface I have added a stockpile counter.

Units and buildings will require a specific amount to be constructed. Each resource is earmarked when you assign construction in the city screen, and it's not actually deducted until you finish building the thing. This is to allow you to change your mind with no consequences.

However, there is one problem that is befuddling me. Right now I am using CannotTrain to stop your ability to assign a unit if you don't have the resources, and this creates problems if you are right on the line. Let me use a concrete example:

Suppose a Swordsman costs 10 iron. You have only 10 iron in your stockpile. That means you can only build one Swordsman, right? Here's what happens: the game deducts the 10 from the stockpile, and then the CannotTrain kicks in to prevent you from assigning any more, since you're out. Trouble is, the game regards the last Swordsman you assigned as also being untrainable. Hence, you assign it, and on the next turn get the "you cannot continue training..." message, followed by the pop-up with a list of possible units, including (since you're back to 10 iron in the stockpile) the Swordsman!

Because production is saved, you can actually force the game to make the unit, but it's kind of annoying to have to go through this on every turn. (This only happens for the unit that reduces your stockpile to unbuildable status; if you had 30 iron and built only one Swordsman, there would be no trouble. If you tried to make three at once, there would be.)

Any suggestions on how to get around this?
 
Can you override the "cannot train" popup if the city's scriptdata has a setting in it?

To put it another way, now that specific city has 10 iron, so it can go about building what it was set out to. You'll probably have to store what the production unit is, so that if it changes the raw materials will be put back in the pool. Basically then, so long as currentProductionUnit = allocatedProductionUnit, production will continue without bother.
 
I'm not sure I follow you there. I haven't used city-specific resources, only a national stockpile. You are on the right track, since the key is in overriding the CannotTrain's automatic dismissal of the current unit production.

Again, the way it works is that it checks to see how many resources are presently being allocated out of your stockpile, and if you don't have enough to start work on a new unit, it returns True. I just don't know how to stop it from halting work on the present unit if that happens to be the last one you can build.
 
It essentially becomes city specific when that city starts building something that draws from the stockpile.

For example)
city A produces 60 hammers/turn
city B produces 10 hammers/turn
start with 0 iron, but get +6/turn
a swordsman (S for short) costs 10 iron and 60 hammers

turn iron cityA cityB
== === ==== ====
1 6 - -
2 12-10 - S(10H)
3 8 - S(20H)
4 14-10 S(60H) S(30H)
5 10-10 S(60H) S(40H)
6 6 - S(50H)

cityB claims 10 iron on turn2, but didn't finish the swordsman until turn 7. During this time enough iron accumulated and cityA created 2 swordsman with it.

Since cityB already has the iron it needed when it started, it should be immune from iron resource checks so long as it is building said unit. The solution then is to set some useful data when production commences, and use this to hide from the resource check so long as production doesn't change.

In game terms, use scriptdata on the city when production starts to save what it is producing, and then clear it during onUnitCreated. The resource check popup needs to be guarded by comparing the cities current production vs it's saved scriptdata (ie last turns production).
 
I think you may not quite understand how it that I've set it up (or maybe I just don't understand you :crazyeye: ). Perhaps a code snippet will illustrate. :)

Remember that this is still in testing and so it's not been generalized in all cases yet. I've only set it up for one resource for the human player.
Code:
	def onUnitBuilt(self, argsList):
		'Unit Completed'
		self.parent.onUnitBuilt(self, argsList)
		QR.setStockpile('CIVILIZATION_'+str(iPlayer),'iStockpile_1', (QR.getStockpile('CIVILIZATION_'+str(iPlayer),'iStockpile_1') - 10))

	def cannotTrain(self,argsList):
		pCity = argsList[0]
		eUnit = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		bIgnoreUpgrades = argsList[5]
                # QR
		if ((QR.getStockpile('CIVILIZATION_0','iStockpile_1')) - ((gc.getPlayer(pCity.getOwner()).getUnitClassMaking(4)) * 10)) < 0:
			return True
                # End QR
		return False

The values of 10 in there would normally be replaced with the cost of the individual unit. What I have done, on the suggestion of Zebra 9, is program the game to look at how many present units of a certain class are being constructed (in this case a settler) and have it pseudo-deducted from the stockpile. The game does not actually draw from the stockpile until the unit is finished.

I really don't see how a script save of the city production would matter. You can't hide the city from CannotTrain until the production is done because that would foul up the summary of the choices on the menu.
 
Code:
	def onUnitBuilt(self, argsList):
		'Unit Completed'
		self.parent.onUnitBuilt(self, argsList)
		QR.setStockpile('CIVILIZATION_'+str(iPlayer),'iStockpile_1', (QR.getStockpile('CIVILIZATION_'+str(iPlayer),'iStockpile_1') - 10))

	def cannotTrain(self,argsList):
		pCity = argsList[0]
		eUnit = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		bIgnoreUpgrades = argsList[5]
                # QR
[b]                if (pCity.getProductionUnit() != NULL):
                        return True[/b]
		if ((QR.getStockpile('CIVILIZATION_0','iStockpile_1')) - ((gc.getPlayer(pCity.getOwner()).getUnitClassMaking(4)) * 10)) < 0:
			return False
                # End QR
		return False
 
Back
Top Bottom