Show Research Times in Game
Posted: Thu Jul 31, 2014 1:07 am
If You bought the game via Steam, the LUA-script files are located in folder "Steam\SteamApps\common\Commander The Great War\data\scripts".
Technologies are coded in "technology.lua".
Research-Mechanic is coded in "game/game_research.lua".
The syntax for coding technologies is self-explaining thanks to developer comments in the code.
Example : One of the first Techs to research in the 1914-scenario is "industrial_warfare" :
"industrial_warfare" costs 100 time points to complete.
The Research Speed is defined at the beginning of "game_research.lua" :
This means that (without Focus) it will take around 10 turns (10 x 10 = 100) to research "industrial_warfare".
The game usually only shows ResearchTimes when there are 5 turns or less left.
If you want to see the Research Times for all available Techs in the Research Window, You have to adjust the line with in the following function coded in "game_research.lua":
If You adjust and save the file "game_research.lua" and start a new game (1914, Central Powers, Austria), then You can see now the times for the first 3 Technologies in the Research Window :
Industrial Warfare (5/100) : 11 turns
Anti-Air Defense (0/250) : 28 turns
Barbed Wire (0/100) : 12 turns
The difference between "Industrial Warfare" and "Barbed Wire" can be explained. It is caused by the scenario definition in file "1914.lua" :
Austria (= faction 3) already starts with 5 points in tech "industrial_warfare".
If You focus Research on Industrial Warfare, You increase the effort by 20% but reduce the research effort for the other 2 techs respectively :
Industrial Warfare (5/100) : 9 turns
Anti-Air Defense (0/250) : 31 turns
Barbed Wire (0/100) : 13 turns
In theory for this example the difference in Research-Points-Distribution between noFocus and Focus should be (10,10,10) to (12,9,9) (for a single lab).
In praxis it is rather (9,9,9) and (11,8,8). (I will explain in a 2nd post why the numbers in the game slightly differ from the theoretical calculated ones.)
Based on the observed times we can calculate that the effective research-speed (noFocus) for 1 lab is only 9 points instead of 10.
Industrial Warfare (5/100) : 11 turns : 5 + 11 x 9 = 104 > 100 -> Tech researched
Anti-Air Defense (0/250) : 28 turns : 28 x 9 = 252 > 250 -> Tech researched
Barbed Wire (0/100) : 12 turns : 12 x 9 = 108 > 100 -> Tech researched
... and with Focus :
Industrial Warfare (5/100) : 9 turns : 5 + 9 x 11 = 104 > 100 -> Tech researched
Anti-Air Defense (0/250) : 31 turns : 31 x 8 = 248
Barbed Wire (0/100) : 13 turns : 13 x 8 = 104 > 100 -> Tech researched
If You increase the number of labs in a category You can speed up Research.
Here are some numbers for NoFocus Research for the above techs from ingame:
# Labs : (Industrial Warfare, Anti-Air Defense, Barbed Wire)
1 : (11,28,12) (see above)
2 : (10,25,10)
3 : ( 9,23,10)
4 : ( 9,22, 9)
5 : ( 8,21, 9)
6 : ( 8,21, 9)
7 ... : ( 8,20, 8 )
Increasing the number of labs beyond 7 had no additional effect in this example. (Even 7 labs are very very expensive.)
The maximum effect is reached at around 7 Labs in a category and resuls in a reduction of Research Time by 1/3, e.g. from 12 turns down to 8 turns.
This equals to 12.5 - 13 points :
Barbed Wire (0/100) : 8 turns : 8 x 13 = 104 > 100
Anti-Air Defense (0/250) : 20 turns : 20 x 13 = 260 > 250
(Note : All mentioned Research Times are taken from the ingame Research Window on turn 1.)
Technologies are coded in "technology.lua".
Research-Mechanic is coded in "game/game_research.lua".
The syntax for coding technologies is self-explaining thanks to developer comments in the code.
Example : One of the first Techs to research in the 1914-scenario is "industrial_warfare" :
Code: Select all
industrial_warfare =
{
stats = --bonuses to stats
{
basedefense = 4,
},
unitTypes = {"infantry", "garrison", "cavalry"},
cost = 2, --Upgrade cost
time = 100, --time points to complete tech
level = true, -- increase unit level yes/no
},The Research Speed is defined at the beginning of "game_research.lua" :
Code: Select all
gameplay.researchSpeed = 10The game usually only shows ResearchTimes when there are 5 turns or less left.
If you want to see the Research Times for all available Techs in the Research Window, You have to adjust the line with
Code: Select all
if time <= 5 then Code: Select all
-- Returns time to complete
-- If time takes longer than 5 turns it will return -1
function GetTechTime(faction, techName)
local increment = GetTechIncrement(faction, techName)
if increment > 0 then
local time = math.ceil((data.newTechnologies[techName].time - faction.luaData.researchProgress[techName]) / increment)
if time <= 200 then -- original code : 5
return time
else
return -1
end
else
return -1
end
endIndustrial Warfare (5/100) : 11 turns
Anti-Air Defense (0/250) : 28 turns
Barbed Wire (0/100) : 12 turns
The difference between "Industrial Warfare" and "Barbed Wire" can be explained. It is caused by the scenario definition in file "1914.lua" :
Code: Select all
-- Austria
ProgressTechnology(3, "industrial_warfare", 5)If You focus Research on Industrial Warfare, You increase the effort by 20% but reduce the research effort for the other 2 techs respectively :
Industrial Warfare (5/100) : 9 turns
Anti-Air Defense (0/250) : 31 turns
Barbed Wire (0/100) : 13 turns
In theory for this example the difference in Research-Points-Distribution between noFocus and Focus should be (10,10,10) to (12,9,9) (for a single lab).
In praxis it is rather (9,9,9) and (11,8,8). (I will explain in a 2nd post why the numbers in the game slightly differ from the theoretical calculated ones.)
Based on the observed times we can calculate that the effective research-speed (noFocus) for 1 lab is only 9 points instead of 10.
Industrial Warfare (5/100) : 11 turns : 5 + 11 x 9 = 104 > 100 -> Tech researched
Anti-Air Defense (0/250) : 28 turns : 28 x 9 = 252 > 250 -> Tech researched
Barbed Wire (0/100) : 12 turns : 12 x 9 = 108 > 100 -> Tech researched
... and with Focus :
Industrial Warfare (5/100) : 9 turns : 5 + 9 x 11 = 104 > 100 -> Tech researched
Anti-Air Defense (0/250) : 31 turns : 31 x 8 = 248
Barbed Wire (0/100) : 13 turns : 13 x 8 = 104 > 100 -> Tech researched
If You increase the number of labs in a category You can speed up Research.
Here are some numbers for NoFocus Research for the above techs from ingame:
# Labs : (Industrial Warfare, Anti-Air Defense, Barbed Wire)
1 : (11,28,12) (see above)
2 : (10,25,10)
3 : ( 9,23,10)
4 : ( 9,22, 9)
5 : ( 8,21, 9)
6 : ( 8,21, 9)
7 ... : ( 8,20, 8 )
Increasing the number of labs beyond 7 had no additional effect in this example. (Even 7 labs are very very expensive.)
The maximum effect is reached at around 7 Labs in a category and resuls in a reduction of Research Time by 1/3, e.g. from 12 turns down to 8 turns.
This equals to 12.5 - 13 points :
Barbed Wire (0/100) : 8 turns : 8 x 13 = 104 > 100
Anti-Air Defense (0/250) : 20 turns : 20 x 13 = 260 > 250
(Note : All mentioned Research Times are taken from the ingame Research Window on turn 1.)