SP Native Economy Tweak

Users who are viewing this thread

heu3becteh

Recruit
------------ Economy Tweak mod by heu3becteh ------------

You can download the modification here:

While I like economy the in game, there is still room for improvements to realize its potential. I have tried to make economy in the game even more realistic, logical and interesting.
Demand, supply, prosperity calculation changes. Stocks increased.
Convertion from gold to prosperity introduced, impact of demand on prosperity.
Fixes for unpleasant issues like garrison starvation: prosperity decreases together with food stocks.


tfG37f5.png


---------- List of changes this mod introduces ----------

- Demand needs to be fulfilled. In the unmodified game unfulfilled demand is just disregarded. With this mod it affects prosperity.
- Workshops demand is explicitly taken into account during demand calculation. In the unmodified game demand is defined by prosperity. Since e1.4.1 stock amount matters to some extent too, which helps. But I think that workshops demand is better treated explicitly.
- Prosperity and Wealth (Gold) are linked and could be converted from one to another, no hardcoded artificial town gold spawn-despawn. In the unmodified game town gold is being spawn-despawn depending on prosperity to get closer to gold = prosperity * 7, 20% per day.
- When there is a food shortage, prosperity is decreased before everyone starves to death. In the unmodified game only starvation and death decrease prosperity. With this mod enabled food shortage is additionally increasing the food demand.
- Stocks of everything are increased (raw resource production is increased on 50%, basic demand is halved, equipment demand is increased), with this mod enabled the stocks are generally divided into more or less, and not into absent or present.
- More caravans to transfer increased stock amounts.
- Towns take into account optimal stock amount for the demand (N days worth of demand fulfillment), the price gets higher than default value if the current stock amount less than that, lower if the current stock amount is greater.
Towns consume goods faster when there is a surplus of specific category goods.
Simple logic of price calculation: basic equation is (optimal stock amount + demand + 1) / (actual stock amount + demand + 1), it determines whether price multiplier will be > 1 or < 1. Price multiplier is divided into short-term (calculated for each item purchase taking into account only the current market situation) and long-term (change calculated daily, has some inertia). The same pretty much applies to the unmodified game, but the basic equation is demand / (0.1f * supply + actual stock amount * 0.04f + 2f), where supply is long-term component and actual stock amount is short-term component. There is no particular advantage of the equation used in this mod, but you can note that long-term component is more significant than short-term component. In this mod to disctribute goods better across the map short-term component is more significant.
- Daily changes use another equation, compared to the unmodified game. In the unmodified game inertia is introduced with new = old * 0.85 + new * 0.15 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.
With this mod inertia equation is changed to new = old * (new / old)^0.2, with that equation value can decrease faster depending on the change significance, and it does not increase as fast.


---------------------- Discussion -----------------------

Generally with this 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.
While some conceptual changes may be controversial, this mod addresses some issues that should be addressed in the unmodified game, that way or another.

With this mod economy is alive and can balance itself, without need for hardcoded caps on everything and spawn-despawn of things when situation goes wrong. That pretty much goes for the unmodified game too, this mod does not change core aspect of that, but removes some limits and introduces some new mechanics / applies fixes that could be considered.
I would like to see the economy in the game where everything converst from one form to another, without disappearing and appearing out of nowhere. Sources of wealth would be villages producing raw goods and added value of workshop production, sinks would be destructive actions of men, unfulfilled demands, starvation.
This mod aspires to get closer 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 tests. Things are balanced and if one aspect goes wrong, it will be fixed by other.

While economy gets better and better with patches and has great potential to be interesting without any mod, I hope some solutions from modifications could help to make the unmodified game batter too during development.


------------------- Save Compability --------------------

This mod does not create any additional save data (which makes some things to go different with repeated save-loads), so it should not corrupt the saves.
Some time is required after this mod is enabled for economy to stabilize. This mod changes supply-demand-prosperity, because of that some time will be required after that mod is disabled for things to get stable again without the mod.


-------------------- Mod Compability --------------------

This mod is created with a specific game version in mind. It could not work as intended with other game versions.
Version this mod was build for is indicated in this mod version: 1.*game version*.*mod version for the specific game version*.
If you have installed this mod (version e1.4.1 especially, which introduces notorious addition in GetEstimatedDemandForCategory() method, that is removed in beta 1.4.2 already) with version not compatible, it should not cause major problems (it does not change much and I have tried to add some safety measures). For some cases before I have added this measures, DisableSupplyDemandInertia submod should completely remove all the persistent changes this mod could've caused.

This mod could conflict when other mod replaces (not postfix/prefix) the same methods, which are listed below.
It could conflict with mods dependant on supply variable.
Other from that, it should be pretty much compatible with anything.

- This mod changes methods to estimate supply and demand, but general mechanisms are the same as in the unmodified game, results look similar, except for supply variable, which is town item category stock amount/value with inertia. In this mod that is replaced by multiplier, because when it is called by GetBasePriceFactor() there is no town data indicated.
This mod should not cause problems to pretty much any mod, which do not use supply variable.
This mod will have problems if supply-demand variables will be used to store some other data before it is called.
Changed methods: GetDailyDemandForCategory() replaced, GetSupplyDemandForCategory() replaced, GetBasePriceFactor() replaced, MakeConsumption() replaced, some values are transferred by dictionary to CalculateProsperityChange().
- This mod adds prosperity changes after default as Postfix to have prosperity value more dynamic.
As it is Postfix it should not affect anything, should not cause problems to any mod.
This mod will have problems if prosperity-gold variables will be used to store some other data before it is called.
Changed methods: CalculateProsperityChange() postfix, GetTownGoldChange() replaced.
- This mod adds 50% more production to vilages. CalculateDailyProductionAmount() postfix, which multiplies result by ProductionMultiplier = 1.5.
As it is Postfix it should not affect anything, should not cause problems to any mod.
This mod will have problems if production variables will be used to store some other data before it is called.
Changed methods: CalculateDailyProductionAmount() postfix.
- This mod allows heroes to have up to 2 caravans.
Should not cause problems, it only makes it possible for SpawnCaravans() to return true when hero_OwnedCaravans.Count<MobileParty>() = 1.
Changed methods: SpawnCaravans() replaced.


--------------------- Installation ----------------------

Unpack contents of zip-archive to "...\Steam\steamapps\common\Mount & Blade II Bannerlord\Modules\".

----------------------- Settings ------------------------

You can change the mod settings in "...\Mount & Blade II Bannerlord\Modules\EconomyTweak_h\config.xml" file.

------------------------- Links -------------------------

Topic with the discussion of suggestions regarding economy:
https://forums.taleworlds.com/index...cing-economy-and-how-it-does-work-now.414875/
Mod at Nexus:
https://www.nexusmods.com/mountandblade2bannerlord/mods/1828

22.06.2020
 
Last edited:
A self balancing economy sounds great.
I think it is pretty much included in the game core already (:
There are just some strange behaviours like prosperity-starvation waves, which seem not too hard to fix for me. With a simple changes economy looks quite reasonable for me.
 
Back
Top Bottom