Author Topic: Research Speed  (Read 2649 times)

Offline TH300

  • Hero Member
  • *****
  • Posts: 1404
    • http://op3game.net
Research Speed
« on: October 13, 2013, 12:18:08 PM »
Yesterday, Galactic asked me, how research speed is calculated in Outpost 2. So, I opened Ollydebug and found most of the code already commented by Hooman.


As we all know, research progress doesn't happen continuously, but in chunks. One chunk will be added to the progress every 192 ticks.

The size of a progress chunk is determined by the number of scientists working on a project, the maximal number of scientists that can be assigned to it, and morale.

Let S be the number of scientists assigned to the topic. There is a table called scientistEfficiencyTable, from which a byte value E at index S*15 + maxScientists is loaded. In addition, M = moraleLevelModifiers[moraleLevel].M_RSCH_BONUS (the value is the corresponding value in morale.txt, multiplied by 256/100) is loaded.

Let P = E * (256 + M) * S

If the mission is a multiplayer mission, P is multiplied by 3.

Finally, P is subtracted from the remaining costs of the research topic, i.e. added to its progress.


You can find the code for this in Outpost2.exe at 0x0043E48A inside the function "ProcessTimers()".



The scientistEfficiencyTable is located at 0x004E0CD5. It is:

[15 bytes at the beginning are not part of the table]
[4 bytes] 07 07 07 07 07 07 07 07 07 07 07
07 07 07 07 09 09 09 08 08 08 08 08 08 08 08
08 08 08 08 0B 0B 0A 09 09 09 09 09 09 09 09
09 09 09 09 0D 0C 0B 0A 0A 0A 0A 0A 0A 0A 0A
0A 09 09 09 0D 0D 0C 0B 0B 0B 0B 0A 0A 0A 0A
0A 0A 0A 09 0D 0D 0D 0C 0C 0B 0B 0B 0B 0B 0B
0A 0A 0A 0A 0D 0D 0D 0D 0C 0C 0C 0B 0B 0B 0B
0B 0A 0A 0A 0D 0D 0D 0D 0D 0C 0C 0C 0B 0B 0B
0B 0B 0A 0A 0D 0D 0D 0D 0D 0D 0C 0C 0C 0C 0B
0B 0B 0B 0A 0D 0D 0D 0D 0D 0D 0D 0C 0C 0C 0C
0B 0B 0B 0B 0D 0D 0D 0D 0D 0D 0D 0D 0C 0C 0C
0C 0B 0B 0B 0D 0D 0D 0D 0D 0D 0D 0D 0D 0C 0C
0C 0C 0B 0B 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0C
0C 0C 0C 0B 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D
0C 0C 0C 0C 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D
0D 0C 0C 0C 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D
0D 0D 0C 0C 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D
0D 0D 0D 0C 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D
0D 0D 0D 0D

Note: the table contains 19 complete lines, hence a maximum of 18 scientists can work on a topic. The last byte is indexed by 18 scientists working on a topic with maximally 18 scientists.

Offline TH300

  • Hero Member
  • *****
  • Posts: 1404
    • http://op3game.net
Re: Research Speed
« Reply #1 on: October 13, 2013, 06:26:19 PM »
I found a nicer representation of the table:

07 07 07 07 07 07 07 07 07 07 07 07 07 07 07
09 09 09 08 08 08 08 08 08 08 08 08 08 08 08
0B 0B 0A 09 09 09 09 09 09 09 09 09 09 09 09
0D 0C 0B 0A 0A 0A 0A 0A 0A 0A 0A 0A 09 09 09
0D 0D 0C 0B 0B 0B 0B 0A 0A 0A 0A 0A 0A 0A 09
0D 0D 0D 0C 0C 0B 0B 0B 0B 0B 0B 0A 0A 0A 0A
0D 0D 0D 0D 0C 0C 0C 0B 0B 0B 0B 0B 0A 0A 0A
0D 0D 0D 0D 0D 0C 0C 0C 0B 0B 0B 0B 0B 0A 0A
0D 0D 0D 0D 0D 0D 0C 0C 0C 0C 0B 0B 0B 0B 0A
0D 0D 0D 0D 0D 0D 0D 0C 0C 0C 0C 0B 0B 0B 0B
0D 0D 0D 0D 0D 0D 0D 0D 0C 0C 0C 0C 0B 0B 0B
0D 0D 0D 0D 0D 0D 0D 0D 0D 0C 0C 0C 0C 0B 0B
0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0C 0C 0C 0C 0B
0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0C 0C 0C 0C
0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0C 0C 0C
0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0C 0C
0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0C
0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D

The index becomes (S - 1) * 15 + (maxScientists - 4), i.e. S-1 is the row and maxScientists-4 is the column. As a conclusion there cannot be a research topic with maxScientists < 4.
« Last Edit: October 13, 2013, 06:33:26 PM by TH300 »

Offline Galactic

  • Administrator
  • Full Member
  • *****
  • Posts: 144
    • http://www.konker.net
Re: Research Speed
« Reply #2 on: October 14, 2013, 07:42:08 AM »
This is great, thanks TH300!
Take me to your leader! I bare the claws of a corndog.

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3237
Re: Research Speed
« Reply #3 on: December 23, 2013, 04:56:02 PM »
Note: the table contains 19 complete lines, hence a maximum of 18 scientists can work on a topic.

No, that means a maximum of 18 scientists can safely work on a topic; anymore and OP2 is likely to stand ON its NEES SOLGR.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Zhall

  • Full Member
  • ***
  • Posts: 154
Re: Research Speed
« Reply #4 on: January 10, 2014, 04:21:09 AM »
So in Doge terms...

Op2 would be all...

SO STRAIN SUCH UNSTABLE MUCH CONFUSE
Pumping out awsome.