• 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.
Could you post the whole chain from modifier to score?

Code:
if (double_time == yes)
[effective difficulty of a tech component] = 2 x (2 + max(3, difficulty));
else
[effective difficulty of a tech component] = 2 + max(3, difficulty);

[effective difficulty of a tech] = Sum of effective difficulties over all 5 components of a tech;

value = value_dbed x [effective difficulty of a tech];

score = value x [historical date modifier] / [research time including ministers and ideas but excluding historical date modifier];

Also it might be useful to know that with historical date modifier excluded the calculation of research time is simplified to

Code:
if (matching expertise == yes)
[research time for a component] = 200 days x [effective difficulty of a tech component] / (18.0 + 3 x skill + 15 x [matching test site level]);
else
[research time for a component] = 200 days x [effective difficulty of a tech component] / (9.0 + 1.5 x skill + 15 x [matching test site level]);

[research time for a tech] = Sum of research times over all 5 components of a tech;
[research time for a tech] = [research time for a tech] x (1-minister modifier);

if (blueprints == yes)
[research time for a tech] = [research time for a tech] / [blueprint modifier];

In a further step one would need to divide by research_mod, but as that will not differ it can be ignored for the purposes of calculating score.

Ah, I see. Yes, 1 is fine as well. Do you foresee the desire to specify preferences in the interval (0, 1)?

If 1 were to be the standard value, than yes. But for 100 as standard value, value_dbed would be in [10,300]. The later would imply to start 667 days ahead of time, while 10 does imply to ignore unless all alternatives suffer historical date modifier = 0.1.
 
Last edited:
Roadmap Interjection:

I will implement the syntax in A12 (that is, two builds from now). As I lack both time and desire to port CORE to it, the behaviour switch will accept old syntax on one option and new syntax on the other. To keep maintenance to a minimum, a missing behaviour switch will be interpreted as old syntax by default.
Purely syntactical checking will be in.

This will be a pure UI prototye without functionality. I intend to add functionality in either A13 or A14, depending on how unrelated things go.
Semantical checks will be added piecemeal as they become apparent, no timeline given.
 
I think there would be time for a test in like in a new set. We might first limited this to major nations (GER.USA.USSR.UK.JAP.ITA.ENG) we might also add in a few regional powers in 1936 to: SPA,HUN,ROM and BRA/ARG. Whenever China(nationalist) I major or regional is hard for me to tel. We can also consider U73 and India for new research file in the coming set. We might always rollback or adjust the AI research files If the results is not so promising.
 
This would not seem to make sense. It is best to use it for all AI files. That should not be a problem once functionality on the engine itself is reached. Before that anything is just guessing anyway.
 
Therefore, it makes no sense that I was thinking: I do not know how fare Panbingxun has gotten in his AI-files making. The idea was saving time if your work was not over.
You have not answer any of my messages so I had no idea. Then use what you got.
 
I proposed to change the imported softcoding to something like this:

Code:
technology = {
   priority = {
[...]
     7240 = 690 # 10 x 69 # 1951 Air Cavalry
[...]
   }
}

I like to rename this term priority as i used it in the first post of this thread to "value", because it describes the absolute value of a tech. Later it will be divided by a simplyfied version of what researching the tech would cost measured in days. Money is not relevant for AI research. So something like this would be imported:

Code:
technology = {
   value = {
[...]
     7240 = 690 # 10 x 69 # 1951 Air Cavalry
[...]
   }
}

Another option is to import "value_dbed" instead:

Code:
technology = {
   value_dbed = {
[...]
     7240 = 10 # x 69 = 690 # 1951 Air Cavalry
[...]
   }
}

"value_dbed" stands for value divided by effective difficulty. This solution would be slightly more demanding on hardcoding, but arguable it would be less demanding for maintaining the softcoding after 1.11 has been finalized. This is why Zsar1 prefered this version. While i find my initial suggestion more intuitive i can certainly live with both approaches. It simply needs to be decided on one.

Effective difficulty of a tech is the sum of the effective difficulties of its components. The effective difficulty of a component is the difficulty as described in the tech files(say /db/tech/secret_weapons_tech.txt) plus 2 and at least 5. In case of "double_time = yes" the effective difficulty is doubled.

Example: 1951 Air Cavalry has 5 components:

Code:
component = { id = 7241 name = TECH_CMP_SW_24_1_NAME type = aeronautics double_time = yes difficulty = 7 }
    # Transport Helicopters
    component = { id = 7242 name = TECH_CMP_SW_24_2_NAME type = aeronautics double_time = yes difficulty = 7 }
    # Aerial Support Organization
    component = { id = 7243 name = TECH_CMP_SW_24_3_NAME type = management difficulty = 5 }
    # Modified Anti-Tank Weaponry
    component = { id = 7244 name = TECH_CMP_SW_24_4_NAME type = rocketry difficulty = 6 }
    # Air Assault Tactics
    component = { id = 7245 name = TECH_CMP_SW_24_5_NAME type = combined_arms_focus double_time = yes difficulty = 7 }

This is (7+2)x2= 18 for 7241, (7+2)x2= 18 for 7242, (5+2)= 7 for 7243, (6+2)= 8 for 7244 and (7+2)x2= 18 for 7245. This totals to an effective difficulty of 69.
 
Last edited:
Some of the tech functions are the only game coding that we have access to:

If Component_Match(Current_Component, Tech_Team_Index) Then
Daily_Increase = (Base_Increase_Matched / ((2 + Min(TECHS(Current_Component).Difficulty, 3)) * 10)) + ((3 * (TECH_TEAMS(Tech_Team_Index).Skill + Bonus_Level - 1)) / (2 + Min(TECHS(Current_Component).Difficulty, 3)))
Else
Daily_Increase = ((Base_Increase_Unmatched / ((2 + Min(TECHS(Current_Component).Difficulty, 3)) * 10)) + ((3 * (TECH_TEAMS(Tech_Team_Index).Skill + Bonus_Level * 2 - 1)) / (2 + Min(TECHS(Current_Component).Difficulty, 3)))) / 2
End If

Early_Research_Penalty = 0
Do Until Percent_Complete >= Percent_Total
If Start_Year < TECHS(Tech_Application_Index).Historical_Year Then
Early_Research_Penalty = Min(Early_Research_Mod * Min((Time_Difference(Start_Day, Start_Month, Start_Year, 1, 1, TECHS(Tech_Application_Index).Historical_Year) - Total_Days - 1), 0), Max_Early_Research_Penalty)
End If

If Not Have_Blueprint Then
Percent_Complete = Percent_Complete + Daily_Increase * (1 + Early_Research_Penalty) * Research_Mod * (1 + Difficulty_Mod)
Else
Percent_Complete = Percent_Complete + Daily_Increase * (1 + Early_Research_Penalty) * Research_Mod * (1 + Difficulty_Mod) * Blueprint_Bonus
End If

Total_Days = Total_Days + 1

If Total_Days > 9999 Then Exit For 'To avoid infinite loops
Loop
Next Current_Component

Calculate_Research_Time = Total_Days
End Function

If a seperate value divider were added than it should be the time of component completion after current modifiers are applied then calculated in sequence per component until tech is researched. At least the Total_Days value should be saved than used in conjunction with AI priority. I don't understand what Paradox was thinking with this tech list and it's components. HoI1 and traditional strategy game tech trees are similar because they are logical. Technology becomes some sort of mini-game where you had to guess at which team would accomplish greater results weighing specialities and skill. Overly burdensome on scripting and unintuitive for the computer opponent unless lenghty formulae are compiled to list it's options. The loss of tech descriptions was the deletion of half the narrative flavor of the previous game as well.
Game theory requires linear arithmetic. a * b = c save c to memory for next equation. Paradox tried to be unique with it's resolution tables and everything turned into a convoluted mess that just generated bugs and frustrated third party coders. By HoI2 they should have been programming for an engine franchise that was easier to mod with an AI that accounted for every interface, function and modifier similar to the human player.
 
Last edited:
For the purposes of importing the softcoding value_dbed has been replaced by the more generic term preference. Either

Code:
technology = {
   preference_complete = {
       7240 = 10 # x 69 = 690 # 1951 Air Cavalry
       [...]
   }
}
or
Code:
technology = {
   preference_tweak = {
       7240 = 10 # x 69 = 690 # 1951 Air Cavalry
       [...]
   }
}
are imported.

preference_complete imports a complete list of preference for all techs. If a tech is not specified, than a default value of 100 is used.

preference_tweak only resets the values in its list.

In practice preference_complete should only be used for the 2 default files, and preference_tweak in all other files to define those values, that do differ from the default files or the last file loaded. At the start of a campaign the default file is loaded first and the dedicated ai file second.

preference is value divided by effective difficulty.

Effective difficulty of a tech is the sum of the effective difficulties of its components. The effective difficulty of a component
is the difficulty as described in the tech files plus 2 and at least 5. In case of "double_time = yes" the effective difficulty is doubled.

preference times effective difficulty is value, 690 in the given example of 1951 Air Cavalry.

score = value x [historical date modifier] / [research time including ministers and ideas but excluding historical date modifier]

Whenever new research project can be started whichever combination of available tech team and available tech scores best will be chosen.
 
Sounds like a splendid idea.
Since you are tinkering with the research I have a hypothesis on a somewhat related subject of minor importance. Granted that it does not break the game in some way, I would propose that minors be treated a bit more generously in the technology department. 2ic for two teams and then 40ic for a third team really gimps them badly. I would suggest three teams at 20ic or at 30ic, and then a new tech every 20th tech team from then on as it is now. It seems to me that, as a design decision adjusting the techteam*IC values in this manner would be a positive improvement. Firstly it would vastly improve the gameplay when playing as a minor as the research speed could be turned down to offset the additional cost and as you know the ai does not have to spend money at all. Secondly ai minors are also really weak at the moment, I doubt sincerely that this would make the third class powers or mini-minors too strong. Adjustments may admittedly have a greater effect on the performance of the mid range powers such as France, Nationalist China and Japan, which have a more delicate balance of power than do the minors and the first class powers.
 
is there a way to tell an AI to never research a tech ? Does zero work as effective blocker ?

I believe so. Practically speaking even 1 would be an effective blocker if other values are 100 by default. But i do recall that 0 is used as a hard blocker.

Saves still contain the weighted research classes in technology section although all set to 1.0000 - is this intended ?

Apparently so. This offers an option to say triple the preference of all naval doctrines instead of having do it for all naval doctrines manually. I donnot like to use this option, but i can see how it can make sense.