• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Zsar1

Major
52 Badges
Dec 19, 2014
659
199
  • Arsenal of Democracy
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Darkest Hour
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Death or Dishonor
  • Age of Wonders III
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Crusader Kings II: Holy Fury
  • Battle for Bosporus
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Stellaris
  • Europa Universalis IV
  • Victoria 2
  • Europa Universalis III: Collection
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Way of Life
  • Stellaris Sign-up
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Stellaris: Megacorp
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Divine Wind
  • Heir to the Throne
  • Stellaris: Synthetic Dawn
  • King Arthur II
  • Stellaris - Path to Destruction bundle
Something I put together for post-0.70, currently testing for side effects.
I thought I should share it even while still waiting for 0.70, as the system is pretty simple and yet far-reaching, which makes me wonder why no one else had thought this up (And mayhap someone had and failed?) before.

Explanation for modders:
core_AI_trade.txt
Code:
event = {
  id = 35401 # subject to change; For testing with 0.68.2 build, I took the first free IDs I stumbled upon.
  random = no 
  persistent = yes

  trigger = {
    ai = yes
    NOT = {
      ispuppet = -1 # going to expand into distinct puppet / non-puppet constraints later
      # Puppets need slightly higher trade values as they can only buy from overlord.
      # They also need vastly smaller stockpile values for everything but oil as they can only ever store 1000 units.
      local_flag = Trade_Energy_Neutral # not pertaining to functionality, only prevents continuous triggering
    }
    # medium stockpile; numbers subject to change
    OR = {
      AND = {
        NOT = { energy = 45000 } # 150 IC five months
        energy = 28500 # 150 IC three months + five days
      }
      AND = {
        NOT = {
          ic = 51
          energy = 15000 # five months
        }
        energy = 9500 # three months + five days
      }
      AND = {
        NOT = {
          ic = 31
          energy = 9000 # five months
        }
        energy = 5900 # three months + five days
      }
      AND = {
        NOT = {
          ic = 11
          energy = 3000 # five months
        }
        energy = 1900 # three months + five days
      }
    }
  }

  name = "AI: Neutral Energy Pricing"
  style = 0

  # Every one of these events gets a different day of the month but all share their frequency, so they will never overlap.
  date = { day = 3 month = january year = 1936 }
  offset = 29
  # probably going to increase to two months;
  # -1 to spread over all the days in a month (3rd; next 2nd; next 1st; etc.)
  deathdate = { day = 29 month = december year = 1954 }

  action_a = {
    name = "Energy Prices stabilise"
    command = { type = ai which = "switch/Trade_Energy_Neutral.ai" }
    # four tiers of resource pricing in this implementation (others omitted here but can be guessed from flag names)
    # Flags are not actually necessary but prevent successive triggering of the same event once per month.
    # They also allow to switch the system on and off for individual countries and resource types,
    # by setting all the flags of a type simultaneously (and clearing all of them to reactivate).
    command = { type = local_clrflag which = Trade_Energy_Sell }
    command = { type = local_setflag which = Trade_Energy_Neutral }
    command = { type = local_clrflag which = Trade_Energy_Buy1 }
    command = { type = local_clrflag which = Trade_Energy_Buy2 }
  }
}
Trade_Energy_Neutral.ai
Code:
# only replaces this value; leaves all other contents of the trade block intact
trade = {
  energy = 1.0 # subject to change
  # Prices used here have been arbitrarily chosen to be 0.8 / 1.0 / 1.5 / 2.0 times
  # base value from resource_values.csv.
}
Total expenditure:
  • A constant number of events: for each resource type desired x the number of pricing tiers desired y(x)
    The current test implementation uses x = 4 (energy, metal, rare_materials, oil) and y = 4 (see comment in Trade_Energy_Neutral.ai).
  • A constant number of AI files: one file per event from above
  • One event trigger check per day for as many days per month as there are events
    But possibly per just every second month may suffice.
Explanation for non-modders:
A constant number of events monitor the resource stockpiles of all the AI countries in the world.

Once a country attains a sufficiently large stockpile, it will make the ressource in question cheaper, to facilitate export deals which help it with supplies and money (or import of different resources).
Conversely, when stockpiles dwindle, countries increase the price of the resources in question to facilitate import, as importing even at double the base price is usually better than losing IC.
Inbetween these behaviours, countries maintain average prices, at which anyone may buy from and sell to everyone else freely.
This system allows countries to pay over-average prices for resources they really need - but also to recognise these trades as unprofitable as soon as their need passes and cancel those quickly.

Countries which attain large stockpiles through looting or simple passing of time (GER, ENG) will now be more willing to share this bounty with their allies and actually use the resources for something useful (such as trading for supplies - or resources from less bountiful stockpiles).
Similarly, countries which find themselves in a shortage unforeseen by the developer can now react. - Currently such countries would be stuck with trade values insufficient to solve the problem (I saw a JAP out of energy; CORE JAP is set to always trade energy for only 4/5 base price and usually it does have enough to warrant this setting).

However, there is no loss of control involved, as the system as presented can be overridden at any time by setting all the flags simultaneously. So, a custom AI file can still tell e.g. GER to import oil and rares no matter what, before it goes to war against almost all the oil producing world.

... AoD AI is a fickle thing though (I discovered a new AI bug two days ago; oh the joy), so this may still not work out as desired (but preliminary tests look good).
There obviously needs to be more fine tuning in the trigger than presented here (indeed I already use more complex conditions for rare_materials), but that is certainly not a problem.

Latest version:
View attachment CORE2_0.70_DynamicTradeValuesRC3_Zsar.zip
 
Last edited:

dec152000

Colonel
1 Badges
Feb 25, 2006
908
1
  • Arsenal of Democracy
Hi,

I'd previously tried something like this, but with less detail. At the time I didn't get the immediate results desired and did not pursue it much further. This seems like a good path to try. The trick is setting target levels and values correctly. Also of note, the economic system just does't work "right" in a lot of respects. You can't outbid a current trade. So be careful canceling trades for resources that are structurally required imports.

mm

mm
 

Zsar1

Major
52 Badges
Dec 19, 2014
659
199
  • Arsenal of Democracy
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Darkest Hour
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Death or Dishonor
  • Age of Wonders III
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Crusader Kings II: Holy Fury
  • Battle for Bosporus
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Stellaris
  • Europa Universalis IV
  • Victoria 2
  • Europa Universalis III: Collection
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Way of Life
  • Stellaris Sign-up
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Stellaris: Megacorp
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Divine Wind
  • Heir to the Throne
  • Stellaris: Synthetic Dawn
  • King Arthur II
  • Stellaris - Path to Destruction bundle
Testing so far has shown that just providing static intervals regardless of available IC considerably deteriorates the trade activity of a fresh start (as it effectively takes all small net exporters out of the game for years).

I have since then introduced tiers of 10, 30, 50 and 150 IC and set the thresholds to 2, 3 and 5 months of supply for these IC values; this latest change has already shown a couple of promising effects, for one JAP cancelled its rare materials exports to MAN and later re-established them when it went from critical to low stockpile. Also, ITA scraped by on very low but still sufficient stockpiles for the entire pre-war period; this one country is even more prone to run out of something (because it may run out of anything) than JAP.
This latest adjustment needs some more testing, but at least it does not seem capable of providing worse results than the status quo.

Also needs long term testing before I know whether any additional tiers would be sensible; candidates would be 250 (FRA, GER, SOV) and 400 IC (ENG, GER, USA), but the few countries affected are not exactly prone to run out of anything in the first place.
The time intervals look good, the stockpile sizes look good with one notable exception, which is right at the scenario start.

Overall I have a good feeling about this. No nasty bugs which we did not know about previously have risen so far this time.
 

dec152000

Colonel
1 Badges
Feb 25, 2006
908
1
  • Arsenal of Democracy
Hi,

One rain on the parade issue is that the 0.70 file set has a tighter Resource setting than 0.62 does. IMO something crept into the design along the way and Resources got too plentiful. So I dialed them back a bit. Particularily Metal, Which just piled up unendingly in 0.62 games. This caused a lot of issues with trading for me in my initial tests. I think it is working now. but it took a lot of tweaking to the initial file set. So expect more issues with 0.70 when you start working that set.

mm
 

Dichromate

Colonel
46 Badges
Aug 13, 2009
1.143
2
  • Darkest Hour
  • Europa Universalis III Complete
  • Divine Wind
  • Arsenal of Democracy
  • Victoria: Revolutions
  • Hearts of Iron III Collection
  • Heir to the Throne
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Galaxy Edition
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Stellaris: Galaxy Edition
  • Stellaris: Federations
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Stellaris: Megacorp
  • Europa Universalis IV: Golden Century
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Victoria 2
  • Stellaris: Galaxy Edition
  • 500k Club
  • Europa Universalis IV: El Dorado
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
Just a opinion, but insofar as game balance is concerned I don't really think resources should really be that tight for the allies as long as they're able to trade openly with one another, with the exception of rares.

The OP idea sounds awesome though.
 

Zsar1

Major
52 Badges
Dec 19, 2014
659
199
  • Arsenal of Democracy
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Darkest Hour
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Death or Dishonor
  • Age of Wonders III
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Crusader Kings II: Holy Fury
  • Battle for Bosporus
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Stellaris
  • Europa Universalis IV
  • Victoria 2
  • Europa Universalis III: Collection
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Way of Life
  • Stellaris Sign-up
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Stellaris: Megacorp
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Divine Wind
  • Heir to the Throne
  • Stellaris: Synthetic Dawn
  • King Arthur II
  • Stellaris - Path to Destruction bundle
One rain on the parade issue is that the 0.70 file set has a tighter Resource setting than 0.62 does. IMO something crept into the design along the way and Resources got too plentiful. So I dialed them back a bit.
I am all in favour of that change as I noticed the same problem. The people who had the RL2Game resource tables are gone, I fear, but we can still work on the basis of desired outcomes.
... GER becoming self-sufficient in rares come 1941 is not desired.

That written, I think the stockpiles at scenario start could use some padding as a couple of countries start with less than a month of reserve and this coflicts rather drearily with this design here, which uses stockpile to determine sellers (because events cannot check for net change).

--

Another thought I have had for a while, however, is that several countries which seemed to heavily invest into expansion of their industry during the war (most prominently ENG, GER, SOV) do not do so in CORE. If they would, of course global resource consumption would increase as well.
- To that lenght, I have done some preliminary testing regarding the "ic_at_war" and "force_ic_until" values and found that the latter only regards net change (that is, including surplus from trade), which is promising.
Unfortunately, the AI is not interested in actually procuring surpluses of IC resources.

If however, the system presented here would be implemented, we could still use the flags set therein to additionally switch force_ic_until and mayhap attain a similar effect to proper AI "expand if viable" strategy.

Going in this direction may have additional benefits; the extensive infrastructure work of germany and its strain on workforce and materials is currently completely unrepresented.
Of course, as AoD AI handles its construction ratio to military builds autonomously (with the "max_factor" unlike in HoI2:A indeed only an upper bound and nothing more), the effect may end up being not worth it.

For now, reducing the resource availability seems to be the best course of action; should any part of this paragraph somewhen come true, we can always dial them back up.
 
Last edited:

dec152000

Colonel
1 Badges
Feb 25, 2006
908
1
  • Arsenal of Democracy
Hi,

WRT to GER the main issue they end up facing in CORE is running out of MP. So any added IC really doesn't do much to help them later in the game. I've been tweaking this aspect for 0.70 so we'll see where it goes. SOV could probably use even more IC if they had it. OTOH, the Plan events do cover a lot of the pre-war period and they are tilted toward Siberian development more than IRL. Plus the Moving Industry events are very helpful to the SOV and lack some of the RW downsides. So not sure they need more IC to perform historically. ENG not so sure.

mm
 

Zsar1

Major
52 Badges
Dec 19, 2014
659
199
  • Arsenal of Democracy
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Darkest Hour
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Death or Dishonor
  • Age of Wonders III
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Crusader Kings II: Holy Fury
  • Battle for Bosporus
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Stellaris
  • Europa Universalis IV
  • Victoria 2
  • Europa Universalis III: Collection
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Way of Life
  • Stellaris Sign-up
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Stellaris: Megacorp
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Divine Wind
  • Heir to the Throne
  • Stellaris: Synthetic Dawn
  • King Arthur II
  • Stellaris - Path to Destruction bundle
Indeed. I have wondered whether the giant production increases from mobilisation events can be seen as realistical. Currently, we have effective IC increase in huge jumps incident with mobilisation phases, whereas the RL output (of germany, someone else must speak for the other countries) rised much more continuously. From gut feeling, I would say that everything before "Mobilisation" is fine, but then things grow a bit over the top.

Also note that resource extraction is affected by these events as well. Ironically, I have found rare materials to be indeed rare - right until the war in europe starts; and then they are plentiful. Similarly, GER tends to have a net deficit in energy 1937-1938, but as soon as the war starts net income jumps to 100+.
 

dec152000

Colonel
1 Badges
Feb 25, 2006
908
1
  • Arsenal of Democracy
`Hi,

I won't claim our economic model is perfect. However, I think it is ballpark for what really happened. Most of the jump represents conversion from civilian to military economics. A smoother ramp up would be better. But we don't fully model the reserve units and those soak up a lot of IC from that initial surge in production.

WRT to Rares, this happens because they are concentrated in unmobilized economies initially. Once everyone mobilizes there are more available. Plus some events strip away some IC in Europe. so there is actually a slight loss in IC. As for the Energy situation, GER is borderline until mobilized due to all those initial trades (some with future enemies). But once at war it's got plenty.

mm
 

Kennelly

Captain
50 Badges
May 6, 2003
307
10
Visit site
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Third Rome
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Europa Universalis IV: Golden Century
  • Imperator: Rome
  • Stellaris - Path to Destruction bundle
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Battle for Bosporus
  • Europa Universalis 4: Emperor
  • Stellaris: Nemesis
  • Hearts of Iron IV: By Blood Alone
  • Hearts of Iron IV: No Step Back
  • Rome Gold
  • Arsenal of Democracy
  • Hearts of Iron II: Armageddon
  • Cities in Motion
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Deus Vult
  • Europa Universalis IV
  • For The Glory
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Ancient Space
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • 500k Club
  • Crusader Kings II: Horse Lords
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Rights of Man
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
As I don't know anything about oil production back then: Both as GER+especially JAP I imported huge amounts of oil from Venezuela so I didn't really have any oil problem, were they such a big producer back then?
 

dec152000

Colonel
1 Badges
Feb 25, 2006
908
1
  • Arsenal of Democracy
Hi,

Our Resource files are about as accurate as possible. There is a giant spreadsheet detailing RW production amounts and the exact composition of each Resource "basket" by nation. Specifically, Venezuela produced quite a bit of oil in this time frame with a lot of it being refined in Dutch Curacao. Realistically VEN should embargo the Axis once USA is at war with them. Otherwise USA probably should DOW them.

mm
 

Zsar1

Major
52 Badges
Dec 19, 2014
659
199
  • Arsenal of Democracy
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Darkest Hour
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Death or Dishonor
  • Age of Wonders III
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Crusader Kings II: Holy Fury
  • Battle for Bosporus
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Stellaris
  • Europa Universalis IV
  • Victoria 2
  • Europa Universalis III: Collection
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Way of Life
  • Stellaris Sign-up
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Stellaris: Megacorp
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Divine Wind
  • Heir to the Throne
  • Stellaris: Synthetic Dawn
  • King Arthur II
  • Stellaris - Path to Destruction bundle
I have chosen as limits the following:

Four levels of pricing:
  • 80% of base price (sell surplus)
  • base price (maintain current level)
  • 150% of base price (increase imports)
  • 200% of base price (aggressively import)
Triggers for all the IC-maintaining resources are:
  • five months of full production remaining
  • three months
  • two months
  • any less
To prevent ping-ponging, any lower bound provided contains 5 extra days of full production compared to the corresponding upper bound.
(So, the lower bound for normal pricing will in fact check for three months + 5 days, whereas the upper bound for buying at a higher price indeed checks for exactly three months of stock.)

These are provided for four different levels of IC (intermediate countries are always included in the next higher level):
  • unlimited (calculated as 150 IC)
  • 50 IC
  • 30 IC
  • 10 IC
Rare Materials, due to their - hè - rareness, have an additional modifier for countries above 50 IC: those subtract one month from all their Rare Materials limits once they are at war.

For oil the trigger is currently much simpler, it only checks for static levels currently:
  • 100000
  • 50000
  • 25000
  • any less
With a static difference of 200 between corresponding lower and upper bounds.

This actually works well enough, as most countries do not spend any oil (so they eventually will have enough) and currently non-operating oil-consumers consume very little. - That will probably change when dec152000 increases this consumption, but luckily I am ready to adapt:
The next iteration will check different oil levels dependent on the Development Level minister.

Puppets should statically be set to trade at increased or aggressive price, so they can buy the resources they need as long as their master has enough, but at the same time do not try to sell resources they would otherwisely gift.
Indeed, I plan to modify the events accordingly so that a country upon becoming a puppet will automatically switch to aggressive (or increased) pricing, and then can return to normal if freed.

... As this thing worked out so well, we could include it as-is into 0.70. The alternative would be to wait for the increased peace-time consumption and following tests on more elaborate oil triggers as outlined in the last paragraph. I do not recommend to implement the system partially (that is: for IC-resources but not for oil), as then the relative price of oil may move in unwanted directions.
 
Last edited:

dec152000

Colonel
1 Badges
Feb 25, 2006
908
1
  • Arsenal of Democracy
Zsar,

I still like the basic concept a lot. But I've got some different ideas as well:

1. How did you get the 5 month target level? If this is based off the hard code I understand. But if not it seems excessive. Most nations only need to import a relatively small percentage of consumption. So a 5 month stock may be more like a 2 year stock. At this point I'd think less is better.

2. Pricing. IMO the price changes are too big. As a player I'd really question paying double for anything. Do we need that much variation to get the desired effect?

3. Structure. IMO we really don't need to model this for every Tag. On that basis, what we really need is fully custom events for the main players in the global economy. There are roughly 30 Tags with more than 10 IC. The ones below that point could probably get by with customized static values that reflect their structural import/export situation. Even some of the bigger countries (10-50) could probably just have customized static values. The place I really want to see results is on the key nations. As they represent one side of almost all of the transactions. So the Big 7 plus some of the other relatively influential economies. By going to custom events for these nations we get a lot better fidelity. We can directly model the real IC being supported. And we can model the structural import/export position rather than simply shooting for same size stockpiles. While this does bulk up the code it eliminates a vast number of Trigger checks. So we could use a somewhat shorter Offset as well.

4. Puppets: IMO they really don't matter other than setting the aggressive trade level. I'm not even sure they can initiate trades when AI.

mm
 

Zsar1

Major
52 Badges
Dec 19, 2014
659
199
  • Arsenal of Democracy
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Darkest Hour
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Death or Dishonor
  • Age of Wonders III
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Crusader Kings II: Holy Fury
  • Battle for Bosporus
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Stellaris
  • Europa Universalis IV
  • Victoria 2
  • Europa Universalis III: Collection
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Way of Life
  • Stellaris Sign-up
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Stellaris: Megacorp
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Divine Wind
  • Heir to the Throne
  • Stellaris: Synthetic Dawn
  • King Arthur II
  • Stellaris - Path to Destruction bundle
1. It was chosen from basic math: The events trigger in a one-month frequency, two months of stock is the smallest checked value, three months is the next higher one. These two control aggressive import pricing and it appeared sensible to choose a bigger interval for normal and sell pricing, so I added another frequency unit. Three months plus two gives five, here we are.

Testing I found no reason to change these settings, as they led to agreeable results (no negatives, some positives).
- There is no reason whatsoever not to change them further, as long as a couple of rules are observed:
  • The trigger frequency is the elemental unit TFU of stockpile differences checked.
  • The smallest stockpile checked should be greater than one TFU.
  • Outlying steps should be smaller than those close to normal pricing.
I had planned to put off fine tuning to the third iteration of this system. The first one is here, the second one would contain functional changes in the trigger layout as mentioned in my last post, thereafter the general layout should be stable and thence meaningful experiments with different values may be conducted.

2. Yes.

Development of JAP static pricing for rare materials before I deployed this:
  • 6.0 - 150%; JAP runs out in ~50% of games
  • 7.0 - 175%; minimal improvement - may even have been a figment
  • 8.0 - 200%; notable improvement, but JAP still runs out at times; mayhap at 30% of games, but not enough test games to soldify that number
  • 9.0 - 225%; JAP runs out of energy (which it values at 80% of default) instead and I give up on the static approach
In other words: I concur in principle, blame the AI.

200% seems high until you realise that it has been required before - and now JAP can actually relax it once it acquires enough stockpile to be safe, just as it can revert to it, once that situation changes again.
Furthermore, while an AI may be ready to pay 200%, it will of course happily accept offers for less - and countries which decrease their prices will offer for less. As countries only seem to make trade offers with some hardcoded frequency, we can actually assume that more trades will stem from outside offers than from own offers for any given AI country.
- And once the stockpiles dictate a price reduction, the (hopefully few) really expensive imports will be cancelled, leaving the country with a net increase in imports, which should in theory approach an equilibrium, while the number of expensive imports decreases.
... Unless there is a real shortage, but then high prices seem reasonable.

3. Two kinds of trigger can be easily provided: For one tag, for all tags. Everything else is complicated. Cloning these events for several tags introduces redundancy which a priori is not worth it. Because someone will eventually forget to change one when all have to be changed. It happened all the time in the past, will not stop here.

Then, the global market does not necessarily develop in a foreseeable way. Trivial example:
If a player as JAP starts to build IC on day 0 and keeps going at a higher level than the AI would do, they will require more imports; fewer materials will then be available to the other countries which rely on imports. Furthermore, players tend to buy in bulk, so the number of available exporters will shrink. Therefore the number of exchanged trade proposals will shrink. Therefore AIs need more nudging to actually establish their trades before they run out and stop comprehending how much they need in the first place.

We can directly model the real IC being supported. And we can model the structural import/export position rather than simply shooting for same size stockpiles.
Mmh, you will have to draft some code to explain, as I see not how. Using a single TAG does not expand the list of conditions we can check. But if it were possible, I could probably just as well include the better method here.

While this does bulk up the code it eliminates a vast number of Trigger checks.
Currently, there are 4x4=16 checks per month. Leave them out and you have 16 checks total for each individual country. Say you limit this to the "big 7": 7x<resource types>x<granularity>. Granularity is at least 2. Resource types is at least 1. 14 out of 16. No good.
... If we want to save computational power from event processing, there are other areas where triggers are extremely wasteful: Once-per-day events. Multiple events starting on the same day and checking in the same interval.
The individual trigger of these general events may be heavier than the individual trigger of a country-specific event, but one cannot trivially assume that one general event requires #countries as much effort as one country-specific event.
- I do not think there exists and have not seen any analysis on this balance. At the same time, I have failed (if not tried too hard) to actually slow down the game using events.

Regarding the trade of code complexity for optimisation... I most decidedly disagree.
Recall the puppet/stable puppet etc. events I reworked recently? They were broken even before I joined. For a good four years and possibly longer!
Every single one of them had a trigger that would not fit on any screen. Coincidence?

At large, I do not think that questionable added performance outweights guaranteed added maintenance cost.

Regarding the number of tags affected by what, I made a list:
  • 150+ IC: CHI, ENG, FRA, GER, ITA, JAP, SOV, USA
  • 50 IC: ARG, AST, BEL, BRA, CAN, CHI, CZE, HOL, HUN, IND, POL, SPA, SPR
  • 30 IC: AUS, BUL, DEN, FIN, GRE, MAN, MEX, NOR, HUN, POR, ROM, SAF, SCH, SPA, SPR, SWE, TUR, VIC, YUG
  • 10 IC: rest, BEL, FIN, FRA, HOL
Note that some countries appear more than once: They may change categories at some point in the game.
Of course, we can define a cutoff point below 10 IC (or indeed anywhere) and handle all the countries affected statically. That merely means manual work on 45 tags, including those which may spend part of the game within dynamic control but fall below the threshold eventually.
... Yes, that "work" may constitute "leaving it as is" and therefore end up not so bad. But I do not believe that anyone wants to actually fine tune all of these for two very simple reasons: No one has done so within the last three years. There really are better ways to spend anyone's time on.

4. Not sure what to write about that. We are in agreement here.
Yes, they can initiate trades with their master. They will also keep all trades with third parties they set up before becoming a puppet until normally cancelled.
A minor change in the event of that level which we want puppets to maintain (you vote for aggressive, I am split between increased and aggressive; will make it aggressive thence) allows countries to handle both being puppeted and being freed with no need for further interaction. I like getting features for free.
 
Last edited:

dec152000

Colonel
1 Badges
Feb 25, 2006
908
1
  • Arsenal of Democracy
Hi,

The main reason I want TAG specific events vs. TAGless events is customization. I realize this is more work. Especially in the development phase. However, the point where nations need to get concerned about trading isn't really based on the stockpile. It's based on the stockpile trend. Unfortunately it's very hard to get the AI to see what a player naturally gets. Your proposal is trying to get that. But just looking at a single target for multiple TAGs drops out the aspect of what percentage of each resource a specific TAG imports. GER should be much more sensitive to Metal/Rare/Oil. GER really never needs to do any shifting on Energy at all. While FRA should be more Sensitive to Energy. As well as ITA. There's also the issue of economy size. An adequate stockpile for ITA is not really enough for USA or GER.

This is more of an example of how I see it. IC/E/M/R/O roughly from the 0.70 fileset.

ITA 118/90/80/50 yields required imports of 56/38/9/5 or import ratio 38%/32%/15%

FRA 170/160/330/60 yields required imports of 180/-160/25/20 or import ratio 52%/-48%/29%

From this I'd say that FRA should maintain roughly a 50% greater target stockpile compared to ITA. And should maintain relatively greater stockpiles (compared to the baseline) of Energy, Rares and Oil. OTOH, it should allow fairly low levels of Metal. ITA OTOH, should maintain relatively greater stockpiles of all Resources. Comparing the two, FRA is more dependent on imports of Energy and Rares percentage wise. So there stockpiles should be further adjusted to compensate for that fact. The structural required import level is what I propose as the main driver to the required stockpile levels. So say we set a rather arbitrary baseline desired at 1 month total + 6 months imports as a target. Then FRA would target:

E: 10200 (1m) + 32400 (6m) = 42600
M: 05100 (1m) + 00000 (6m) = 5100
R: 02550 (1m) + 04500 (6m) = 7050

And ITA would target:

E: 7080 (1m) + 10800 (6m) = 17880
M: 3540 (1m) + 06840 (6m) = 10380
R: 1770 (1m) + 01620 (6m) = 3390

This could be further developed to adjust these levels for mobilization state and any other applicable factors that are country specific.

mm
 

Zsar1

Major
52 Badges
Dec 19, 2014
659
199
  • Arsenal of Democracy
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Darkest Hour
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Death or Dishonor
  • Age of Wonders III
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Crusader Kings II: Holy Fury
  • Battle for Bosporus
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Stellaris
  • Europa Universalis IV
  • Victoria 2
  • Europa Universalis III: Collection
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Way of Life
  • Stellaris Sign-up
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Stellaris: Megacorp
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Divine Wind
  • Heir to the Throne
  • Stellaris: Synthetic Dawn
  • King Arthur II
  • Stellaris - Path to Destruction bundle
The main reason I want TAG specific events vs. TAGless events is customization.
I built in the means to override the dynamic system when desired. Just set all the flags on a country and nothing will happen. Unset all the flags and the system will take over again.
- This allows us to put in custom parts as they come... and to rip any of them back out at any time, should the need arise.

From this I'd say that FRA should maintain roughly a 50% greater target stockpile compared to ITA. And should maintain relatively greater stockpiles (compared to the baseline) of Energy, Rares and Oil. [...]
I doubt that it is sensible to wish for specific desired stockpile values. Or rather: I find it needlessly complicated.
- My goal is to have "enough" to react to changes in the net balance. Approximations of this "enough" may overshoot the exact values without ill effect (as then the approximated "enough" is accumulated faster... in theory).

I also dispute that FRA has in the typical game more need to stockpile than ITA: It will lose its stockpile in 1939, it is part of the Allies and therefore has a greater proportion of trading partners which are net exporters for everything.
The greater ease for FRA to procure whatever it needs certainly offsets its greater need. This is similarly true for ENG.
Instead of trying to grasp all these factors, concentrating on the most basic value: stockpile; implicitely deals with whatever happens, no matter what we change now, no matter what we change in the future.
- I find this to be a very soothing certainty.

Of course we can reduce the thresholds based on additional assumption, but we should make sure that these assumptions apply universally. Adding additional (or splitting existing) tiers in the check is simple. Excluding net exporters which do not build IC nor acquire nor lose territory is simple. Net importers can increase their IC while still being correctly nudged towards reasonable import amounts - this was part of the point of the exercise in the first place; exclusion is not sensible here.
Countries for which there is knowledge of impending changes in their resource balance (most notably declarations of war) available in advance may be excluded for the time inbetween the advent of said knowledge and that of the events in question (ex.: hardwire ITA to aggressive pricing when changing its neutrality to allow alliance with GER, release once at war with Allies; same with GER between deciding to do and start of Barbarossa).

None of this customisation, however, has happened yet.
GER trades rare materials and oil at default value always. ITA trades oil at default value always.
JAP does not change anything about its rare materials pricing after conquering Indonesia and attaining a positive net balance (which would allow it to export, to MAN which always needs it, for example).

There are a lot of simple things that we could do - but have not. I am all for further improvements, but this general system affects all the places where nothing better is currently available.
- This is far from an either-or situation. We can use it all, have the cake and eat it.
 

dec152000

Colonel
1 Badges
Feb 25, 2006
908
1
  • Arsenal of Democracy
Hi,

Short on time right now. Did some math. 34 Tags control 90%+ of all the IC & Resources. IMO everyone else can just be static. And some of these really could be as well since this list includes some bit players such as AUS/CZE/SIA/BOL. So about 30 nations would need events. Versus running generic events for every Tag.

mm