new patch release

Status
Not open for further replies.
Hmm, it didn't seem to me like that, in one of the games Arabia as the clear #1 in the game still puppeted all the cities despite, as far as I could tell, being very happy. But I could have been mistaken. Thanks for the explanation!
 
Thanks, James, that's what I wanted to say.

And I'm not complaining or anything, as their opponent I'm glad that they're not annexing tradition capitals, but it seems suboptimal. On the other hand in my current game Carthage annexed three conquered city states and two Mayan cities. So it seems there's a big difference between tradition and non-tradition civs?

Hmm, it didn't seem to me like that, in one of the games Arabia as the clear #1 in the game still puppeted all the cities despite, as far as I could tell, being very happy. But I could have been mistaken. Thanks for the explanation!

Remember that annexed cities add a penalty to Tourism output...
 
Ah, thanks for the explanation! So the Tradition civs don't annex them because they're going (also) for a culture victory? But wouldn't it make sense to annex at least the conquered capitals, given how strong they are?
 
Ah, thanks for the explanation! So the Tradition civs don't annex them because they're going (also) for a culture victory? But wouldn't it make sense to annex at least the conquered capitals, given how strong they are?

More likely it's to do with happiness or city yields being lower in comparison with their own cities, but the end effect is similar. Civs going for science or culture victories shouldn't be annexing everything, and their cities tend to have higher yields than a wide civ's, so the cities they choose to puppet are less valuable to them.

I can go through the code later and add an exception for original capitals, it's almost always advantageous to annex those.
 
let me push my changes first :)

okay :)

I looked through the code and civs going for culture victory indeed don't annex! Doesn't seem to factor in anything else, either (unless the city originally belonged to them, in which case they annex before this function is called)...this logic could definitely use improvement.
Code:
void CvPlayerAI::AI_considerAnnex()
{
   AI_PERF("AI-perf.csv", "AI_ considerAnnex");

   // if the empire is very unhappy, don't consider annexing
   if (IsEmpireVeryUnhappy())
   {
       return;
   }

   // if we're going for a culture victory, don't consider annexing
   if (GetDiplomacyAI()->IsGoingForCultureVictory())
   {
       return;
   }

   // for Venice
   if (GetPlayerTraits()->IsNoAnnexing())
   {
       return;
   }

   // if their capital city is puppeted, annex it
   CvCity* pCity = getCapitalCity();
   if (pCity && pCity->IsPuppet())
   {
       // we should only annex one city a turn, and sense this is one, we're done!
       pCity->DoAnnex();
       return;
   }

   //annex holy city for faith use
   if (GetReligions()->GetCurrentReligion(false) != NO_RELIGION && pCity->GetCityReligions()->IsHolyCityForReligion(GetReligions()->GetCurrentReligion(false)))
   {
       pCity->DoAnnex();
       return;
   }

   BuildingClassTypes eCourthouseType = NO_BUILDINGCLASS;
   // find courthouse
   for (int eBuildingType = 0; eBuildingType < GC.getNumBuildingInfos(); eBuildingType++)
   {
       const BuildingTypes eBuilding = static_cast<BuildingTypes>(eBuildingType);
       CvBuildingEntry* buildingInfo = GC.getBuildingInfo(eBuilding);

       if (buildingInfo)
       {
           if (buildingInfo->IsNoOccupiedUnhappiness() && canConstruct(eBuilding))
           {
               eCourthouseType = (BuildingClassTypes)buildingInfo->GetBuildingClassType();
               break;
           }
       }
   }

   //Can't build a courthouse? Abort!
   if (eCourthouseType == NO_BUILDINGCLASS)
       return;

   int iLoop = 0;
   for (pCity = firstCity(&iLoop); pCity != NULL; pCity = nextCity(&iLoop))
   {
       //if we're already converting one, stop!
       if (pCity->IsOccupied() && !pCity->IsNoOccupiedUnhappiness())
           return;
   }

   std::vector<CityAndProduction> aCityAndProductions;
   pCity = NULL;
   for(pCity = firstCity(&iLoop); pCity != NULL; pCity = nextCity(&iLoop))
   {
       //simple check to stop razing "good" cities
       if (pCity->IsRazing() && pCity->HasAnyWonder() && !IsEmpireVeryUnhappy())
           unraze(pCity);

       if (pCity->IsResistance())
           continue;

       if (!pCity->IsPuppet())
           continue;

       //Original City and puppeted? Stop!
       if(pCity->getOriginalOwner() == GetID())
       {
           pCity->DoAnnex();
           return;
       }

       if (pCity->IsOriginalMajorCapital())
       {
           pCity->DoAnnex();
           return;
       }

       if (pCity->isBorderCity() || pCity->isCoastal())
       {
           pCity->DoAnnex();
           return;
       }

       CityAndProduction kEval;
       kEval.pCity = pCity;
       kEval.iProduction = pCity->getYieldRateTimes100(YIELD_PRODUCTION, false);
       aCityAndProductions.push_back(kEval);
   }
 
   std::stable_sort(aCityAndProductions.begin(), aCityAndProductions.end(), CityAndProductionEval());
 
   CvCity* pTargetCity = NULL;
   float fCutoffValue = /*0.55*/ GC.getNORMAL_ANNEX();

   bool bCourthouseImprovement = false;
   if (eCourthouseType != NO_BUILDINGCLASS)
   {
       if (GetPlayerPolicies()->GetBuildingClassProductionModifier(eCourthouseType) > 0)
       {
           bCourthouseImprovement = true;
       }
   }

   if (bCourthouseImprovement)
   {
       fCutoffValue = /*0.8*/ GC.getAGGRESSIVE_ANNEX();
   }

   uint uiCutOff = (uint)(aCityAndProductions.size() * fCutoffValue);
   for (uint ui = 0; ui < uiCutOff; ui++)
   {
       if (aCityAndProductions[ui].pCity->IsPuppet())
       {
           pTargetCity = aCityAndProductions[ui].pCity;
           break;
       }
#if defined(MOD_BALANCE_CORE)
       if(aCityAndProductions[ui].pCity->IsRazing())
       {
           pTargetCity = aCityAndProductions[ui].pCity;
           break;
       }
#endif
   }

   if (pTargetCity)
   {
       if (pTargetCity->IsRazing())
           unraze(pTargetCity);

       if (!pTargetCity->IsResistance())
           pTargetCity->DoAnnex();
   }
}
 
Last edited:
Code has been adjusted by ilteroi and myself. Should be smarter! :)
 
I receive a trade deal with someone I'm at war with (it was askia). It's not negative but instead 779m turns. Best deal ever.
upload_2020-12-2_10-55-25.png

It was a multiplayer game tho, maybe that was a reason? (the most change I added in the modpack is 3rd component, and 3 people one tile)
Spoiler :

upload_2020-12-2_10-58-42.png


Was trying out directx9, non-eui VP to see if it reduces resyncs (fast reloads). but it didn't help much, I got resync after 55 turns (better than with barbs turned on tho). I also removed barbarian and city-states in a king difficulty conquest only game. My brother wasn't amused however as he was mauled by Aztecs haha.
Spoiler :

upload_2020-12-2_11-3-5.png


(Enhanced Demographics as opposed to info addict) Songhai had plenty of troops uwu. In the end we scrapped the game because it was already 5am. I can't wait for the new hotfix for the latest update!
 
@ilteroi , I wanted to commend you on the great work on the strategic/tacticalAI, in my last game on this patch I was leading the game in techs around turn 310 when Carthage as the score leader showed up with around 20-25 ships and 20-25 land units on the doorstep of my coastal capital. A really lovely surprise, I loved to see a great last-ditch attempt by the AI. The only thing missing was a carrier or a sub with nukes to set my capital ablaze, in fact I don't remember the last time the AI used nukes against me even?
 
Status
Not open for further replies.
Top Bottom