What is the formula for number of convoys needed for supply and trade?

  • 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.

ecpgieicg

First Lieutenant
27 Badges
Oct 27, 2012
263
113
  • Cities in Motion
  • Magicka
  • Leviathan: Warships
  • Cities in Motion 2
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Dharma
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV
  • 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
What is the formula for number of convoys needed for supply and trade?

What I want to know is what parameters do I need to tweak in order to prevent pathological situations with convoy requirements for trade. I've been frozen by convoy deficiency for half a year as Japan. I am using a mod. But changing what the mod tweaked (SUPPLY_CONVOY_FACTOR and CONVOY_ROUTE_SIZE_CONVOY_SCALE) does not help.

20200707191821_1.jpg



EDIT: So far I found that before distance modifier, every resource for internal trade requires 0.4 convoys multiplied by SUPPLY_CONVOY_FACTOR. Have not found what CONVOY_ROUTE_SIZE_CONVOY_SCALE does.

Distance has minimal role in the convoy requirement in my game. Also, earlier when I started a war with Spain, the convoy requirements dropped drastically. (It was also after a supply shortage was solved in Tibet.)

So far, it seems the origins of this pathology are unmoddable. Namely, the pathologies are: internal trade does not have separate variables for supply cost; un-used resources consume supply (on top of shipping everything to capital, but I'll give that a pass); run-away supply requirements for reinforcement that is not moddable.
 
Last edited:

Mousetick

Major
93 Badges
Oct 13, 2012
689
1.400
  • Crusader Kings II: Monks and Mystics
  • Age of Wonders II
The longer the route the more convoys it needs. This might be what you're looking for:

CONVOY_RANGE_FACTOR = 1, -- how much range affects convoy need

The range appears to be the number of sea regions traversed, but as always the rule doesn't seem to be consistent. For example:
- Vlaanderen to London: 1 convoy per 8 units of traded resource
- Brest to London: 2 convoys per 8 units of traded resource
- Oslo to London: 3 convoys per 8 units of traded resource
- Norfolk to London: 6 convoys per 8 units of traded resource, but I count 7 sea zones between them
 
  • 3
Reactions:

FindFloppies

Some Assembly Required
88 Badges
Jul 8, 2015
852
1.468
  • Cities: Skylines Deluxe Edition
  • Europa Universalis IV: Cossacks
  • Stellaris
  • Europa Universalis IV: Cradle of Civilization
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Hearts of Iron IV: Expansion Pass
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Dharma
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Battle for Bosporus
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings III
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris: Federations
  • Hearts of Iron IV: Death or Dishonor
  • Cities: Skylines - Green Cities
  • Stellaris: Nemesis
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Distant Stars
  • Victoria 3 Sign Up
  • Europa Universalis IV
  • Cities: Skylines - Parklife Pre-Order
  • Stellaris: Lithoids
  • Cities: Skylines - Campus
  • Stellaris: Apocalypse
  • Europa Universalis 4: Emperor
  • Hearts of Iron IV: No Step Back
  • Crusader Kings II: Way of Life
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Victoria 2
  • Cities: Skylines - Parklife
  • Stellaris: Necroids
  • Cities: Skylines
  • Europa Universalis III: Collection
  • Hearts of Iron IV: By Blood Alone
  • Europa Universalis IV: Golden Century
Check and see if the 'weight' values in the common/units folder have been tweaked. Check the common/resources folder, and check those values against the base game as well.
 

ecpgieicg

First Lieutenant
27 Badges
Oct 27, 2012
263
113
  • Cities in Motion
  • Magicka
  • Leviathan: Warships
  • Cities in Motion 2
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Dharma
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV
  • 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
Check and see if the 'weight' values in the common/units folder have been tweaked.

They are indeed tweaked by the mod. But most of my convoy problems come from internal trade. I have no issue with units -- especially mechanized ones -- taking a lot more than vanilla HOI4 to supply. That's what it should be. The pathology is with internal trade. I tried the vanilla numbers and I still need >3.8k convoys.
 

bitmode

1st Reverse Engineer Battalion
Nov 10, 2016
3.824
7.024
EDIT: So far I found that before distance modifier, every resource for internal trade requires 0.4 convoys multiplied by SUPPLY_CONVOY_FACTOR. Have not found what CONVOY_ROUTE_SIZE_CONVOY_SCALE does.
Seems like it is related to attacks on convoys, i.e. the longer the route, the smaller the portion of convoys targeted in a convoy raid.
 
  • 1
Reactions:

bitmode

1st Reverse Engineer Battalion
Nov 10, 2016
3.824
7.024
I think all the factors have already been mentioned, but the formula for a resource transfer should be:
(required convoys) = ⌈#resources * (convoy attribute of resource) * max(1, CONVOY_RANGE_FACTOR * (#strategic regions on path))⌉

Example:
steel_transfer2.png

8 steel are transported, steel (like all resources in vanilla) has a convoy attribute of 0.1, the dashed blue line crosses 3 strategic regions:
⌈8 * 0.1 * max(1, 1 * 3)⌉ = ⌈2.4⌉ = 3
 
  • 6
Reactions:

ecpgieicg

First Lieutenant
27 Badges
Oct 27, 2012
263
113
  • Cities in Motion
  • Magicka
  • Leviathan: Warships
  • Cities in Motion 2
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Dharma
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV
  • 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
I think all the factors have already been mentioned, but the formula for a resource transfer should be:
(required convoys) = ⌈#resources * (convoy attribute of resource) * max(1, CONVOY_RANGE_FACTOR * (#strategic regions on path))⌉

Example:
View attachment 598118
8 steel are transported, steel (like all resources in vanilla) has a convoy attribute of 0.1, the dashed blue line crosses 3 strategic regions:
⌈8 * 0.1 * max(1, 1 * 3)⌉ = ⌈2.4⌉ = 3

SUPPLY_CONVOY_FACTOR should be included somewhere. I've seen changing it changes resource convoy cost but the change is not linear. Import and internal trade may be different too.

With SUPPLY_CONVOY_FACTOR := 0.5, CONVOY_RANGE_FACTOR := 1.1, importing 100 steel from Manchuko's Liaoshen port to Japan's Tokyo costs 40 convoy. Not really fitting the formula. (The 39 convoy is for 96 aluminum.)

20200709011445_1.jpg

20200709005231_1.jpg


Here 12 aluminum (16 resource gain efficiency, presumably) from Palau (same distance) using the same parameters requires 4 convoy.

20200709005734_1.jpg

20200709005747_1.jpg


This route's convoy requirement does change with a (very) different SUPPLY_CONVOY_FACTOR. But I don't know what the relation is.

I think the rounding happens at how many resources 1 convoy can take. Not how many convoys are required per resource and round after.

Note that 4 resource per convoy at 3 sea regions away for my settings explain the above and this example below.
20200709010404_1.jpg


But it does not stand the test when looking any another example. In Kalimantan, 100+ resources only require 8 convoys at 4 sea regions away. The tooltip does not give any hint about only resources being actively used are counted. Sure it seems to indicate 1 aluminum is not used and the rest are. Except, while it makes sense all rubbers from Kalimantan are used due to proximity, it makes no sense that with only 2 spare aluminum, 1 of the 2 comes from Kalimantan when aluminum from Spain/Sweden and the like are fully accounted for. And then there is the problem that only 104 rubbers are consumed. (Though 31 are exported for actual CIV.) Plus, if all rubbers are used, we are back to the 100+ resources only requiring 8 convoys problem.
20200709010604_1.jpg

20200709010635_1.jpg
 
Last edited:

bitmode

1st Reverse Engineer Battalion
Nov 10, 2016
3.824
7.024
SUPPLY_CONVOY_FACTOR should be included somewhere
I don't believe it should. There are defines for every sort of cargo convoys can transport. It wouldn't make sense to re-use the define for supplies for resources as well, especially when each resource already has their own convoy multiplier. When searching through the code, the only place I'm seeing this define being used is in the supply system.
And then there is the problem that only 104 rubbers are consumed. (Though 31 are exported for actual CIV.) Plus, if all rubbers are used, we are back to the 100+ resources only requiring 8 convoys problem.
The tooltip "Delivering X by sea using Y convoys" seems to be very unreliable. X is always the maximum available (sometimes one off presumably due to rounding) but the convoy requirement is based on what is actually drawn from there. E.g. when starting as France, New Caledonia's tooltip claims that 90 chromium are transported by 2 convoys to the other end of the world.
Maybe it is safest to test with Closed Economy and running a deficit of the resource to make sure that really everything gets transported. International trade seems to always transport the full amount though.
importing 100 steel from Manchuko's Liaoshen port to Japan's Tokyo costs 40 convoy
The most I can get out of them is 86 steel which costs 26 convoys, exactly matching the formula. Are you sure the convoy attribute of steel is not increased in your mod?
With SUPPLY_CONVOY_FACTOR := 0.5, CONVOY_RANGE_FACTOR := 1.1
Changing these two defines, I need 29 convoys for 86 resources; the expected increase due to CONVOY_RANGE_FACTOR.
 
  • 1
Reactions: