LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
285 stars 158 forks source link

Crash to desktop on AI turn #3421

Closed Mcantona closed 7 years ago

Mcantona commented 7 years ago

_1. Mod version:_8-7-3

2. Mod list (if using Vox Populi only, leave blank): MC's Tunis MC's Tunis Compatibility MC and LITE's Nubia MC and LITE's Nubia CBO Compatibility Canton Pirates- Ching Shih Canton Pirates CBO Compatibility [BNW] Vietnam Civilization - Colonialist Legacies [BNW] Colonialist Legacies Vietnam CBO Compatibility Community Events Unique City-States

3. Error description: Crash to desktop on AI-turn (Canton Pirates).

4. Steps to reproduce (optional): Tried to load an earlier autosave - the CTD always happens on the same AI turn


3. CTD-090817.zip

  1. Screenshots (optional):
LoneGazebo commented 7 years ago

guessing it is canton, someone else mentioned that as being buggy.

TechpriestEnginseer commented 7 years ago

Yeah I'm having extreme difficulties in figuring out why the Cantons are buggy. I'll have to do a deep analysis why and compare the civ to all other civs. It's not their UB, UA, or even the UU.

But this time can you repeat the CTD with logging enabled? I know you have the DLL, but the database.log and lua.log would be nice as well.

@LoneGazebo Perhaps you can help me, what do the crash logs indicate?

Mcantona commented 7 years ago

heres all the log files. I enabled logging in the config.ini this time.

Let me know if you need some more infos/files. ctd_100817.zip

Iamblichos commented 7 years ago

Just briefly looking at this, I think this is crapping out on the Red Junk ship which has a very unnecessary complex algorithm to detect when it is next to another Red Junk ship (with the same promotion).

Question: at what turn are you getting CTD's? Is it before or right around the time when the Canton player has researched Privateers?

Mcantona commented 7 years ago

its on turn 102, thats too early for the red junk ship i guess

Iamblichos commented 7 years ago

Not really. What's the game speed?

LoneGazebo commented 7 years ago

@TechpriestEnginseer what's the code for this ship? If you send me the general idea I could throw it into the DLL, save us all the headache.

Mcantona commented 7 years ago

standard

TechpriestEnginseer commented 7 years ago

There's no code for it in the CBO version. The compatibility version takes that out. In fact this is the only thing that changes the Junk. Every Lua file was replaced with an empty slate and the proper promotions was removed alongside with it as well.

DELETE FROM Unit_FreePromotions WHERE PromotionType = 'PROMOTION_WAR_JUNK_PROMOTION' AND UnitType = 'UNIT_RED_FLEET_JUNK';
INSERT INTO Unit_BuildingClassPurchaseRequireds (UnitType, BuildingClassType) SELECT 'UNIT_RED_FLEET_JUNK','BUILDINGCLASS_HARBOR';

UPDATE Units 
SET Cost = 160, Class = 'UNITCLASS_CARAVEL', PrereqTech = 'TECH_COMPASS', ObsoleteTech = 'TECH_INDUSTRIALIZATION', DefaultUnitAI = 'UNITAI_ATTACK_SEA' 
WHERE Type = 'UNIT_RED_FLEET_JUNK' AND EXISTS (SELECT * FROM COMMUNITY WHERE Type='COMMUNITY_CORE_BALANCE_UNITS' AND Value= 1 );

UPDATE Language_en_US 
SET Text = 'Replaces Caravel. Starts with promotions that excels at both naval combat and raiding cities while boasting a higher [ICON_MOVES] Movement Speed and [ICON_STRENGTH] Combat Strength than the Caravel.'
WHERE Tag = 'TXT_KEY_UNIT_RED_FLEET_JUNK_STRATEGY' AND EXISTS (SELECT * FROM COMMUNITY WHERE Type='COMMUNITY_CORE_BALANCE_LEADERS' AND Value= 1 );

UPDATE Language_en_US 
SET Text = 'Melee naval unit which excels at sea exploration and piracy. Has higher Combat Strength than the Caravel, and starts off with [COLOR_POSITIVE_TEXT]Coastal Rider I[ENDCOLOR] and [COLOR_POSITIVE_TEXT]Boarding Party I[ENDCOLOR]. May only be built by the Cantons.'
WHERE Tag = 'TXT_KEY_UNIT_HELP_JUNK' AND EXISTS (SELECT * FROM COMMUNITY WHERE Type='COMMUNITY_CORE_BALANCE_LEADERS' AND Value= 1 );

UPDATE Civilization_UnitClassOverrides
SET UnitClassType = 'UNITCLASS_CARAVEL' 
WHERE CivilizationType = 'CIVILIZATION_CANTON_PIRATES';

UPDATE Unit_ClassUpgrades 
SET UnitClassType = 'UNITCLASS_PRIVATEER' 
WHERE UnitType = 'UNIT_RED_FLEET_JUNK' AND EXISTS (SELECT * FROM COMMUNITY WHERE Type='COMMUNITY_CORE_BALANCE_UNITS' AND Value= 1 );

My best guess is that the UNITAI_ATTACK_SEA is having problems with the Junk(a replacement of the caravel not privateer) for some reason.

Iamblichos commented 7 years ago

Changing its default Unit AI wouldn't cause a crash per se. It may not be due to this mod at all then.

Mcantona commented 7 years ago

i started a new game without the Pirate-Mod and it works just fine. Im on turn 190 now and there has been no problems at all so far...so I think it was indeed the Pirate-Mod that caused the crashes

TechpriestEnginseer commented 7 years ago

Would

    <Unit_AITypes>
        <Row>
            <UnitType>UNIT_RED_FLEET_JUNK</UnitType>
            <UnitAIType>UNITAI_ATTACK_SEA</UnitAIType>
        </Row>
        <Row>
            <UnitType>UNIT_RED_FLEET_JUNK</UnitType>
            <UnitAIType>UNITAI_RESERVE_SEA</UnitAIType>
        </Row>
        <Row>
            <UnitType>UNIT_RED_FLEET_JUNK</UnitType>
            <UnitAIType>UNITAI_ESCORT_SEA</UnitAIType>
        </Row>
        <Row>
            <UnitType>UNIT_RED_FLEET_JUNK</UnitType>
            <UnitAIType>UNITAI_EXPLORE_SEA</UnitAIType>
        </Row>
        <Row>
            <UnitType>UNIT_RED_FLEET_JUNK</UnitType>
            <UnitAIType>UNITAI_PIRATE_SEA</UnitAIType>
        </Row>
    </Unit_AITypes>

This conflict? I haven't noticed this before they updated the Canton Pirates but it could be possible that some of these multiple Unit_AITypes contradict each other and then cause a wtf do i do with the red junks.

If not then it could be the fact that the author of the mod left the columns empty instead of the using the default which makes this...

  <Units>
    <Row>
      <Type>UNIT_RED_FLEET_JUNK</Type>
      <Description>TXT_KEY_UNIT_RED_FLEET_JUNK</Description>
      <Civilopedia>TXT_KEY_CIVILOPEDIA_UNITS_RENAISSANCE_RED_FLEET_JUNK_TEXT</Civilopedia>
      <Strategy>TXT_KEY_UNIT_RED_FLEET_JUNK_STRATEGY</Strategy>
      <Help>TXT_KEY_UNIT_HELP_JUNK</Help>
      <Requirements></Requirements>
      <Combat>25</Combat>
      <Cost>150</Cost>
      <FaithCost>0</FaithCost>
      <RequiresFaithPurchaseEnabled>0</RequiresFaithPurchaseEnabled>
      <Moves>6</Moves>
      <Immobile>0</Immobile>
      <Range>0</Range>
      <BaseSightRange>2</BaseSightRange>
      <Class>UNITCLASS_PRIVATEER</Class>
      <Special></Special>
      <Capture></Capture>
      <CombatClass>UNITCOMBAT_NAVALMELEE</CombatClass>
      <Domain>DOMAIN_SEA</Domain>
      <CivilianAttackPriority></CivilianAttackPriority>
      <DefaultUnitAI>UNITAI_PIRATE_SEA</DefaultUnitAI>
      <Food>0</Food>
      <NoBadGoodies>0</NoBadGoodies>
      <RivalTerritory>0</RivalTerritory>
      <MilitarySupport>1</MilitarySupport>
      <MilitaryProduction>1</MilitaryProduction>
      <Pillage>1</Pillage>
      <PillagePrereqTech></PillagePrereqTech>
      <Found>0</Found>
      <FoundAbroad>0</FoundAbroad>
      <CultureBombRadius>0</CultureBombRadius>
      <GoldenAgeTurns>0</GoldenAgeTurns>
      <FreePolicies>0</FreePolicies>
      <OneShotTourism>0</OneShotTourism>
      <OneShotTourismPercentOthers>0</OneShotTourismPercentOthers>
      <IgnoreBuildingDefense>0</IgnoreBuildingDefense>
      <PrereqResources>0</PrereqResources>
      <Mechanized>1</Mechanized>
      <Suicide>0</Suicide>
      <CaptureWhileEmbarked>0</CaptureWhileEmbarked>
      <PrereqTech>TECH_NAVIGATION</PrereqTech>
      <ObsoleteTech>TECH_COMBUSTION</ObsoleteTech>
      <GoodyHutUpgradeUnitClass></GoodyHutUpgradeUnitClass>
      <HurryCostModifier>20</HurryCostModifier>
      <AdvancedStartCost>50</AdvancedStartCost>
      <MinAreaSize>10</MinAreaSize>
      <AirInterceptRange>0</AirInterceptRange>
      <AirUnitCap>0</AirUnitCap>
      <NukeDamageLevel>-1</NukeDamageLevel>
      <WorkRate>0</WorkRate>
      <NumFreeTechs>0</NumFreeTechs>
      <BaseBeakersTurnsToCount>0</BaseBeakersTurnsToCount>
      <BaseCultureTurnsToCount>0</BaseCultureTurnsToCount>
      <RushBuilding>0</RushBuilding>
      <BaseHurry>0</BaseHurry>
      <HurryMultiplier>0</HurryMultiplier>
      <BaseGold>0</BaseGold>
      <NumGoldPerEra>0</NumGoldPerEra>
      <SpreadReligion>0</SpreadReligion>
      <RemoveHeresy>0</RemoveHeresy>
      <ReligionSpreads>0</ReligionSpreads>
      <ReligiousStrength>0</ReligiousStrength>
      <FoundReligion>0</FoundReligion>
      <RequiresEnhancedReligion>0</RequiresEnhancedReligion>
      <ProhibitsSpread>0</ProhibitsSpread>
      <CanBuyCityState>0</CanBuyCityState>
      <CombatLimit>100</CombatLimit>
      <RangeAttackOnlyInDomain>0</RangeAttackOnlyInDomain>
      <RangeAttackIgnoreLOS>0</RangeAttackIgnoreLOS>
      <Trade>0</Trade>
      <NumExoticGoods>0</NumExoticGoods>
      <RangedCombatLimit>0</RangedCombatLimit>
      <XPValueAttack>3</XPValueAttack>
      <XPValueDefense>3</XPValueDefense>
      <SpecialCargo></SpecialCargo>
      <DomainCargo></DomainCargo>
      <Conscription>0</Conscription>
      <ExtraMaintenanceCost>0</ExtraMaintenanceCost>
      <NoMaintenance>0</NoMaintenance>
      <Unhappiness>0</Unhappiness>
      <UnitArtInfo>ART_DEF_UNIT_RED_FLEET_JUNK</UnitArtInfo>
      <UnitArtInfoCulturalVariation>0</UnitArtInfoCulturalVariation>
      <UnitArtInfoEraVariation>0</UnitArtInfoEraVariation>
      <ProjectPrereq></ProjectPrereq>
      <SpaceshipProject></SpaceshipProject>
      <LeaderPromotion></LeaderPromotion>
      <LeaderExperience>0</LeaderExperience>
      <DontShowYields>0</DontShowYields>
      <ShowInPedia>1</ShowInPedia>
      <MoveRate>WOODEN_BOAT</MoveRate>
      <UnitFlagIconOffset>0</UnitFlagIconOffset>
      <PortraitIndex>2</PortraitIndex>
      <IconAtlas>CHING_ICON_ATLAS</IconAtlas>
      <UnitFlagAtlas>JUNK_FLAG</UnitFlagAtlas>
    </Row>

Exposed.

LoneGazebo commented 7 years ago

That XML makes my eyes hurt. 90% of that can be removed - if it uses a default value, you don't need to explicitly redefine it in XML.

Also, don't use the UNITAI_PIRATE_SEA. Doesn't do anything.

TechpriestEnginseer commented 7 years ago

@Mcantona Whether you have the time, try the new compatibility test in a tiny or larger match(with the canton in the game ofc) Canton Pirates CBO Compatibility (v 2).zip

Fast forward it as quick as you can into the medieval era where they unlock the Red Fleet Junks. You don't even need to play the game properly and report any CTDs here.

Mcantona commented 7 years ago

I will test it.. im off to my more or less well deserved holiday today though, so it's gonna take a while (back on the 23.)

TechpriestEnginseer commented 7 years ago

Any news @Mcantona

Mcantona commented 7 years ago

i just tried it...unfortunately i still get a CTD during Cantons turn. I tried a quick game and now it happens on turn 92 = 620 AD

TechpriestEnginseer commented 7 years ago

@Mcantona is it possible for you to just play the Canton Pirates without the compatibility? I'm super confused now.

Mcantona commented 7 years ago

i tried a game without any of the compatibility mods now: it worked just fine, i was able to build the gambling house as well as the red fleet junk without any crashes. So there might still be any problem with the compatibility mod i guess. Or the AI does anything weird when playing as Canton?? In order to safe some time i played quite passive, but i did try to attack with the red fleet junk and that didnt cause a crash either.

TechpriestEnginseer commented 7 years ago

It must be when I made one of the Lua obsolete then... there's an obscure lua reference somewhere then. Thanks for your help!

Mcantona commented 7 years ago

You are welcome! Just let me know if you need some more testing.