aliens

Author Topic: Research progress bug?  (Read 1605 times)

Offline Martenzo

  • Squaddie
  • *
  • Posts: 3
    • View Profile
Research progress bug?
« on: November 26, 2022, 05:56:38 pm »
Playing X-Piratez, I ran into the issue that Research progress displayed was not lining up with what the information entries of the 'pedia were saying they should be. Trying to very efficient with the early-game rush of key unlocks in that mod, I had opted to check my savefile for the true research costs, to not waste any precious research points in January. The 'pedia entry in the mod claims that the meanings of the research progress are as follows:

Unknown: less than 33% of the base cost has been researched;
Poor: over 2 weeks total at the current number of assigned Brainers;
Average: more than a week total research time;
Good: 4-7 days;
Excellent: 3 days or less.

But in reality, this base-cost 5 project in the save:
     - project: STR_INSPECT_MACHINERY
        assigned: 1
        spent: 4
        cost: 5

should be displaying progress as Excellent, on account of only needing one day to finish at the current number of Researchers assigned.
But when I load up the save, it shows a progress of Good. I would attach a picture, but it seems my account here is too fresh to attack it.
Further testing through editing the save and plugging in various values to various projects with different base and true costs showed that the research status always compares against base cost as if zero progress had been made. So the actual status labels mean the following in reality, despite the 'pedia entry claiming it checks against the true "time remaining":

Unknown: less than 1/3rd of the base cost has been researched
Poor: researchers assigned < 1/14th of base cost
Average: 1/14th of base cost =< researchers assigned < 1/7th of base cost
Good: 1/7th of base cost =< researchers assigned < 1/3rd of base cost
Excellent: researchers assigned >= 1/3rd of base cost

Current progress and true cost (which ranges anywhere from 50% to 150% of the base cost) seems to be irrelevant to all statuses except Unknown.
Having brought this up in X-Piratez chat, I was told to bring the report here, since the 'pedia entry was apparently made based on what OXC devs told Dioxine what the behavior ought to be.
Is this actually the intended behaviour and the 'pedia entry is wrong/outdated, or is this a bug in the OXC research check?

Offline Martenzo

  • Squaddie
  • *
  • Posts: 3
    • View Profile
Re: Research progress bug?
« Reply #1 on: November 26, 2022, 05:59:26 pm »
Also, it would seem that wrapping something in a [code\] block counts as an "external link" that new users aren't allowed to post.

Offline R1dO

  • Colonel
  • ****
  • Posts: 437
    • View Profile
Re: Research progress bug?
« Reply #2 on: November 26, 2022, 07:45:25 pm »
Not sure if i understood your post correctly.

Reading your 'pedia' snippet and description of what you've observed ingame i would say there is nothing wrong/outdated with the pedia (or bug in engine).

Just to clarify. The way I interpret the description:
Code: [Select]
Unknown: less than 33% of the base cost has been researched;    - Entry depends on time invested, when 33% is reached show something else.
   - Taking the rest into account it will mean: after 33% choose one of the following 4
Code: [Select]
Poor: over 2 weeks total at the current number of assigned Brainers;    - States total, in other words: not depending on what has been invested.
Code: [Select]
Average: more than a week total research time;    - Again total
Code: [Select]
Good: 4-7 days;    - Missing any indication of being total vs running number. Based on previous entries I assume total.
Code: [Select]
Excellent: 3 days or less.    - Same as good.

The only minor improvements i could think of are:
- Mention 'total' in both Good and Excellent.
- Clarify if 1-4 uses 'total base' or 'total after RNG'.
  + Although that would only benefit users that do extreme number tracking, the average player is probably not even aware of the difference.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8615
    • View Profile
Re: Research progress bug?
« Reply #3 on: November 27, 2022, 10:09:33 am »
Many xcom mechanics are unintuitive or hard to describe or both.

This happens when people try to describe them anyway.

Btw. I'm 99% sure that this mechanic is unintuitive by design.
But if you want to read the code and try a better description, here it is: https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Savegame/ResearchProject.cpp#L139
And the constants: https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Savegame/ResearchProject.cpp#L24

Offline Martenzo

  • Squaddie
  • *
  • Posts: 3
    • View Profile
Re: Research progress bug?
« Reply #4 on: November 27, 2022, 11:36:46 am »
I would say the place where I got confused was "total". I thought it to mean the post-RNG cost of the project, but both testing and the code (as far as I can tell) bear out that it compares to the base cost. The main thing that prompted me to try and optimise research in this regard was the wild variance in the cost of interrogation projects, which are somewhat urgent due to the frequent influx of more valuable interrogation targets in X-Piratez (as well as the frequent influx of prisoners who are worthless outside their "Get one for free" interrogation products). After trying to find a consistent and intuitive pattern in the status projections, I basically discovered the projections to be largely useless as a basis of strategy, and turned to looking at the data directly in the savefile to ensure fast and efficient turnaround on interrogations. Not to mention how difficult it was to track how much progress I had invested into projects without literally filling a notepad with the information, on account of frequent missions breaking up the flow of geoscape progress.

Offline yergnoor

  • Colonel
  • ****
  • Posts: 123
    • View Profile
Re: Research progress bug?
« Reply #5 on: November 27, 2022, 01:06:12 pm »
There was a similar discussion about how research status is displayed before, though I wouldn't have been able to find it quickly.
As I recall (though I could be wrong) one of the main arguments for the way things work in the game right now was this. Estimating the state of an ongoing study cannot be completely accurate. Scientists can't measure how much of the work they've already done and how much remains to be done. All they have is a rough preliminary estimate. In the game, this is known as the cost of research and is specified in the game or mod code. That's why all further progress estimates are based on it. However, the actual progress of research can be both shortened by an unexpected breakthrough and, conversely, delayed due to unforeseen advance difficulties. This is modeled in the game by the randomization of research costs. But the scientists themselves cannot know about this deviation. Therefore, they are unable to take it into account in their assessment of the study's progress, which they report to management.
Therefore, knowing exactly how much is left until the end of the study, from the point of view of realistic gameplay, is cheating.
Maybe I'm wrong in some details, maybe I put my own understanding of the problem into this explanation, not the same as the others. But the fact is that this issue has already been discussed and most likely more than once.

Offline krakp

  • Captain
  • ***
  • Posts: 66
    • View Profile
Re: Research progress bug?
« Reply #6 on: February 04, 2024, 08:06:12 pm »
I wanted to come back to this topic. According to https://www.ufopaedia.org/index.php/Research_Technical_Details if you are lucky, the progress of you project will be immediately "known". I do remember in the original XC that every now and then the project would jump on "Average" from the very start.

I noticed that this is not happening in OXC - so I reviewed the code (Meridian included the links above).

The current logic clearly will _never_ show the progress immediately, cause it compares the real spent days (so 0 at the start) with the average time needed. So it will always be 0 on start - no way to show the progress.

In the original XC the logic (according to the article I linked) was a bit different. E.g. if for Laser Weapons (Cost: 50), you are lucky and roll 30, practically you have "earned" 20 days of virtual research (made an initial breakthrough if you want to compare to real life) . So your progress is not really 0 - it is 20 (cause only 30 is missing). Therefore XC would show your progress as Poor/Average/Excellent at the very start of the project (20 / 50 > 33%).

Would we want to have similar logic in OXC?  Of course this would also mean that if you roll "badly" (e.g. 70 for Laser weapons) your progress starts in negative (you are 20 days behind schedule on the very start) and you would need to invest more that 36 days to actually get the 33% progress (cause you will only miss 33 days) and show the real progress rating instead of unknown.

I can suggest such a change to the original logic if you think it is a good idea.

Offline krakp

  • Captain
  • ***
  • Posts: 66
    • View Profile
Re: Research progress bug?
« Reply #7 on: February 05, 2024, 01:27:07 am »
So, I tested a bit more on the original XC and the Ufopeadia is right.

The switch from Unknown to Poor/Average/Good/Excellent happens when your research time left goes under 66% of the average time. This is actually a very good estimate of still needed investment if you know the average. OXC does not show it this way, cause it compares not the left time but rather the invested time going over 33% of average.

2 examples to make it clear. You start a vanilla game and try to research Laser Weapons (average men days = 50) with your 10 Engineers.

1. You are lucky and you roll a 31.
   = XC will immediately show you Good (cause you only have 31 left, which is less than 0.66*50=34) - at this moment you know that you only have 3-4 days of research left (25-34)
   = OXC will not show you any progress until you research for 2 days, having invested 20 men days (20/50 > 0.33). After the progress is shown you still have no idea what is left (could be anything from 5 to 55)

2. You are unlucky and you roll a 71.
   = XC will start with Unknown. After exactly 4 days it will show you Good (cause you now have 31 left, which is less than 0.66*50=34) - at this moment you know that you only have 3-4 days of research left (25-34)
   = OXC will behave exactly as in #1 - will not show you any progress until you research for 2 days, having invested 20 men days (20/50 > 0.33). After the progress is shown you still have no idea what is left (could be anything from 5 to 55)

Notice the difference.... XC is much more "friendly" here that OXC.

Now - I do not really want to argument which of the 2 makes more sense (comparing to real life or using any other measures) - my point is only that OXC is way different than XC in this aspect.

Wouldn't it be nice to have a choice? The more "unknown" research approach that this currently implemented in OXC or rather the more "known" one from XC (in this case the ability to cancel and restart projects should be removed - otherwise one could retry until you get the progress and know that you got a good roll - btw. why would projects be "cancellable" anyway? I never missed this possibility in XC....).



« Last Edit: February 05, 2024, 10:59:00 am by krakp »

Offline krakp

  • Captain
  • ***
  • Posts: 66
    • View Profile
Re: Research progress bug?
« Reply #8 on: February 06, 2024, 10:03:52 pm »
Now, that I can finally compile the code (thanks to the good folks on the other thread :-) https://openxcom.org/forum/index.php/topic,11800.0.html), I decided to implement the XC logic for my own playing - I need it for a challenge that I described here: (Early Cydonia Challenge: https://openxcom.org/forum/index.php/topic,11792.0.html).

If someone is interested the logic from the original XC is the following:

=======================
std::string ResearchProject::getResearchProgress() const
{
   float percentLeft = (float)(getCost() - getSpent()) / getRules()->getCost();
   if (getAssigned() == 0)
   {
      return "STR_NONE";
   }
   else if (percentLeft > (1 - PROGRESS_LIMIT_UNKNOWN))
   {
      return "STR_UNKNOWN";
   }
   else
   {......
=======================

Of course if someone would want to integrate this into the main tree, they would also need to remove the possibility of cancelling the research project - otherwise you could cancel until you get a good roll (so that the progress is shown immediately on start). That's exactly how XC works - a project once opened can't be canceled anymore.


And in case you should be interested in why it matters this much to me that I would bother changing it in code, I can tell you that the original XC allows to "waste" way fewer scientist man days while still researching quite quickly. The only thing you need to pay attention to, is when the progress changes from Unknown to another value. At this moment you know that your investment still needed has just crossed the value of 0.66*Average_Research_Time. So you can now estimate +/- 1 research day your completion time. So you continue your research at full speed until you are a day/2 days away from completion and then you can take some scientists away to only waste a controlled number of man days. This is much better than assigning fewer scientists from the very beginning.