1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[FIXED] Extra research bug?

Discussion in 'Civ5 - Bug Reports' started by WealthyAardvark, Mar 19, 2011.

  1. WealthyAardvark

    WealthyAardvark Chieftain

    Joined:
    Mar 19, 2011
    Messages:
    5
    I was researching Scientific Theory and waiting for it to finish up so I could start building Public Schools when I suddenly got it a turn early. On turn 401 I had 2364/2808 research with 233 more coming, on 402 I finish ST and have another 235 coming (I can't see how much overflow I have, but it seems to be ~215), and on 403 I'm at 452 on Biology with 237 coming. As far as I can tell I gained ~660 research from 401->402.

    It wasn't a research agreement, and I'm in a golden age, but that (probably?) wouldn't cause something like this to happen. I looked back a few turns and everything seems normal, and I ran forward with Biology for a couple of turns and the research seemed to be operating correctly there too. Does anybody have a clue as to what happened? :confused:
     

    Attached Files:

  2. TPQ

    TPQ Cogito Ergo Civ

    Joined:
    Oct 1, 2010
    Messages:
    587
    Location:
    UK
    I don't have a clue as to what happened, but I've seen the same thing happen to me. I've had 2 turns left on a tech, I hit next turn and then the tech research completes, one turn early.
     
  3. magnus333

    magnus333 Warlord

    Joined:
    Nov 17, 2002
    Messages:
    119
    Can anyone figure out exactly what is happening here? I started a new game specifically to track this, keeping note of every single beaker I accumulated but it still didn't make sense. The overflow I received didn't match up with the overflow I expected and there was no traceable miscalculation along the way.

    If we can figure out the issue, it will take a dev a couple minutes to correct, but if they have to run various tests it could take days (which are better spent on diplomacy or other areas).
     
  4. WealthyAardvark

    WealthyAardvark Chieftain

    Joined:
    Mar 19, 2011
    Messages:
    5
    I ran through another 50 turns on that file and it happened to a variety of techs. They were all in the industrial era, and at least one occurred for me three turns out instead of two. I can post some screenshots and more save files if you guys would like.

    Does the difficulty level scale the amount of research required to earn a tech? It could be that the scaled amount needed and the displayed amount needed aren't matching up.
     
  5. MouseyPounds

    MouseyPounds Prince

    Joined:
    Nov 8, 2010
    Messages:
    417
    Location:
    Maryland, USA
    I have no idea what's going on, but it definitely looks like at least one of the two Lua functions (TeamTechs:GetResearchCost() or TeamTechs:GetResearchProgress()) is simply not matching up with the actual tech calculations because techs are being awarded well before these two are equal.

    I played through 10 turns on the OP save and looked at the outputs of those functions as well as overall science generated, and just got more confused.

    First of all, the displayed 2808 cost for Scientific Theory and Military Science seems correct. Looking at the XMLs, the base cost for each is 1560, there is no modifier for King difficulty, the large map modifier is 120%, and the epic speed modifier is 150%. 1560*1.2*1.5 does equal 2808, so unless there is some other modifier, GetResearchCost() is displaying the right value.

    However, if you take overflow into account, Scientific Theory is awarded after only 2400 beakers and Military Science winds up being awarded after just 2246. If these had been consistent, I would have guessed that there was a "hidden" modifier discounting the costs. But, given the large difference between them and the fact that the research progress matched the generated science and reported overflow nearly perfectly, I just don't have any good theory.


    Spoilered below is the data collected, for what it's worth.

    Spoiler :

    Starting situation after loading OP save:
    Code:
     WorldView: Currently Researching Scientific Theory on Turn 401
     WorldView: TeamTechs:GetResearchCost() = 2808
     WorldView: TeamTechs:GetResearchProgress() = 2364
     WorldView: Subtracting we get 444 science needed; currently generating 233 science with 0 overflow
    
    After ending the turn we are awarded scientific theory but:
    Code:
     WorldView: Currently Researching Scientific Theory on Turn 402
     WorldView: TeamTechs:GetResearchCost() = 2808
     WorldView: TeamTechs:GetResearchProgress() = 2599
     WorldView: Subtracting we get 209 science needed; currently generating 235 science with 199 overflow
    
    So apparently 235 science was correctly added, but only 36 was actually needed since 199 overflow occurred. The difference between the 444 science supposedly needed and the 36 actually used is 408; so either the true cost was only 2400 or the true progress on turn 401 was actually 2772.

    I then chose Military Science and that gives the following turn outputs. First the start:
    Code:
     WorldView: Currently Researching Military Science on Turn 402
     WorldView: TeamTechs:GetResearchCost() = 2808
     WorldView: TeamTechs:GetResearchProgress() = 0
     WorldView: Subtracting we get 2808 science needed; currently generating 235 science with 199 overflow
    Then with science + overflow applied on next turn, everything still looks fine.
    Code:
     WorldView: Currently Researching Military Science on Turn 403
     WorldView: TeamTechs:GetResearchCost() = 2808
     WorldView: TeamTechs:GetResearchProgress() = 486
     WorldView: Subtracting we get 2322 science needed; currently generating 237 science with 0 overflow
    
    The next several turns all look normal too:
    Code:
     WorldView: Currently Researching Military Science on Turn 404
     WorldView: TeamTechs:GetResearchCost() = 2808
     WorldView: TeamTechs:GetResearchProgress() = 724
     WorldView: Subtracting we get 2084 science needed; currently generating 238 science with 0 overflow
    
     WorldView: Currently Researching Military Science on Turn 405
     WorldView: TeamTechs:GetResearchCost() = 2808
     WorldView: TeamTechs:GetResearchProgress() = 976
     WorldView: Subtracting we get 1832 science needed; currently generating 251 science with 0 overflow
    
     WorldView: Currently Researching Military Science on Turn 406
     WorldView: TeamTechs:GetResearchCost() = 2808
     WorldView: TeamTechs:GetResearchProgress() = 1230
     WorldView: Subtracting we get 1578 science needed; currently generating 254 science with 0 overflow
    
     WorldView: Currently Researching Military Science on Turn 407
     WorldView: TeamTechs:GetResearchCost() = 2808
     WorldView: TeamTechs:GetResearchProgress() = 1489
     WorldView: Subtracting we get 1319 science needed; currently generating 258 science with 0 overflow
    
     WorldView: Currently Researching Military Science on Turn 408
     WorldView: TeamTechs:GetResearchCost() = 2808
     WorldView: TeamTechs:GetResearchProgress() = 1747
     WorldView: Subtracting we get 1061 science needed; currently generating 258 science with 0 overflow
    
     WorldView: Currently Researching Military Science on Turn 409
     WorldView: TeamTechs:GetResearchCost() = 2808
     WorldView: TeamTechs:GetResearchProgress() = 2002
     WorldView: Subtracting we get 806 science needed; currently generating 254 science with 0 overflow
    
    And the turn after that, Military Science comes in!
    Code:
     WorldView: Currently Researching Military Science on Turn 410
     WorldView: TeamTechs:GetResearchCost() = 2808
     WorldView: TeamTechs:GetResearchProgress() = 2256
     WorldView: Subtracting we get 552 science needed; currently generating 254 science with 10 overflow
    
    With 10 overflow, we have a cost discrepancy this time of 562. Since the Progress was within 2 beakers of the generated science the whole way, it seems that the cost was really 2246. I can't come up with an explanation.
     
  6. MouseyPounds

    MouseyPounds Prince

    Joined:
    Nov 8, 2010
    Messages:
    417
    Location:
    Maryland, USA
    OK, further testing on this and another save indicates that there is a tech cost discount based (at least in part) upon how many known civs have that tech. Whether the bug is the discount itself or the fact that the UI doesn't properly account for it (because TeamTechs:GetResearchCost() doesn't include it) I don't know.

    Here is the evidence for this, spoiled because it's kinda long-winded.
    Spoiler :

    I am using TeamTechs:GetResearchProgress() and Player:GetOverflowResearch() to calculate the true cost of techs. Ending the turn on the OP save will result in Scientific Theory being awarded with progress of 2599 and 199 overflow, so the true cost is 2400.

    On this save, 4 AI civs (all known to the player) already have Scientific Theory and a 5th (Siam) is researching it but is only about 30% done. Because of tests on another game I am pretty confident that Siam's progress doesn't significantly affect the discount, but it's something to watch for if someone else feels like investigating it.

    If we start from the OP save and take Scientific Theory away from everyone, China will switch to it and get it on the in-between turn. With only 1 known civ having Scientific Theory, it takes the displayed 2 turns for the player to get it, but the cost turns out to only be 2700. (2836 spent and 136 overflow)

    Once again starting from the OP and taking Scientific Theory away from everyone, but this time also resetting China's progress will result in the tech costing the actual displayed value of 2808 since the player does not know anyone with it. (2836 spent and 28 overflow)

    Going the other way and giving Scientific Theory to all 6 living AIs on the OP save results in a tech cost of only 2247. (2599 spent and 352 overflow)

    Some things to note on the tech discount:
    • Only known civs count, which is part of why this is more noticeable in the later eras after you've met everyone.
    • The discount applies to everyone. The AIs get it too if they know other civs with the tech they are researching.
    • The discount appears to be affected by changes to the TECH_COST_TOTAL_KNOWN_TEAM_MODIFIER global define (30 by default) but not by changes to the TECH_COST_KNOWN_PREREQ_MODIFIER global define. However I don't currently know the exact formula as there does seem to be something else with a minor influence.
    • A rough approximation is that it is 3-4% per known civ. Note that in the game from the OP the discount was about 3.85% when 1 known civ had the tech and nearly 25% when 6 known civs had it.
     
  7. dshirk

    dshirk Firaxian

    Joined:
    Oct 31, 2005
    Messages:
    879
    We've identified the problem, and will have this one corrected in the next update. The good news is that it's just a UI error, and that gameplay is actually calculating everything correctly.
     
  8. MouseyPounds

    MouseyPounds Prince

    Joined:
    Nov 8, 2010
    Messages:
    417
    Location:
    Maryland, USA
    This can be confirmed fixed. Reloading the OP save in the new patch shows Scientific Theory now correctly reading 2364/2400 and just 1 turn to go.
     
  9. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,974
    Location:
    DE/NL/FR
    Thanks for noticing us about it :).
     

Share This Page