Hearts of Iron IV

Hearts of Iron IV

Not enough ratings
Resource Trading (Dynamic Resource Stockpile Submod)
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
325.952 KB
Jan 16, 2022 @ 10:43am
Jan 28, 2022 @ 6:24pm
3 Change Notes ( view )

Subscribe to download
Resource Trading (Dynamic Resource Stockpile Submod)

Description
ALPHA RELEASE
Adds resource trading to the Dynamic Resource Stockpile system. This is a SUBMOD and requires the Dynamic Resource Stockpile mod to also be installed and active.

The size of the global stockpile depends on the difficulty level selected. At the hardest difficulty, the inventory is 10000 items. At the easiest difficulty, the inventory is 50000 items. This is a soft limit, which prevents non-players from selling or filling the stockpile past this limit. Players can exceed this limit when selling, up to the hard limit (1.5 * soft limit).

The GUI to trade resources can be found by clicking the "Resource Trade" button at the top of the native resource trading window. On the window that pops up, you can buy and sell resources in lots of 100. This small size is necessary to enable proper price movements. If you ctrl-click the buy or sell buttons, you will buy or sell 10 lots (1000 items), and the price will automatically adjust as each lot is sold.

HOW IT WORKS
Countries export items according to their export policy. Most of these resources are never imported by other countries, so what happens to them? This mod uses these excess net exports to create a global stockpile of each resource, and uses "civilian demand" to help stabilize the size of the stockpile around an equilibrium value, which also stabilizes the price to an equilibrium value. Net exports and civilian demand occur each day. Players can trade at any time.

Prices are proportional to how full the stockpile is. A full stockpile will lead to very low prices. A nearly empty stockpile will lead to very high prices. Prices will not change to the new level immediately; instead, they will slide up or down using a moving average of the previous price and the target price. From a role playing perspective, this is a delay caused by the diffusion of pricing information in the economy. From a practical perspective, it allows players to have a more stable price for large transactions, though it will cause immediate repurchases to cost differently that what you sold for, and immediate resales to yield differently than what you paid.

If the stockpile should fall to zero items, the previous day's price will be doubled to encourage selling by the player. This will most likely be encountered in late game when net exports fall to zero. If the stockpile remains at zero, the price will continue doubling each day until it begins to fill again.

Civilian demand is proportional to net exports, so as the stockpile shrinks, civilian demand will fall. When the stockpile is below equilibrium, civilian demand will be less than net exports. When the stockpile is above equilibrium, civilian demand will be more than net exports. This means that civilian demand is a dominant force in maintaining price equilibrium.

Players earn money by selling resources to the stockpile. This money can only be used to buy resources from the stockpile. The usual rule of "sell high, buy low" is a good idea if you don't want to run out of money later. The amount of money you can get will be highest at the beginning of the game when the stockpile begins to grow, but your own country stockpile will not yet be large. The AI will wait until its country stockpiles are full before they begin selling, so you will have a chance to sell at the highest prices.

My modeling of the effects of this mod suggests that money will become your biggest constraint, not the actual availability of resources.

TODO & QUESTIONS FOR PLAYERS TESTING THIS SUBMOD
# TODO: Should we allow stockpiling oil? Buying and selling oil is currently disabled.
# TODO: AI purchases from global stockpile when money is above threshold, country stockpile is below threshold, and price is reasonable. However, could this cause the AI not to use the trade system to import resources as Paradox designed? (Players have a similar issue.) It could also dramatically change prices by making every resource scarce, because nations that do not need a resource will be forced to stockpile it when they would not have traded for it in the first place. This might be countered by checking for trade value > 0 as a clue that stockpiling is needed.
# TODO: Balance the fraction of net exports that is deposited in the global stockpile. (1 - fraction) is "civilian use" of net exports. Civilian use could also be modeled as a random walk, with additional random effects on stockpile level.
# TODO: Balance the stockpile size, including the multiplier based on difficulty setting and the relationship between soft and hard limit.
# TODO: Should we automatically decline purchasing more from the global stockpile than we can hold in our country stockpile? The following day, excess country resources will be deleted, so the purchase might be wasted. However, if we look at this strategically, denying global stockpile resources to another player can be worth the loss.
# TODO: Should we automatically sell excess human player resources the way the AI is programmed to do? Can this be a selectable option in the GUI to turn this on or off at will?
# TODO: Add country stockpile change and limit to trade window. This will make it the only needed window for DRS and DRSRTS.
13 Comments
wizard1073  [author] Jun 12, 2023 @ 5:32pm 
@Ungarn, are you selling an expensive resource to buy a cheap one? Do you find that the price as you sell is not driving down fast enough?
Ungarn Jun 8, 2023 @ 4:59am 
This is a really, really great mod. I wish it would more expensive to buy resources. Right now it's too easy to sell surplus resources to buy others, which I think affects the game balance.
Uno Nov 3, 2022 @ 6:05am 
Thanks for the reply
wizard1073  [author] Nov 2, 2022 @ 6:49pm 
@Uno, unfortunately it is not possible to make the system use convoys. If that were possible, I would add the option of automated periodic purchases, so that you could "dollar cost average" the price to build or deplete a stockpile rather than buy or sell in large blocks, which tends to cause significant price jumps or drops..
Uno Nov 1, 2022 @ 5:44am 
Is it possible to make this system use convoys.
wizard1073  [author] Jan 16, 2022 @ 9:01pm 
I did rename variables in the parent mod in order to put them in a private namespace. I wonder if that prevented it from working properly in an old game. It should just pick up with the new variables, losing the progress from the old variables. Not the preferred action, but should sort itself out after a few in-game months.
wizard1073  [author] Jan 16, 2022 @ 8:58pm 
That's great to hear! Keep kicking the tires! Let me know if you think anything else is not working well, like balance issues and not just errors.
daisy6975 Jan 16, 2022 @ 5:56pm 
Hi, sorry it was that I add the mod to a playset after a couple of days play. Started new game and it worked good. Thanks.
wizard1073  [author] Jan 16, 2022 @ 5:48pm 
@daisy6975 Did it allow you to sell it once you were above 100? In other words, was the problem exactly 100? Alternatively, did you wait at least one day after your national stockpile was above 100 in order to sell? Trying to figure out if this is numeric condition-based or time based.
wizard1073  [author] Jan 16, 2022 @ 5:46pm 
@Davidaf since fuel is not a resource in game that can be traded, I cannot use it within the mod. If oil were to be tradeable, I am not sure how the game would draw down the stockpile to convert to fuel. I will have to test this mechanic if user feedback generally wants oil stockpiling and trading as well.