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

AND2 and SVN Bug Reports - A New Dawn 2 ONLY

Discussion in 'Rise of Mankind: A New Dawn' started by 45°38'N-13°47'E, Aug 31, 2012.

  1. valergrad

    valergrad Chieftain

    Joined:
    May 26, 2013
    Messages:
    98
    1. About "culture ( Sikstine capelle? ) bug" - I can't investigate it as at your screen it is move 407. And you've attached move 397, where Tiwuanaku is in anarchy, and Sikstine capelle hasn't built. If you attach save for move 407 with this bug - I'll look.

    2.
    About text - you can fix it yourself.
    Find file:

    Beyond the Sword\MODS\Rise of Mankind - A New Dawn\Assets\XML\Text\MISC.xml

    And there find tags:
    TXT_KEY_HEADING_CONNECTED_CITY_AMT
    TXT_KEY_HEADING_CONNECTED_FOREIGN_CITY_AMT

    And there you can find your language and set what you want)
    Or ask somebody with access to github set text there)


    3. about "Recalc deletes foreign great specialists"

    Interesting. Recalc should work in completely same way for your and foreign cities, so if recalc doesn't destroy your great persons, why it should destroy foreign GP? Could you next time store save right before you losing them and send it?

    4. "It was already reported in this thread that specialists that are obtained through razing get deleted" - yes, that's true. I can try make a fix for it if 45°38'N-13°47'E don't want to do it himself. Looks not complicated from the first sight, but I don't know what will be with the old saves after I'll create variable for this - never did this.

    5. Realistic corporations - for me this options have no sense, looks like true random, so I always turn it off) I have some very good ( in my mind ) idea how to make this not so random and interesting at the same time - may be I'll find some time to code this...
     
  2. valergrad

    valergrad Chieftain

    Joined:
    May 26, 2013
    Messages:
    98
    Hi, about this "incorrect culture" bug. I've took your save from move 407 and found the root cause and how to fix it.
    Good thing that it will fix this "extra science from Leonardo workshop bug" and "Extra culture from from Sistine Chapel bug" as well - this is just one bug.

    To start the fix this we will add in function ( this is just reporting ) :


    void CvGameTextMgr::setCommerceHelp(CvWStringBuffer &szBuffer, CvCity& city, CommerceTypes eCommerceType)


    this line from

    int iSpecialistCommerce = city.getSpecialistCommerce(eCommerceType) + (city.getSpecialistPopulation() + city.getNumGreatPeople()) * city.getExtraSpecialistCommerceTotal(eCommerceType) ;


    change to

    int iSpecialistCommerce = city.getSpecialistCommerce(eCommerceType) + (city.getSpecialistPopulation() + city.getNumGreatPeople()) * city.getExtraSpecialistCommerceTotal(eCommerceType) +
    (city.getSpecialistPopulation() + city.getNumGreatPeople()) * owner.getSpecialistExtraCommerce(eCommerceType);



    As you see: I've added additional term: extra commerce for specialist at player-level, previously it was city-level only.
    There are 4 buildings that change commerce from specialist at player-level : Leonardo Workshop, Sistine Chapel, Bunrning Man and Karnak temple. Any of them will make this report incorrect.


    But this is not all. Still this city have incorrect culture. This is because function city.getNumGreatPeople() that actually should calculate free specialists, returns for Tiwanaku 4, but it actually has 0 free specialist. Moreover, if you look at city Turfan - for it this function returns 67 free specialists, but it has only 4. This explains 12 extra culture in Tiwanaku ( real value should be 76.50 ) , and more than 200 extra culture in Turfan ( it has 400+, but correct value is 200+ ). To make long story short - this is again recalc issue ( you can check it but running recalc for your save several times - your culture will grow after each recalc).

    To fix it we, as usual, add in function void CvCity::clearModifierTotals(), add

    m_iNumGreatPeople = 0;

    at the end.


    this will fix the issue.
    After recalc you'll get less science and culture than you have now - because game currently think that you have 67 free specialists in Turfan etc. etc, but truth is better then money)
     
    Last edited: May 10, 2020
  3. valergrad

    valergrad Chieftain

    Joined:
    May 26, 2013
    Messages:
    98
    This can possibly hint at why the specialists taken from razed cities go away too.
    To reproduce, load the save attached to this post, the game will propose a recalc, don't do it, got to Tiwanaku (freshly conquered) : there are 4 great persons planted ; do a recalc, they go away. By comparison, there is a great specialist planted in Old Sarai by myself, it stays.


    That is true. I've started looking at it, it is reproducing, but I can't understand how it works - something tricky. Do you have accidentally save one move before, from move 396?



     
    Last edited: May 10, 2020
  4. IPEX-731BA5DD06

    IPEX-731BA5DD06 Deity

    Joined:
    Dec 15, 2005
    Messages:
    2,742
    Location:
    Melbourne, Victoria, Australia
    I had a look at it, couldn't see anything obvious happening. Though, I did have some red dots for some units in Japan only, that I didn't have the unit graphics for. That's happened for Japan before for me, so?? and it was 2 saves posted Here
     
  5. Zepolak

    Zepolak Chieftain

    Joined:
    Apr 1, 2020
    Messages:
    10
    Amazing job Valergrad, really :thumbsup:
    67 hidden free specialist, God :eek:
    It kinda gives away how many recalcs I've done in that game (especially when I was banging my head against the imperium bug - such a great fix, well done) :)

    Turn 397 is the first turn I own Tiwanaku in that game, but the great specialist only go away when a recalc is done, uh, I think.
    Actually, I can try to double-check that.
    Also, I own a few ex-Roman cities and there's no GP there while I am 100% sure there were some GP planted when I captured the cities. There are sleeping GPs in the city Beshbalik if that can help in reproducing maybe.
     
  6. valergrad

    valergrad Chieftain

    Joined:
    May 26, 2013
    Messages:
    98
    "Turn 397 is the first turn I own Tiwanaku in that game"

    That's true... But how it works: This great people that you have from GP joins ( and also raze cities ) : they are stored addtionally in special variable to not lost them during recalc - m_paiFreeSpecialistCountUnattributed. That was the idea, I guess. But in your save. this variable is already zero - so you have them only in m_paiFreeSpecialistCount. Recalc zeroes this m_paiFreeSpecialistCount, so they lost after first recalc. But what is not clear: why we don't have them in m_paiFreeSpecialistCountUnattributed ? How it lost from this variable ( it is not touched during recalc )? So, I wanted save before conquering the city to check that they were there at that time.
     
  7. os79

    os79 Deity

    Joined:
    Mar 14, 2009
    Messages:
    3,094
    Location:
    Eastern USA Coast
    Thank you IPEX for trying. Hopefully someone else will be able to find the bug that CTD this.

    Oops yeah I see two saves in my post. My mistake. Thanks for letting me know. EDIT: Deleted one save from the post.
     
  8. Zepolak

    Zepolak Chieftain

    Joined:
    Apr 1, 2020
    Messages:
    10
    Sorry for the delay, I am spending my free time trying to understand what's wrong with my computer, which crashes my games.
    Attached is the savegame : there's plenty of troops (actually, not that many but very high quality :) ) near Tiwanaku if you wanna conquer it. There are also some sleeping GPs in Karakorum if planting them can help debug.
     

    Attached Files:

  9. IPEX-731BA5DD06

    IPEX-731BA5DD06 Deity

    Joined:
    Dec 15, 2005
    Messages:
    2,742
    Location:
    Melbourne, Victoria, Australia
    OS79, do you have a save from a couple of turns earlier?? that one just crashes immediately. Not producing a log, or I've set it up wrong.

    An earlier save, might give some indication, if only 1 or 2 turns.
     
  10. os79

    os79 Deity

    Joined:
    Mar 14, 2009
    Messages:
    3,094
    Location:
    Eastern USA Coast
    OK, next time any CTD happen again, I'll upload the usual before crash save and the last autosave before the crash. Thanks for the suggestion. Sadly for the last save I uploaded, I had moved on to next game.
     
  11. valergrad

    valergrad Chieftain

    Joined:
    May 26, 2013
    Messages:
    98
    Hi Zepolak.
    I've looked at your save and have found the bug in the code that cause to lose specialists after conquer the city and later recalc. Fix is quite easy)

    In function CvPlayer::acquireCity

    we are creating new city ( belonging to us ) , copying data from old city and deleting old city ( I don't know why so complicated approach... but it is like this ).
    Somebody haven't forgot about this extra specialists and wrote this code to copy it into new city:

    for (iI = 0; iI < GC.getNumSpecialistInfos(); ++iI)
    {
    pNewCity->changeFreeSpecialistCount((SpecialistTypes)iI, aeFreeSpecialists[iI]);
    }

    The problem is that it is copying this specialists info into array m_paiFreeSpecialistCount. And this array is zeroed during recalc -> this is where we are losing this info. To not lose it we need to copy it into parallel array m_paiFreeSpecialistCountUnattributed as well. And this is easy: just set flag bUnattributed = true in this code. So, in two words to fix this, we need change in function CvPlayer::acquireCity from:


    for (iI = 0; iI < GC.getNumSpecialistInfos(); ++iI)
    {
    pNewCity->changeFreeSpecialistCount((SpecialistTypes)iI, aeFreeSpecialists[iI]);
    }

    to

    for (iI = 0; iI < GC.getNumSpecialistInfos(); ++iI)
    {
    pNewCity->changeFreeSpecialistCount((SpecialistTypes)iI, aeFreeSpecialists[iI], true);
    }

    And as I've checked - you are not losing specialist after conquer anymore) ( but those who already lost... you can't return them ).
     
    Last edited: May 16, 2020
  12. valergrad

    valergrad Chieftain

    Joined:
    May 26, 2013
    Messages:
    98
    Another thing - is specialists relocated after razing foreign city. We also losing them after recalc. It is a little bit more harder to solve - I had to create parallel variable m_iFreeSpecialistUnattributed and change in many places it's usage, but it looks like it works too.
    If 45°38'N-13°47'E is interested I can upload files with my fixes.
     
  13. IPEX-731BA5DD06

    IPEX-731BA5DD06 Deity

    Joined:
    Dec 15, 2005
    Messages:
    2,742
    Location:
    Melbourne, Victoria, Australia
    I got it to work for 3 turns, by deleting a Persian city, but it ended up crashing out of memory again anyway, I don't think you can continue %:):::

    Oh, I also got it working, by ;
    1) I entered world builder.
    2) I just saved the game.
    3) Exit to main title, begin a new game, Custom scenario
    4) Select Japan as Race
    5) Start game, oh deselect conquest victory.

    Trouble is, it thinks you doing a start in 6000 BC, and as a result, you tech is SEVERLY NERFED. over 130 Million beakers to research a tech, You need to alter the starting year to spring 1942, I'm not sure on how to do that, couldn't find it in the save game text file (open saved game with a word processor program)

    Maybe even if you did change that?? :dunno:
     
    Last edited: May 18, 2020
  14. os79

    os79 Deity

    Joined:
    Mar 14, 2009
    Messages:
    3,094
    Location:
    Eastern USA Coast
    Thanks for your thoiughts.
     
  15. IPEX-731BA5DD06

    IPEX-731BA5DD06 Deity

    Joined:
    Dec 15, 2005
    Messages:
    2,742
    Location:
    Melbourne, Victoria, Australia
    I actually fixed the game, I just turned off Realistic time scale. I only realized today when I was thinking about it.

    Played 10 turns, seem fine, though, you seem stronger then I remember from before.

    The AI will adopt a slew of civic changes as well, crippling their research initially. Seems fine
     
  16. robbyextreme

    robbyextreme Warlord

    Joined:
    Oct 4, 2003
    Messages:
    263
    Hey anybody know what's with this error when updating from 1087 to 1089? trying to help a friend install the mod. He's using windows7
    I have googled the error message all the results say to re-install microsoft visual c++ redistributor packages which we have tried.
     

    Attached Files:

  17. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    4,314
    Gender:
    Male
    Location:
    In a constant brainstorm...
    Would it be possible to get some report when a unit takes damage from movement limit/terrain damage? It is very annoying when your unit disappears without any hint and you only realize it only 20+ turns later that an important unit is missing :mad:
     
  18. IPEX-731BA5DD06

    IPEX-731BA5DD06 Deity

    Joined:
    Dec 15, 2005
    Messages:
    2,742
    Location:
    Melbourne, Victoria, Australia
    @ robyextreme, what it is, the updater isn't deleting the file "updating" in you AND folder.
    Just delete this file, and it should work fine.
     
    robbyextreme likes this.
  19. robbyextreme

    robbyextreme Warlord

    Joined:
    Oct 4, 2003
    Messages:
    263
    Thanks that worked
     
  20. os79

    os79 Deity

    Joined:
    Mar 14, 2009
    Messages:
    3,094
    Location:
    Eastern USA Coast
    Thanks, IPEX :). Hmm... turning off Realistic Timescale? Ok then we will someone familiar with the underlying code to ensure that doesn't happen again. I'm seriously thinking of eliminating Realistic Timescale from future games as it doesn't help other than "feeling of proper era." That feeling is good for roleplaying but not single player type of game, I'm starting to opine.

    Well, thank you again IPEX. I'll like to leave your and my saves as tools for analysis of that if Realistic Timescale is that important. I think other bugs have higher priority (Movement Limitation and final tree of all stuff in-game.)

    Cheers to all and enjoy your weekend.
     

Share This Page