When is the best date to switch from civilian to military factory production in Hearts of Iron IV

recreational-mathematics

The video game Hearts of Iron IV is a WWII grand strategy game. One of the most important aspects of this game is industry. There are three types of factories: civilian, military, and dockyards. Ignoring dockyards, civilian factories (commonly called "civs") are used to build other factories and military factories ("mils") are used to make weapons (guns, tanks, planes, etc.).

Civs have a base production rate of 5 "industry points" per day , and cost 10800 points to build. Up to 15 civs can go into production of any one output (civ, mil, dockyard, etc.). I.e., with no modifiers (which I'm ignoring for this question) and 15 civs, 75 points per day will go to a given construction, so a new civ will be produced in 144 days. If the player has more than 15, a second output can be started. For example, if the player has 32 they can construct 3 things at once (15 for the first 2 and the 2 remaining on the 3rd; the first 2 would progress at 75 points per day while the 3rd would progress at 10 per day).
Construction Screen

The game starts 1 January 1936, and the player can start the war whenever they want. For this question, assume the player is playing historically (war start September 1939), and know that mils cost 7200 points compared to the pricier civs. Also know that Germany starts with 23 usable civs. What is the most efficient year and month to switch from civilian to military factory construction to have the most mils by war start?

Best Answer

For the sake of simplicity, I'll approximate everything with continuous functions, even though the actual game only lets you have an integer number of factories.

Let $f(t)$ be the number of civilian factories Germany has after $t$ days, assuming that production hasn't switched to military yet. The player gains $5f(t)$ industry points per day, which can be spent on new civs at a cost of 10800 points each. That's $f'(t) = \frac{5f(t)}{10800} = \frac{f(t)}{2160}$ new factories per day. Solving this differential equation with the initial condition $f(0) = 23$ gives $f(t) = 23e^{t/2160}$.

Let $S$ be the number of days between the start of the game and the day that production is switched from civilian to military factories. Note that the time interval between the start of the game (1936-01-01) and the start of the war (1939-09-01) is 1339 days.

After the switch to military factory production, the player gains $5 \times 23e^{S/2160} = 115e^{S/2160}$ industry points per day, over a period of $1339-S$ days, for a total of $115e^{S/2160}(1339-S)$ points spendable on mils.

And it turns out that this value is optimized...at $S=0$. You already have all the civilian factories you need, so go ahead and focus on military from the very beginning.

Related Question