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

Single Player bugs and crashes v40 plus (SVN) - After Oct 2019

Discussion in 'Bugs and Crashes' started by Thunderbrd, Oct 20, 2019.

  1. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,010
    Location:
    Norway
    @MattCA I think this crash may be caused by some of your recent parallel map specific changes.

    This code:
    Code:
    CvUnit* CvPlayer::addUnit()
    {
    #ifdef PARALLEL_MAPS
        return m_units[GC.getGame().getCurrentMap()]->add();
    #else
        return m_units.add();
    #endif
    }
    Can now return NULL, this never happened before afaik.

    Edit: {
    This is just a 5 minutes initial assessment. haven't used the VS debugger, just seen that this assert happen right before the CTD : ↓
    CvPlayer::initUnit(....)
    CvUnit* pUnit = addUnit();
    FAssertMsg(pUnit != NULL, "Unit is not assigned a valid value");
    And then this one right after (just a continuation of the above issue) : ↓
    CvUnit::upgrade(...)
    pUpgradeUnit = GET_PLAYER(getOwner()).initUnit(...)
    FAssertMsg(pUpgradeUnit != NULL, "UpgradeUnit is not assigned a valid value");​
    }
    EditEdit:
    I can't spot any errors in your change there though... Perhaps the error is caused by something unrelated.
    Next step is to figure out why "T* FFreeListTrashArray<T>::add()" may return NULL; or to run the save in VS debugger and perhaps add some extra logging related to max unit counts and so on.
    Maybe the array is full?
     
    Last edited: Sep 14, 2020
  2. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,563
    Gender:
    Male
    Location:
    MN
    started new game and i get this after about 15 turns and then it completely stalls .. . . .

    Traceback (most recent call last):
    File "C2C_Tectonics", line 183, in addRivers
    File "MapScriptTools", line 2177, in buildBigBogs
    File "MapScriptTools", line 3145, in deleteNonBogPlots
    NameError: global name 'p1' is not defined
    ERR: Python function addRivers failed, module C2C_Tectonics
    Traceback (most recent call last):
    File "CvScreensInterface", line 514, in forceScreenRedraw
    File "CvMainInterface", line 1383, in redraw
    File "CvMainInterface", line 4942, in updatePlotHelp
    RuntimeError: unidentifiable C++ exception



    Now no matter what autosave i go to it says "You have been defeated"
     
    Last edited: Sep 14, 2020
  3. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,010
    Location:
    Norway
    Ok, this one was easy fix, was just a typo where pl was written as p1 in one spot.

    Untitled-1.png
    Not easy to spot the typo, the left one is p1 and the right one is pl. ^^
     
    strategyonly likes this.
  4. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,010
    Location:
    Norway
    Additional observation on this is that one of the AI have close to 20 000 units from what I can gather by looking at their unit upkeep.
    I should add a unit count for each player in the debug UI as accessible in-game information.
     
  5. MattCA

    MattCA Prince

    Joined:
    Jan 25, 2019
    Messages:
    315
    Gender:
    Male
    That change is turned off on regular dll.
    Looks like there may be a max but its hard to read.

    #define FLTA_ID_SHIFT (13)
    #define FLTA_MAX_BUCKETS (1 << FLTA_ID_SHIFT)
    #define FLTA_INDEX_MASK (FLTA_MAX_BUCKETS - 1)
    #define FLTA_ID_MASK (~(FLTA_INDEX_MASK))
    #define FLTA_GROWTH_FACTOR (2)

    if ((m_iNumSlots * FLTA_GROWTH_FACTOR) > FLTA_MAX_BUCKETS)
    {
    return NULL;
    }

    what does (1 << 13) mean?
     
  6. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,010
    Location:
    Norway
    It's a leftward bit-shift 13 times and equals 8192
    Binary
    1 →10 →100 →1000 → .... → 10000000000000 (= 2^13 = 8192)​
    Decimal
    1 → 2 → 4 → 8 → .... → 8192​
     
  7. MattCA

    MattCA Prince

    Joined:
    Jan 25, 2019
    Messages:
    315
    Gender:
    Male
    Jeez, can't say I understand that, but that would mean the line from FFreeListTrashArray<T>::add() says:
    if ((m_iNumSlots * 2) > 8192)
    {
    return NULL;
    }

    only a max of 4100 assuming 1 unit takes 1 slot. Does that sound possible? Seems low.
     
  8. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    27,788
    Gender:
    Male
    Location:
    Las Vegas
    It's about binary math and the way numbers are stored in binary form. It's... ugly stuff.
     
    MattCA likes this.
  9. Harrier

    Harrier Deity

    Joined:
    Feb 19, 2002
    Messages:
    2,414
    Location:
    UK
    No - binary is lovely, used it a lot in the early 70s. :lol::crazyeye::thumbsup: :mischief::mischief::mischief:
    .
     
  10. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    27,788
    Gender:
    Male
    Location:
    Las Vegas
    I hate it. I get that computers have to understand it but having to understand it myself... ugh.
     
  11. MattCA

    MattCA Prince

    Joined:
    Jan 25, 2019
    Messages:
    315
    Gender:
    Male
    Am I supposed to have d3dx9.dll somewhere in my civ files or is that a windows thing? I don't think I'll get a chance to see if I'm right tonight. I can make a branch if someone else wants to check. Then if I'm right I'll need to know if you guys want the max raised.
     
  12. MattCA

    MattCA Prince

    Joined:
    Jan 25, 2019
    Messages:
    315
    Gender:
    Male
    // Max number of barbarian units in existence for a spawn of a new one to be allowed
    // This allows a 'space' for 'real' barbarians to be built before we use up the entire
    // simultaneous unit space of 8191 for any one player
    #define MAX_BARB_UNITS_FOR_SPAWNING 7000
     
  13. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,563
    Gender:
    Male
    Location:
    MN
    new SVN didnt change the crash, it still crashes . .
     
  14. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,010
    Location:
    Norway
    Yes, I know. It looks like you have reached a maximum limit for number of units a player can have before the game CTD's.
    Your save is kinda fried, but maybe you can salvage it by deleting 1 or 2 thousand units from the map, take more from the players that have the most.

    We might be able to fix the root problem, but it will take more than 1 day.
    There are two ways to respond to this CTD, one is to raise the max limits if possible, the other is to write AI code to delete or stop training units more appropriately so that AI's manage their unit counts more reasonably.
    The latter approach is more complex and will take longer time.
     
    strategyonly likes this.
  15. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,563
    Gender:
    Male
    Location:
    MN
    Yeppers , deleted a whole civ and a few of the biggest pop cities and it worked then, so u r correct then. . . thx . .


    EDIT: but then after the first turn after deleting them, it crashed again??
     

    Attached Files:

    • US.zip
      File size:
      4.1 MB
      Views:
      8
  16. Schwarzbart

    Schwarzbart Prince

    Joined:
    Jul 21, 2009
    Messages:
    524
    In game version v40.1.2555 I had wondered why my resources where not connected over the ocean despite having the necessary tech to trade over ocean and my cities have trade routes that go over the ocean.
    Today I updated to the newest SVN and made the recalculation and suddenly the 2 city on the isle that are only connected trough the ocean have all the resources available there as well.
    If there was a fix on this issue then forget about this report otherwise you might want to check if there is a issue on the turn updates with trade over the ocean.
    (Note for my self: I updated after the AD 851 save in case the team need a save)
     
  17. JosEPh_II

    JosEPh_II TBS WarLord

    Joined:
    Jun 20, 2007
    Messages:
    16,200
    Gender:
    Male
    Location:
    Western IL. cornfields
    You really need to do what this link shows on how to set up and use the SVN to keep your copy of Caveman2Cosmos up to date and current with bug fixes applied. https://forums.civfanatics.com/threads/c2c-svn-changelog.429816/

    You version is 240 iterations Old now. Many fixes and changes have happened since v40.1.2555.
     
  18. Schwarzbart

    Schwarzbart Prince

    Joined:
    Jul 21, 2009
    Messages:
    524
    I decided that I get the newest version when I start a game but then only update when I encounter some really troublesome bugs. The reason is that when keeping the game on the newest svn it changed the game to much in my past games when it takes me months to play a single one. (i.e. Units got stronger / weaker, important buildings / unit complete changed where they are in the tech tree and so on). Also didn't the team recently made a change that where broken to the point where it was told to not update the games to the current svn for a time?
     
  19. primem0ver

    primem0ver Emperor

    Joined:
    Jun 16, 2006
    Messages:
    1,138
    Gender:
    Male
    Location:
    Peoria, AZ
    The Toxic Waste Dump national wonder doesn't seem to do anything positive... did someone forget a stat or two? I am not going to build it in its current state. I am not sure what kind of waste values exist but it should probably nationally lower city waste (unhealthy values), bio-hazardous waste, and nuclear waste for the negatives that it gives. If you want me to fix it I can (and perhaps will anyway since right now I have a significant unhealthy issue.)
     
  20. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    27,788
    Gender:
    Male
    Location:
    Las Vegas
    I'm pretty sure it is meant to enable positive buildings to be built in all other cities once you've built that somewhere. It's a 'NIMBY' building (Not In My Back Yard) that is meant to suck for the city you place it in but give benefits to everywhere else. If those benefits aren't obvious, it's probably due to the buildings it enables not being mentioned except in those buildings.
     

Share This Page