heu3becteh
Recruit
I like the economy in the game and trade as it is already, but I feel just a little push is still needed for it to be truly alive. Seeing how current updates address the important issues I can assume it will be done the right way without my feedback/suggestion, but maybe it will be of some use nonetheless.
The economy in the game has a great potential to balance itself without hardcoded limitations.
Demand and supply change daily and have inertia, base inertia works like that:
Starting from 1.4.1 (removed in beta 1.4.2, yay) demand is additionally increased on:
So the demand increases when the long-term supply surplus is too big, more than 30% of the current supply. That kinda adds some more inertia, demand/prices will not drop too fast when you sell ridiculous stock amounts to town.
priceFactor is defined as:
where supply is long-term component (it changes daily and has inertia) related to stock amount, inStoreValue is short-term component (changes with every purchase).
While prosperity value is important, it is relatively static: changes are slow, but steady. You are unlikely to have negative prosperity change, unless your town is starving.
That demand is satisfied by surrounding villages with flat value depending on their tier and by food consumed from the market (trade goods with BonusToFoodStores property).
Food has some impact on prosperity. When food storage is full and food change is positive, prosperity will have positive effect of Food Surplus. When food storage is empty and food change is negative, prosperity will have negative effect of Food Shortage.
Decision to not consider workshops explicitly could've been made because:
a) Their demand should not lead to consumption in MakeConsumption(), it should affect the price calculation only.
b) Workshops could be changed by player often, but it is not easily exploited because market has inertia and demand is recalculated daily. And seeing how market will react to your actions is what makes playing with economy fun.
I suggest to create some method for demand addition after base demand depending on prosperity was calculated in GetDailyDemandForCategory().
It could be used to account for some other demands, not only for workshops. Maybe something like tool demands when construction is in progress. There could be AddDemand(Town town, ItemCategory category) method created for pretty much everything and AddPriceDemand(Town town, ItemCategory category) to account for workshops: it will remember the demand added that way to subtract it when MakeConsumption().
In e1.4.1 changes with GetEstimatedDemandForCategory() were introduced, I suggest making this method call some method to check workshop demands at town. In my mod it is done in GetDailyDemandForCategory(). After that I have changed MakeConsumption() to subtract workshop demands (remembered in dictionary) when calculating consumption.
And, as a modder, I would like to request to set all calcultaions outside of protected internal methods when possible. So that GetEstimatedDemandForCategory() would call some other method (which is possible to change) to get the values of change. I had to reverse changes made here in other method. (done in beta 1.4.2)
2. Demands need to be fulfilled. Now town just consumes what is has in stock depending on the demand, but does nothing when there is nothing in stock.
In my mod I have added changes to prosperity depending on demands fulfilled (positive effect on prosperity) or not (negative effect on prosperity).
3. Food demand should increase during food shortage. It will help to:
a) Consume more food that town has on market and better try to prevent starvation.
b) Increase prices to indicate that town needs more food bringed by caravans, to indicate that town do not want caravans to buy food there now.
In my mod there is a check for town.FoodChange in GetDailyDemandForCategory().
4. Demand could be tuned for stocks to be better distributed. Now in game many things balance around 0, which is not very good. There generally should be more stocks in game for economy to have material to work with.
In my mod raw resource production is increased on 50%, basic demand is halved, equipment demand is increased (increases equipment prices and reduces equipment stock surplus), stocks are generally divided into more or less, and not into absent or present.
And to transfer these increased stocks caravans should carry more or their quantity should be increased.
5. Inertia equation could be changed to work better both sides.
Now inertia is introduced with
equation. It has a downside that value increases faster than decreases. Because of that if you will sell large (the larger the more significant that effect is) amounts of trade good to town, wait for daily changes to take place and then buy it back, inertia equation could increase the value significantly in one day, but than decrease it linearly on 15% maximum. And nobody will sell these goods for low price to the town that has high demand for it really. Caravans can even buy food from a starving town because it is cheap.
Change made in GetEstimatedDemandForCategory() may help with that, but I suggest changing the inertia equation itself.
In my mod inertia equation is changed to
with that equation value can decrease faster depending on the change significance, and it does not increase as fast.
Now it is like that:
If long-term component is big, short-term component has less of an impact even when reaching 0. Bacause of that it is often makes sense to buy all the stock from town, to sell all the stock to town. That makes supply fluctuations fast and large. And it does make sense for a town merchants to sell the last of the goods in town for higher price. Especially if demands need to be fulfilled and are not disregarded. And it does not make much sense for town merchants to buy ridiculous amounts of goods that will drop in price on the next day.
You can see that long-term and short-term components work separately, they are added, not multiplied.
In my mod price is calculated like:
where optimal stock amount is N days worth of demand. Long-term and short-term components work together, they are multiplied to form priceFactor. Short-term component influence is more than long-term, so all towns aspire to have at least some of goods to satisfy their demands, that helps to distribute goods better.
For a long time I suggest for prosperity to decrease with food stocks. The closer stocks are to 0, the faster it decreases.
In my mod following equation for prosperity change is used during food shortages:
where FoodShortageProsperityExpValue = 0.5 (default), FoodDeficiency:
Towns will aspire to have stocks more than Prosperity / 50 + FoodChange * OptimalStockPeriodFood.
That change is capped at 5% of prosperity, so town could still starve during sieges and in some peculiar conditions, when all the food from market is suddenly bought and garrison is large, for example.
With my mod demands are checked after consumption is done and affect the prosperity positively or negatively.
When item is consumed, not only its price is added to town gold, but also the default value of trade good category items is added to prosperity. So fulfillment of demands not only transfer wealth from one form to another, but brings the new wealth.
I used default values of trade goods here, because felt it would not be right to bring market price fluctuations to flat prosperity value.
Also I did use default values when determining demand in number of items to consume: it would be strange when you demand 100 denars worth of grain, be it 1 grain or 20 grain depending on price variations. You demand set amound of grain you want to eat, and market makes it possible or not. Demand is calculated using default values to begin with. So I think default values should be used when converting demand from value to item count in MakeConsumption().
That change is somehow controversial, because it will make town to gain more gold when prices are higher, and it could later become prosperity too.
In my mod I linked town gold with prosperity, so that it converts from one to another with 1 prosperity = 100 gold ratio.
Generally with mod enabled prosperity changes faster, which makes economy more dynamic. But, while fluctuations are faster, they are approaching equilibrium state, which could be stable enough, but not static.
Sources of wealth would be villages producing raw goods and added value of workshop production, fulfilled demands, sinks would be destructive actions of men, unfulfilled demands, starvation.
System could stay close to the current one:
In brackets indicated remote transfer, without them - it needs to be delivered by a party.
Villagers take produced raw resources, bring them to city for gold. That gold is then returned to village and paid as tax, surplus is gradually convetred to hearths (if village have no gold to pay taxes, it pays with hearths). Some of villagers remain at town as recruits (they fill recruit positions immediately). Villagers bring back to treir village tools, simple cloting, simple weapons, simple armour, some other goods in demand. These goods are gradually converted to hearths.
Prosperity in towns could be gradually converted to gold and back, is linked to market and food situation (as described above). Towns and castles send militia patrols to bring security to surrounding villages.
Lords could not only raid villages and siege fortifications, but invest some gold too.
Some additional sources of demands could be added: tools are in greater demand duting construction (their consumption speeds up construction speed), equipment/weapons are in greater demand when many recruits are spawned (recruits may require consumption of higher level equipment to have higher level).
Seasonal changes of demand and production could be introduced: hardwood is in greater demand during snowy time, grapes are growing better during summer.
With flexible demand and price formulation economy will reach stable conditions when no events of significance are changing them them and will adapt to ocurring events, possibly reaching other stable conditions.
These conditions will have fluctuations, but they should be reasonable: not the long period of inevitable prosperity growth and the long period of inevitable starvation. Things should be able to fluctuate without such extremes.
To make interacting with economy even more interesting, there may be a way to change village production. For example, adding secondary village production, which player can choose and invest in. For every village there may be efficiency coefficients for different production types.
I believe there should be no restrictions for player to own many workshops (especially at owned fiefs). Or at least there should be much more of them for high-level clan. There could be income penalty for workshops when you have too many of them.
For the cases when the player will have too much of an income, some additional gold sinks could be added: player can increase village production/prosperity for gold, train recruits better, start feasts, festivals, tournaments, gain more influence, invest in new clan formation for your companions, militia training, road maintainance, there could be many ways.
If things will be consistent, economy will be alive and will be able to balance itself without need for hardcoded caps on everything and spawn-despawn of things when situation goes wrong. Economy in game is potentially close to that.
Maybe without limitations and spawn-despawn of neccessary things something can be broken, but I do not see a way for that to happen (unless there is kinda bug) and did not experience anything of sort during the tests of my mod. Things are balanced and if one aspect goes wrong, it will be fixed by other.
One more note about stable conditions - I believe there should no be one-way forward progress, there should always be fluctuations back and forth. Now as I get it from the beginning you have less bandits, you have towns without structures. And while in-game timer passes structures are build, you have more and more bandits and prosperity at towns. I think there should be not only sources, but sinks for everything. For example, sieges could destroy structures at town, bandit spawn could be dependant on security/smth, not on days passed from campaign initialization.
There could also be more economy-related diplomacy and policies, like rights for caravans to pass through the lands of kingdom, trade with its towns.
There could be small "neutral" caravans which do not belong to any kingdom, sort of like merchant mercenaries.
Generally there could be more stocks and more caravans transferring them.
While economy gets better and better with patches and has great potential to be interesting without my suggestions, I hope some solutions from modifications and community could help to make the unmodified game batter too during development.
My previous suggestions and tests in that message.
Best regards.
The economy in the game has a great potential to balance itself without hardcoded limitations.
~ How it does work now ~
Supply and demand
Base demand is linearly dependant on prosperity (for Luxury goods on prosperity - 3000). Supply is dependant on stock amounts.Demand and supply change daily and have inertia, base inertia works like that:
Code:
new = old * 0.85 + new * 0.15
Code:
0.1f * Math.Max(0f, categoryData.Supply - dailyDemandForCategory - 0.3f * (float)categoryData.InStoreValue)
Price
Generally your price is defined like ItemValue * priceFactor, where priceFactor is limited to 0.2-10 for IsTradeGood and IsAnimal, 0.8-1.3 for others. Trade penalty is added too (both ways, when you sell and when you buy).priceFactor is defined as:
Code:
MathF.Pow(demand / (0.1f * supply + inStoreValue * 0.04f + 2f), 0.5f)
Prosperity
Town has prosperity property, which single-handedly defines many things: demand, consumption, town gold amounts.While prosperity value is important, it is relatively static: changes are slow, but steady. You are unlikely to have negative prosperity change, unless your town is starving.
Food
Food demands defined by prosperity and garrison. Prosperity impact is usually greater: 1 food for 50 prosperity.That demand is satisfied by surrounding villages with flat value depending on their tier and by food consumed from the market (trade goods with BonusToFoodStores property).
Food has some impact on prosperity. When food storage is full and food change is positive, prosperity will have positive effect of Food Surplus. When food storage is empty and food change is negative, prosperity will have negative effect of Food Shortage.
Consumption
Items are consumed from the market depending on their demand (demand defined in default value of item category). When item from market is consumed, its market price is added to town gold.Gold
Town gold is soft-capped at 7 * prosperity. Gold is getting close to that value 20% of difference per day.~ What could be improved ~
I did make a mod to address some issues and to demonstrate some of my suggestions: Economy TweakEconomy Tweak
Configurable changes to demand, supply, price calculation.Inevitable starvation issue fixed: sustainable prosperity values related to food supplies.Economy tuning is possible using 'config
www.nexusmods.com
Supply and demand
1. Workshop demands could be taken into account (for price calculation). It was a problem that lead me to suspect something is working strange with economy: towns with higher prosperity clearly had more demand for raw resources than towns with workshops, because of that some workshops were unable to make production.Decision to not consider workshops explicitly could've been made because:
a) Their demand should not lead to consumption in MakeConsumption(), it should affect the price calculation only.
b) Workshops could be changed by player often, but it is not easily exploited because market has inertia and demand is recalculated daily. And seeing how market will react to your actions is what makes playing with economy fun.
I suggest to create some method for demand addition after base demand depending on prosperity was calculated in GetDailyDemandForCategory().
It could be used to account for some other demands, not only for workshops. Maybe something like tool demands when construction is in progress. There could be AddDemand(Town town, ItemCategory category) method created for pretty much everything and AddPriceDemand(Town town, ItemCategory category) to account for workshops: it will remember the demand added that way to subtract it when MakeConsumption().
In e1.4.1 changes with GetEstimatedDemandForCategory() were introduced, I suggest making this method call some method to check workshop demands at town. In my mod it is done in GetDailyDemandForCategory(). After that I have changed MakeConsumption() to subtract workshop demands (remembered in dictionary) when calculating consumption.
2. Demands need to be fulfilled. Now town just consumes what is has in stock depending on the demand, but does nothing when there is nothing in stock.
In my mod I have added changes to prosperity depending on demands fulfilled (positive effect on prosperity) or not (negative effect on prosperity).
3. Food demand should increase during food shortage. It will help to:
a) Consume more food that town has on market and better try to prevent starvation.
b) Increase prices to indicate that town needs more food bringed by caravans, to indicate that town do not want caravans to buy food there now.
In my mod there is a check for town.FoodChange in GetDailyDemandForCategory().
4. Demand could be tuned for stocks to be better distributed. Now in game many things balance around 0, which is not very good. There generally should be more stocks in game for economy to have material to work with.
In my mod raw resource production is increased on 50%, basic demand is halved, equipment demand is increased (increases equipment prices and reduces equipment stock surplus), stocks are generally divided into more or less, and not into absent or present.
And to transfer these increased stocks caravans should carry more or their quantity should be increased.
5. Inertia equation could be changed to work better both sides.
Now inertia is introduced with
Code:
new = old * 0.85 + new * 0.15
Change made in GetEstimatedDemandForCategory() may help with that, but I suggest changing the inertia equation itself.
In my mod inertia equation is changed to
Code:
new = old * (new / old)^0.2
Price
Price calculation in game generally does its job. There is a long-term and short-term component, it makes goods cheaper where there is a surplus, more expensive where there is a shortage. But I suggest rebalancing relative impact of short-term and long-term components.Now it is like that:
Code:
demand / (0.1 * long-term supply + short-term supply * 0.04 + 2)
You can see that long-term and short-term components work separately, they are added, not multiplied.
In my mod price is calculated like:
Code:
(optimal stock amount + demand + 1) / (actual stock amount + demand + 1)
Food
I feel that is so strange that notorious garrison starvation problem still persists.For a long time I suggest for prosperity to decrease with food stocks. The closer stocks are to 0, the faster it decreases.
In my mod following equation for prosperity change is used during food shortages:
Code:
MathF.Clamp(FoodChange - MathF.Pow(-Math.Min(0f, FoodDeficiency), globalConstants.FoodShortageProsperityExpValue), -TownProsperity * 0.05f, 0f)
Code:
FoodStocks + FoodChange * globalConstants.OptimalStockPeriodFood - TownProsperity / 50
That change is capped at 5% of prosperity, so town could still starve during sieges and in some peculiar conditions, when all the food from market is suddenly bought and garrison is large, for example.
Consumption
Now the town just consumes part of items on its market depending on demand. When there is nothing to consume, nothing is done, category demand is not even considered when there is not a single item of that category on the market.With my mod demands are checked after consumption is done and affect the prosperity positively or negatively.
When item is consumed, not only its price is added to town gold, but also the default value of trade good category items is added to prosperity. So fulfillment of demands not only transfer wealth from one form to another, but brings the new wealth.
I used default values of trade goods here, because felt it would not be right to bring market price fluctuations to flat prosperity value.
Also I did use default values when determining demand in number of items to consume: it would be strange when you demand 100 denars worth of grain, be it 1 grain or 20 grain depending on price variations. You demand set amound of grain you want to eat, and market makes it possible or not. Demand is calculated using default values to begin with. So I think default values should be used when converting demand from value to item count in MakeConsumption().
That change is somehow controversial, because it will make town to gain more gold when prices are higher, and it could later become prosperity too.
Gold
Now town gold is spawned and despawned too easily. It appears from nothing and disappears to nowhere.In my mod I linked town gold with prosperity, so that it converts from one to another with 1 prosperity = 100 gold ratio.
Generally with mod enabled prosperity changes faster, which makes economy more dynamic. But, while fluctuations are faster, they are approaching equilibrium state, which could be stable enough, but not static.
~ Discussion ~
I would like to see the economy in the game where everything converts from one form to another, without disappearing and appearing out of nowhere, conservation laws are being followed.System could stay close to the current one:
Villagers take produced raw resources, bring them to city for gold. That gold is then returned to village and paid as tax, surplus is gradually convetred to hearths (if village have no gold to pay taxes, it pays with hearths). Some of villagers remain at town as recruits (they fill recruit positions immediately). Villagers bring back to treir village tools, simple cloting, simple weapons, simple armour, some other goods in demand. These goods are gradually converted to hearths.
Prosperity in towns could be gradually converted to gold and back, is linked to market and food situation (as described above). Towns and castles send militia patrols to bring security to surrounding villages.
Lords could not only raid villages and siege fortifications, but invest some gold too.
Some additional sources of demands could be added: tools are in greater demand duting construction (their consumption speeds up construction speed), equipment/weapons are in greater demand when many recruits are spawned (recruits may require consumption of higher level equipment to have higher level).
Seasonal changes of demand and production could be introduced: hardwood is in greater demand during snowy time, grapes are growing better during summer.
With flexible demand and price formulation economy will reach stable conditions when no events of significance are changing them them and will adapt to ocurring events, possibly reaching other stable conditions.
These conditions will have fluctuations, but they should be reasonable: not the long period of inevitable prosperity growth and the long period of inevitable starvation. Things should be able to fluctuate without such extremes.
To make interacting with economy even more interesting, there may be a way to change village production. For example, adding secondary village production, which player can choose and invest in. For every village there may be efficiency coefficients for different production types.
I believe there should be no restrictions for player to own many workshops (especially at owned fiefs). Or at least there should be much more of them for high-level clan. There could be income penalty for workshops when you have too many of them.
For the cases when the player will have too much of an income, some additional gold sinks could be added: player can increase village production/prosperity for gold, train recruits better, start feasts, festivals, tournaments, gain more influence, invest in new clan formation for your companions, militia training, road maintainance, there could be many ways.
If things will be consistent, economy will be alive and will be able to balance itself without need for hardcoded caps on everything and spawn-despawn of things when situation goes wrong. Economy in game is potentially close to that.
Maybe without limitations and spawn-despawn of neccessary things something can be broken, but I do not see a way for that to happen (unless there is kinda bug) and did not experience anything of sort during the tests of my mod. Things are balanced and if one aspect goes wrong, it will be fixed by other.
One more note about stable conditions - I believe there should no be one-way forward progress, there should always be fluctuations back and forth. Now as I get it from the beginning you have less bandits, you have towns without structures. And while in-game timer passes structures are build, you have more and more bandits and prosperity at towns. I think there should be not only sources, but sinks for everything. For example, sieges could destroy structures at town, bandit spawn could be dependant on security/smth, not on days passed from campaign initialization.
There could also be more economy-related diplomacy and policies, like rights for caravans to pass through the lands of kingdom, trade with its towns.
There could be small "neutral" caravans which do not belong to any kingdom, sort of like merchant mercenaries.
Generally there could be more stocks and more caravans transferring them.
While economy gets better and better with patches and has great potential to be interesting without my suggestions, I hope some solutions from modifications and community could help to make the unmodified game batter too during development.
My previous suggestions and tests in that message.
Best regards.
Last edited: