1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Debugging MagisterModMod

Discussion in 'More Naval AI Modmod' started by Tholal, Aug 11, 2017.

  1. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,672
    @MagisterCultuum - Thanks for the alpha and save.

    First issue found.
    • CIV4UnitInfos.xml - UNITCLASS_ARTIST - You have a stray '3' outside of the XML tags in the UnitClassUpgrades section
    Also looks like you have hardcoded paths to Magister Modmod in several places. This will break anyone trying to run it from a different directory.
     
  2. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,672
    changeFreeBonus() - FAssert(getFreeBonus(eIndex) >= 0);

    This happens when switching religions and looks to be related to your ReligiousMana section in onPlayerChangeStateReligion. Players are ending up with negative mana values. This may be By Design on your part? If so, it's not gamebreaking but it may confuse the AI at some points. And it also results in a cascade of other asserts related to bonuses.
     
  3. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,672
    This is related to trying to play a movie for the Market.
     
  4. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,672
    CvSpellInterface.py - you're missing some indentation between lines 15954 and 15959
     
  5. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    15,601
    Location:
    Kael's head
    I don't know how that 3 got there, but of course removed it promptly.

    It is intentional for the religious mana buildings to subtract some mana.

    (Originally I only wanted the religion to provide -1 mana in the opposing sphere, but a +1 kept being read as a +3. I just did a quick test, and found that a -1 now seems to be read as a +5 now.)

    I've never had any problems with this before. None of those bonus related asserts seem to be anything other but a minor annoyance to be hidden in debug mode and never even noticed otherwise.

    At what points would it confuse the AI?

    Why would it be trying to play a move for the Market? That building never had any movies associated with it, and I pretty much always play with movies turned off.

    I don't think there actually was any missing indentation there. I use "break" and "continue" statements there right after the colon. If the "then" part of an "if-then" statement is a single line, then it is perfectly acceptable in python to place it on the same line right after the colon rather than using any indentation.

    Just to make things clearer though, I moved those statements to the next line, indented them, and put the following code in (probably unnecessary) "else" statements.


    As far as I can tell, nothing you have mentioned yet is at all related to the crash though. Have you any clue what is causing that last assert?
    Code:
    Assert Failed
    
    File:  CvGlobals.cpp
    Line:  1845
    Expression:  eImprovementNum > -1
    Message:  
    
     
  6. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    15,601
    Location:
    Kael's head
    In started a new game and I came across these new Asserts, but no crash yet.

    Code:
    
    Assert Failed
    
    File:  CvTeam.cpp
    Line:  7510
    Expression:  eTeam < MAX_CIV_TEAMS
    Message:  eTeam is expected to be within maximum bounds (invalid Index)
    
    ----------------------------------------------------------
    
    Assert Failed
    
    File:  CvPlot.cpp
    Line:  8626
    Expression:  getStolenVisibilityCount(eTeam) >= 0
    Message:
    
    ----------------------------------------------------------
    
    Assert Failed
    
    File:  CvTeamAI.cpp
    Line:  3726
    Expression:  !isAtWar(eWarTeam)
    Message:  should be at peace with eWarTeam
    
    ----------------------------------------------------------
    Assert Failed
    
    File:  CvUnit.cpp
    Line:  11925
    Expression:  !at(iX, iY)
    Message:
    
    ----------------------------------------------------------
    Assert Failed
    
    File:  CvUnit.cpp
    Line:  12519
    Expression:  pOldPlot != pNewPlot
    Message:
    
    ----------------------------------------------------------
    
    Assert Failed
    
    File:  c:\users\phil\desktop\projects\cvgamecoredll\CvPlayerAI.h
    Line:  25
    Expression:  ePlayer != NO_PLAYER
    Message:  Player is not assigned a valid value
    
    ----------------------------------------------------------
    Assert Failed
    
    File:  CvGame.cpp
    Line:  5798
    Expression:  getBuildingClassCreatedCount(eIndex) <= GC.getBuildingClassInfo(eIndex).getMaxGlobalInstances()
    Message:  Index is expected to be within maximum bounds (invalid Index)
    
    ----------------------------------------------------------
    Assert Failed
    
    File:  CvCity.cpp
    Line:  1517
    Expression:  isNoBonus((BonusTypes)iI) || getNumBonuses((BonusTypes)iI) >= ((isConnectedToCapital()) ? (GET_PLAYER(getOwnerINLINE()).getBonusImport((BonusTypes)iI) - GET_PLAYER(getOwnerINLINE()).getBonusExport((BonusTypes)iI)) : 0)
    Message:
    
    ----------------------------------------------------------
    
    Assert Failed
    
    File:  CvUnit.cpp
    Line:  12722
    Expression:  getMoves() >= 0
    Message:
    
    ----------------------------------------------------------
    
    
    Assert Failed
    
    File:  CvInfos.cpp
    Line:  2669
    Expression:  i > -1
    Message:  Index out of bounds
    
    ----------------------------------------------------------
    
    Assert Failed
    
    File:  CvSelectionGroupAI.cpp
    Line:  228
    Expression:  false
    Message: 
    
    ----------------------------------------------------------
    Assert Failed
    
    File:  CvGlobals.cpp
    Line:  3741
    Expression:  strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
    Message:  info type RevealPlot not found, Current XML file is: xml\GameInfo/CIV4EspionageMissionInfo.xml
    
    ----------------------------------------------------------
    Assert Failed
    
    File:  CvPlayerAI.cpp
    Line:  14710
    Expression:  false
    Message: 
    
    ----------------------------------------------------------
    Assert Failed
    
    File:  CvPlayer.cpp
    Line:  11277
    Expression:  getTotalLandScored() >= 0
    Message: 
    
    ----------------------------------------------------------
    Assert Failed
    
    File:  CvPlayer.cpp
    Line:  13239
    Expression:  getLandScore() >= 0
    Message:  
    
    ----------------------------------------------------------
    
    
    I imagine the one that gives a path to a file on your desktop rather than in the same directory as the rest of the DLL source files is in no way my fault but something that should be fixed in MNAI too.
     
    Last edited: Aug 13, 2017
  7. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,672
    There are some points in which the AI might use the number of bonuses it has to calculate some value. Negative values could cause unexpected results. I don't have any specific examples, just wanted to mention the possibility


    No idea. I'm just reporting on the information the DLL is receiving from python. I imagine there is an incorrect value being sent in this case.



     

Share This Page