Possible supply and demand mod?

dexter_inside

Warlord
Joined
Oct 8, 2007
Messages
141
Guys, I've been thinking for some time now, and I think a supply and demand modmod for the "other resources" would be really nice at this point, specifically for later gameplay.

The starting idea: making use of manufactured resource spam, using the stuff in Manufactured_CIV4BonusInfos.xml

Please follow my reasoning on this one, all your comments are welcome!
 
Let's say we add a modifier, iSDTotalCitiesPercentEven that defines the number of cities percent out of your cities that needs to be manufacturing the given resource for its supply/demand ratio to be even.

Code:
<xs:element type="xs:byte" name="iSDTotalCitiesPercentEven" minOccurs="0"/>

If I want to have for e.g. Ammunition supply and demand even out and I have 70 cities, I will need to build 35 filling factories to achieve this.

Code:
	<BonusInfo>
		<Type>BONUS_AMMO</Type>
		<Description>TXT_KEY_BONUS_AMMO</Description>
		<Civilopedia>TXT_KEY_BONUS_AMMO_PEDIA</Civilopedia>
		<BonusClassType>BONUSCLASS_MANUFACTURED</BonusClassType>
		<ArtDefineTag>ART_DEF_BONUS_AMMO</ArtDefineTag>
		<TechReveal>TECH_EXPLOSIVES</TechReveal>
		<TechCityTrade>TECH_EXPLOSIVES</TechCityTrade>
		<TechObsolete>NONE</TechObsolete>
		<iAITradeModifier>10</iAITradeModifier>
		<iAIObjective>0</iAIObjective>
		<iHealth>0</iHealth>
		<iHappiness>0</iHappiness>
		<iPlacementOrder>-1</iPlacementOrder>
		<iConstAppearance>0</iConstAppearance>
		<iSDTotalCitiesPercentEven>50</iSDTotalCitiesPercentEven>
	</BonusInfo>

When I just researched Explosives and built my first filling factory, I will have 1 Ammunition, satisfying ceil(100 * (1 / (TotalCities * iSDTotalCitiesPercentEven)) supply, in the example ceil(100 * 0,0285...) = 3 percent. Let's call it iSupplyPercent and (100 - iSupplyPercent) as iDemandPercent

Let's define a resource supply/demand percent modifier, iSDPercentModifier, to easily allow later tweaking. I assume this can be stored directly per unitclass right after the BonusType, in Civ4UnitInfos.xml ?

Code:
<xs:element type="xs:byte" name="iSDPercentModifier"/>

To accurately represent scarcity of given resource in all the other cities, I want to increase unit costs that need Ammunition by a factor of ceil(iDemandPercent * iSDPercentModifier / 100) , in our case let's assume a 1000 hammer cost for a unit that needs Ammunition. At supply percent equal to 3 the demand will be 97. Assume the percent modifier is 100, you will need 97 percent more hammers, total cost for this unit being built will be 1970. In every city.

By building a second filling factory, ceil(100*2/(70*50)) gives 6 supply and 93 demand. Cost for that unit decreases from 1970 to 1930 hammers.

But what happens when there's more supply than demand? with 5 filling factories in 7 cities you get ceil(100*5/(7*50)) = 143 supply and -43 demand. Take -43 * 100 / 100 = 43 percent less from 1000, which is just 570 hammers! If I want to produce lots of that unit, it's certainly worthwhile building all those.
 
Shouldn't the size of the cities matter?

Actually I'm thinking it's more something to be connected to Size Matters, like this:

Usually after Renaissance I have enough cashflow on 0% tax (coming from my specialist-based economy) and enough hammers (coming from slave specialists) to afford whatever extra % coming from the aforementioned supply and demand cost.

Here we can make use of the excellent Size Down - Split into Companies to reflect the scarcity of supply, like this:

Code:
<PromotionInfo>
	<Type>PROMOTION_SPLIT_INTO_COMPANIES</Type>
	<Description>TXT_KEY_PROMOTION_SPLIT_INTO_COMPANIES</Description>
	<Sound>AS2D_IF_LEVELUP</Sound>
	<LayerAnimationPath>NONE</LayerAnimationPath>
	<PromotionPrereq>NONE</PromotionPrereq>
	<PromotionPrereqOr1>NONE</PromotionPrereqOr1>
	<PromotionPrereqOr2>NONE</PromotionPrereqOr2>
	<TechPrereq>NONE</TechPrereq>
	<bLeader>0</bLeader>
	<iLowestSupplyPercent>5</iLowestSupplyPercent>
	<iHighestSupplyPercent>24</iHighestSupplyPercent>
	<OnGameOptions>
		<GameOptionType>GAMEOPTION_SIZE_MATTERS</GameOptionType>
	</OnGameOptions>
	<ReplacesUnitCombat>UNITCOMBAT_GROUP_BATTALION</ReplacesUnitCombat>
	<bForOffset>1</bForOffset>
	<SubCombatChangeTypes>
		<SubCombatChangeType>UNITCOMBAT_GROUP_COMPANY</SubCombatChangeType>
	</SubCombatChangeTypes>
	<RemovesUnitCombatTypes>
		<RemovesUnitCombatType>UNITCOMBAT_GROUP_BATTALION</RemovesUnitCombatType>
	</RemovesUnitCombatTypes>
	<iGroupChange>-1</iGroupChange>
	<bAltDown>0</bAltDown>
	<bShiftDown>0</bShiftDown>
	<bCtrlDown>0</bCtrlDown>
	<iHotKeyPriority>0</iHotKeyPriority>
	<Button>art/Buttons/UnitCombatClasses/Group4UnitCombat.fw.dds</Button>
</PromotionInfo>

By defining an interval of supply for which the new unit will auto-take this promotion in CIV4PromotionInfos.xml
Should work by adding under <ElementType name="PromotionInfo" content="eltOnly"> from C2C_CIV4UnitSchema.xml something like:

Code:
	<!--Supply and Demand start -->
	<element type="iLowestSupplyPercent" minOccurs="0"/>
	<element type="iHighestSupplyPercent" minOccurs="0"/>
	<!--Supply and Demand end -->

Also on the same reasoning, I would also like to see some national wonders that provide a free Size Up - Merged into Batallions at the expense of consuming several units of resources, if
iNumFreeBonuses works with negative values. Might be worthwhile sacrificing like 5 Ammunitions (that will decrease the supply and increase unit cost) to auto-get this promotion on Gunpowder units.

How would it work if we make something like a Great Armory, that combines FreePromotion with NoBonus for that resource and negative iNumFreeBonuses ?
What kind of DLL changes we need for something like this, if any?
 
Tremendous. There's quite a few considerations one would want to make to design an effective resource supply factor. There are plans but they're pretty far out and nebulous at this point.

I was going to say that just from the first post that the amount of coding effort on something like this would be a truly impressive can of worms that could take a year or two to sort out properly.
 
Top Bottom