Are Civs going for Science Victory Anymore?

Discussion in 'Civ5 - General Discussions' started by Catawumpus, Sep 5, 2013.

  1. Catawumpus

    Catawumpus Chieftain

    Joined:
    Sep 4, 2013
    Messages:
    7
    Location:
    NYC
    I've been steadily playing BNW now since its release. I've played each of the new civs and played some of the old ones to see how they function under the new dynamic. (Monty rocks in BNW). I love all the new additions, the trade routes, tourism, the new cultural system is light years ahead of what it used to be.

    However one thing I have noticed that sometimes irks me is that it seems all the AI's are obssessed with the cultural victory option or at least with culture in general. Most of the AI's do not go wide (I usually play wide) and in some cases I've seen 2-3 cities tops for the more culturally oriented civs like France.

    Not such a big deal but when it comes to the World Congress the AI's all gravitate to the option to increase production of artists and writers and decrease production of scientists and merchants. If I am playing Brazil that's fine with me. I'm naturally going for the cultural win as well. But when I decide to go scientific and want to build a space ship or just build the unbeatable army it seems I am the only civ who wants to vote for the increase in scientist and merchant generation. This has happened in every play through I have done. I have seen civs who should be inclinced to the science victory like Korea and Babylon just jumping on the cultural bandwagon.

    The only civ who I won't upset with an increased science proposal is usually the straggler civ who is still in the Rennaisance era while we're all going Industrial. Again, it makes sense to me since this is the culture focus version of Civ but I think the AI's have really gone overboard with their bias towards culture. I've even seen Genghis and Atilla jumping on that bandwagon. I would like to see a little more diversity in the AI's prorities. Are any of them even trying to build space ships anymore?

    I usually play on Prince so I don't know if at the higher difficulties people are seeing this bias. I am curious to see what people's thoughts are regarding this perceived over emphasis on culture by everyone in the game.
     
  2. fotonut

    fotonut Warlord

    Joined:
    Apr 29, 2006
    Messages:
    117
    In my current game, King, putting forward a proposal I was surprised to see that of my 8 opponents 3 would be angry with Arts Funding and 3 would be happy; vice-versa for Science. None are Babylon or Korea.

    It's too early in the game to tell what victory they're building up to though.
     
  3. kamikazees

    kamikazees Warlord

    Joined:
    Jul 5, 2012
    Messages:
    266
    I play on Immortal with 8 civs, and yes, I have seen this bias many times. Almost everyone is grateful if I propose Arts Funding or the world projects. It has gotten to the point where I will almost always propose one of those two as my first proposal, just so I get huge diplo boosts with everyone and lots of friends.

    Later in the game, say around the Industrial or modern ages, I am seeing 1 or 2 civs each game start loving Science Funding (some even change their minds to love it). But it is very common for me to see 1/2 of the civs in my game pick Aesthetics, while only 1 (or none) picks Rationalism. Porcelian Tower is easier to build, I suppose.
     
  4. MarshalN

    MarshalN Prince

    Joined:
    Jul 23, 2013
    Messages:
    366
    I've won a few games in immortal playing science since BNW - no competition from the AI at all on that front. The most one civ had done was build Apollo, but I launched before they got a part done.
     
  5. chazzycat

    chazzycat Deity

    Joined:
    Oct 13, 2010
    Messages:
    2,918
    every single game of mine, arts funding is hugely popular and no one wants science funding except for maybe 1 civ. China & babylon I think are the ones I can remember favoring science.
     
  6. wildberry

    wildberry Chieftain

    Joined:
    Oct 15, 2010
    Messages:
    20
    It also seems to affect the AI gameplay. When I still played GNK, I routinely had the AI beat me to SV by early 220s. In my past BNW SV wins, I've had the time to smell the roses on the way to victory well into 300s. Whereas SV is solitaire and can thus be won quickly, in CV AIs are competing each other and slowing each other down. Thus, BNW AI is effectively worse at winning than GNK AI.
     
  7. Johnpecan

    Johnpecan Warlord

    Joined:
    Jan 16, 2008
    Messages:
    227
    Agreed. In an 8 player game, it seems at least 6 are going for culture victories. If only Greece realized how easy a diplo victory was.... ><
     
  8. Nicasen

    Nicasen Chieftain

    Joined:
    Jul 4, 2013
    Messages:
    55
    Yeah it's rare to see civs try for science wins now, it's the one major problem I have with BNW. It's not just arts funding being dominant either, when you look at social policies choices the AI always seems to play the same way. In the early game they go either tradition or piety and maybe 1/4 will go liberty or honor. In the midgame everyone loves aesthetic or patronage and few will pick rationalism / commerce / exploration. I really hope they tweak the AI flavors in the fall patch.
     
  9. Muskie

    Muskie Warlord

    Joined:
    Apr 16, 2006
    Messages:
    249
    Gender:
    Male
    Location:
    Calgary AB Canada
    I've seen AI civilizations building spaceship parts. I've never lost to an AI science victory in BNW but I have in Vanila possibly in G&K... Once the retire option became available staying around to lose becomes less attractive, you either declare war or pay someone to declare war, or you win diplomatically.

    When BNW came out I won diplomatically frequently, now I'm trying to branch out more, try some less obvious civs, less obivous social policies. Currently I am a Tradition + Commerce + Rationalism + Freedom Ethiopia. I haven't completed all four, but I'm doing well in general.

    I do agree a lot of AI civs are happy if you propose cultural benefiting proposals, but I think a tech victory is so far off at the start of the World Congress you can see how the AI might not have it on their radar.

    Diplomatic seems to be the fall back victory, with the others taking more planning and focus.
     
  10. dexters

    dexters Gods & Emperors Supporter

    Joined:
    Apr 23, 2003
    Messages:
    4,182
    Gender:
    Male
    Location:
    Canada
    Science victory comes too late for the AI. I've only lost to the AI on science once in BNW, vs monster Korea in my very first BNW game.
     
  11. BeakersGoMeep

    BeakersGoMeep Chieftain

    Joined:
    Aug 22, 2013
    Messages:
    9
    Location:
    NY state
    The thing about ai's and CV that I constantly see is that they don't understand that winning CV is from high tourism. Sure there is always that 1 ai with impossibly high culture but none ever get an amount of great works that could make a dent towards CV.

    I think they don't know how to build for a condition, just build everything blindly hoping that by cheating enough they'll just end up winning by doing it all since they can afford it. I'd really like to see the ai build globe theatre and then FILL it instead of just taking it from me and letting it sit there. COULD be that they are actively countering me when i go CV but they generally seem to do it even when I have no tourism.

    Diplo is too easy and the AI don't always understand how it works either, only sometimes.
     
  12. Guandao

    Guandao Rajah of Minyue and Langkasuka

    Joined:
    Mar 30, 2011
    Messages:
    5,658
    Gender:
    Male
    Location:
    New York City
    Definitely, usually as a last resort if they can't win diplo
     
  13. Gabriel Pyyrhic

    Gabriel Pyyrhic Warlord

    Joined:
    Apr 22, 2011
    Messages:
    189
    Location:
    Australia
    OK here is the base sequence the AI goes through when choosing a GRAND STARTEGY

    1. Get the base FLAVOUR for each strategy type (ie SCIENCE, CULTURE, DOIMATION and DIPLOMACY). Scale this by the base game FLAVOURS for each VICTORY type.

    2. Determine the suitability for each VICTORY type, using a unique algorithm for each, based on current game factors (more on this later).

    3. Modify the suitability of each victory type by the number of other players WE THINK are pursuing the same victory method. Essentially scales linearly between 100% (Ie no one else is pursuing this victory) to 50% (everyone is pursuing this victory method).

    4. Add a BIAS for whatever the current strategy is so we don't chop and change easily.


    FYI : I have added the code from the BNW codebase for both the base algorithm (ie above) and the code for each of the strategies (enumerated below). The code is at the end of the post.

    Steps 1,3 and 4 are pretty straight forward, step 2 is more complex and breaks down as follows :

    CONQUEST
    0. Take the maximum FLAVOUR value out of DECEPTIVENESS, HOSTILITY and WARLIKENESS. Then subtract the FLAVOUR value for FRIENDLINESS.
    1. Add the BOLDNES FLAVOUR for the AI.
    2. Reduce likelihood by a small amount for each era that passes.
    3. Modify by the ratio of the AI's MILITARY STRENGTH when compared to the WORLD AVERAGE.
    4. Increase the likelihood if the AI is currently at WAR.
    5. Increase the likelihood if the AI considers that there are to many RIVAL CIVS and not enough land (based on the number of players the AI has met, and the amount of land it has discovered).
    6. If the AI has no nukes, but others do, decrease the likelihood.

    CULTURE
    1. Take the base FLAVOUR for CULTURE of this AI. (NOTE: This is the CULTURE FLAVOUR not the GRAND STARTEGY CULTURE FLAVOUR).
    2. Increase it based on the era (earlier eras are worth more).
    3. Increase priority for each CIV that is behind the AI in culture.
    4. DECREASE priority for each CIV that is ahead of the AI in culture.
    5. Increase priority for each CIV we are INFLUENTIAL over.

    DIPLOMACY
    1. Reduce priority for each MINOR attacked by the AI.
    2. BEFORE leagues are available : Add the DIPLOMACY FLAVOUR and scale it by the era (earlier ERA's yield a higher scaling).
    3. AFTER LEAGUES are available :
    3a. If we have enough votes to WIN, switch to DIPLOMACY immediately.
    3b. If we have 3/4 of the votes needed to win increase priority.
    3c. If we have the most votes increase priority.
    3d. If we do not have the most votes but could make them up from unallied city states then increase priority.
    4. Increase priority for our CITY STATE FRIENDSHIP FLAVOUR and CITY STATE BONUS FLAVOUR.
    5. Decrease priority for the AI's CITY STATE COMBAT FLAVOUR.

    NOTE : I am assuming LEAGUEs is a reference to the WORLD CONGRESS but am not sure and do not have time to check right now.

    SCIENCE
    1. Start with the base AI FLAVOUR for SCIENCE (not the SV FLAVOUR).
    2. Modify the chance based upon the number of eras that have passed (ie later eras increase the chance).
    3. If the AI has built the APOLLO PROGRAM significantly increase the priority.

    As you can see from this the SV is more of a default victory to use when none of the others apply. Earlier eras are going to favour culture, diplomacy and conquest, whilst later years favour science.

    BTW I removed a couple of small steps from the above four algorithms for brevity. For example each strategy does a sanity check to make sure that the victory method is enabled for this game. There are a couple of other small checks here and there that I omitted. I do not believe this really makes much difference in the grand scheme of things but for those who are interested please review the code below.

    Here is the code for those interested.

    BASE ALGORITHIM
    Code:
    /// Runs every turn to determine what the player's Active Grand Strategy is and to change Priority Levels as necessary
    void CvGrandStrategyAI::DoTurn()
    {
    	DoGuessOtherPlayersActiveGrandStrategy();
    
    	int iGrandStrategiesLoop;
    	AIGrandStrategyTypes eGrandStrategy;
    	CvAIGrandStrategyXMLEntry* pGrandStrategy;
    	CvString strGrandStrategyName;
    
    	// Loop through all GrandStrategies to set their Priorities
    	for(iGrandStrategiesLoop = 0; iGrandStrategiesLoop < GetAIGrandStrategies()->GetNumAIGrandStrategies(); iGrandStrategiesLoop++)
    	{
    		eGrandStrategy = (AIGrandStrategyTypes) iGrandStrategiesLoop;
    		pGrandStrategy = GetAIGrandStrategies()->GetEntry(iGrandStrategiesLoop);
    		strGrandStrategyName = (CvString) pGrandStrategy->GetType();
    
    		// Base Priority looks at Personality Flavors (0 - 10) and multiplies * the Flavors attached to a Grand Strategy (0-10),
    		// so expect a number between 0 and 100 back from this
    		int iPriority = GetBaseGrandStrategyPriority(eGrandStrategy);
    
    		if(strGrandStrategyName == "AIGRANDSTRATEGY_CONQUEST")
    		{
    			iPriority += GetConquestPriority();
    		}
    		else if(strGrandStrategyName == "AIGRANDSTRATEGY_CULTURE")
    		{
    			iPriority += GetCulturePriority();
    		}
    		else if(strGrandStrategyName == "AIGRANDSTRATEGY_UNITED_NATIONS")
    		{
    			iPriority += GetUnitedNationsPriority();
    		}
    		else if(strGrandStrategyName == "AIGRANDSTRATEGY_SPACESHIP")
    		{
    			iPriority += GetSpaceshipPriority();
    		}
    
    		// Random element
    		iPriority += GC.getGame().getJonRandNum(/*50*/ GC.getAI_GS_RAND_ROLL(), "Grand Strategy AI: GS rand roll.");
    
    		// Give a boost to the current strategy so that small fluctuation doesn't cause a big change
    		if(GetActiveGrandStrategy() == eGrandStrategy && GetActiveGrandStrategy() != NO_AIGRANDSTRATEGY)
    		{
    			iPriority += /*50*/ GC.getAI_GRAND_STRATEGY_CURRENT_STRATEGY_WEIGHT();
    		}
    
    		SetGrandStrategyPriority(eGrandStrategy, iPriority);
    	}
    
    	// Now look at what we think the other players in the game are up to - we might have an opportunity to capitalize somewhere
    	int iNumPlayersAliveAndMet = 0;
    
    	int iMajorLoop;
    
    	for(iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)
    	{
    		if(GET_PLAYER((PlayerTypes) iMajorLoop).isAlive())
    		{
    			if(GET_TEAM(GetPlayer()->getTeam()).isHasMet(GET_PLAYER((PlayerTypes) iMajorLoop).getTeam()))
    			{
    				iNumPlayersAliveAndMet++;
    			}
    		}
    	}
    
    	FStaticVector< int, 5, true, c_eCiv5GameplayDLL > viNumGrandStrategiesAdopted;
    	int iNumPlayers;
    
    	// Init vector
    	for(iGrandStrategiesLoop = 0; iGrandStrategiesLoop < GetAIGrandStrategies()->GetNumAIGrandStrategies(); iGrandStrategiesLoop++)
    	{
    		iNumPlayers = 0;
    
    		// Tally up how many players we think are pusuing each Grand Strategy
    		for(iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)
    		{
    			if(GetGuessOtherPlayerActiveGrandStrategy((PlayerTypes) iMajorLoop) == (AIGrandStrategyTypes) iGrandStrategiesLoop)
    			{
    				iNumPlayers++;
    			}
    		}
    
    		viNumGrandStrategiesAdopted.push_back(iNumPlayers);
    	}
    
    	FStaticVector< int, 5, true, c_eCiv5GameplayDLL > viGrandStrategyChangeForLogging;
    
    	int iChange;
    
    	// Now modify our preferences based on how many people are going for stuff
    	for(iGrandStrategiesLoop = 0; iGrandStrategiesLoop < GetAIGrandStrategies()->GetNumAIGrandStrategies(); iGrandStrategiesLoop++)
    	{
    		eGrandStrategy = (AIGrandStrategyTypes) iGrandStrategiesLoop;
    		// If EVERYONE else we know is also going for this Grand Strategy, reduce our Priority by 50%
    		iChange = GetGrandStrategyPriority(eGrandStrategy) * /*50*/ GC.getAI_GRAND_STRATEGY_OTHER_PLAYERS_GS_MULTIPLIER();
    		iChange = iChange * viNumGrandStrategiesAdopted[eGrandStrategy] / iNumPlayersAliveAndMet;
    		iChange /= 100;
    
    		ChangeGrandStrategyPriority(eGrandStrategy, -iChange);
    
    		viGrandStrategyChangeForLogging.push_back(-iChange);
    	}
    
    	ChangeNumTurnsSinceActiveSet(1);
    
    	// Now see which Grand Strategy should be active, based on who has the highest Priority right now
    	// Grand Strategy must be run for at least 10 turns
    	if(GetActiveGrandStrategy() == NO_AIGRANDSTRATEGY || GetNumTurnsSinceActiveSet() >= /*10*/ GC.getAI_GRAND_STRATEGY_NUM_TURNS_STRATEGY_MUST_BE_ACTIVE())
    	{
    		int iBestPriority = -1;
    		int iPriority;
    
    		AIGrandStrategyTypes eBestGrandStrategy = NO_AIGRANDSTRATEGY;
    
    		for(iGrandStrategiesLoop = 0; iGrandStrategiesLoop < GetAIGrandStrategies()->GetNumAIGrandStrategies(); iGrandStrategiesLoop++)
    		{
    			eGrandStrategy = (AIGrandStrategyTypes) iGrandStrategiesLoop;
    
    			iPriority = GetGrandStrategyPriority(eGrandStrategy);
    
    			if(iPriority > iBestPriority)
    			{
    				iBestPriority = iPriority;
    				eBestGrandStrategy = eGrandStrategy;
    			}
    		}
    
    		if(eBestGrandStrategy != GetActiveGrandStrategy())
    		{
    			SetActiveGrandStrategy(eBestGrandStrategy);
    			m_pPlayer->GetCitySpecializationAI()->SetSpecializationsDirty(SPECIALIZATION_UPDATE_NEW_GRAND_STRATEGY);
    		}
    	}
    
    	LogGrandStrategies(viGrandStrategyChangeForLogging);
    }
    CONQUEST
    Code:
    /// Returns Priority for Conquest Grand Strategy
    int CvGrandStrategyAI::GetConquestPriority()
    {
    	int iPriority = 0;
    
    	// If Conquest Victory isn't even available then don't bother with anything
    	VictoryTypes eVictory = (VictoryTypes) GC.getInfoTypeForString("VICTORY_DOMINATION", true);
    	if(eVictory == NO_VICTORY || !GC.getGame().isVictoryValid(eVictory))
    	{
    		if(!GC.getGame().areNoVictoriesValid())
    		{
    			return -100;
    		}
    	}
    
    	int iGeneralWarlikeness = GetPlayer()->GetDiplomacyAI()->GetPersonalityMajorCivApproachBias(MAJOR_CIV_APPROACH_WAR);
    	int iGeneralHostility = GetPlayer()->GetDiplomacyAI()->GetPersonalityMajorCivApproachBias(MAJOR_CIV_APPROACH_HOSTILE);
    	int iGeneralDeceptiveness = GetPlayer()->GetDiplomacyAI()->GetPersonalityMajorCivApproachBias(MAJOR_CIV_APPROACH_DECEPTIVE);
    	int iGeneralFriendliness = GetPlayer()->GetDiplomacyAI()->GetPersonalityMajorCivApproachBias(MAJOR_CIV_APPROACH_FRIENDLY);
    
    	int iGeneralApproachModifier = max(max(iGeneralDeceptiveness, iGeneralHostility),iGeneralWarlikeness) - iGeneralFriendliness;
    	// Boldness gives the base weight for Conquest (no flavors added earlier)
    	iPriority += ((GetPlayer()->GetDiplomacyAI()->GetBoldness() + iGeneralApproachModifier) * (12 - m_pPlayer->GetCurrentEra())); // make a little less likely as time goes on
    
    	CvTeam& pTeam = GET_TEAM(GetPlayer()->getTeam());
    
    	// How many turns must have passed before we test for having met nobody?
    	if(GC.getGame().getElapsedGameTurns() >= /*20*/ GC.getAI_GS_CONQUEST_NOBODY_MET_FIRST_TURN())
    	{
    		// If we haven't met any Major Civs yet, then we probably shouldn't be planning on conquering the world
    		bool bHasMetMajor = false;
    
    		for(int iTeamLoop = 0; iTeamLoop < MAX_CIV_TEAMS; iTeamLoop++)
    		{
    			if(pTeam.GetID() != iTeamLoop && !GET_TEAM((TeamTypes) iTeamLoop).isMinorCiv())
    			{
    				if(pTeam.isHasMet((TeamTypes) iTeamLoop))
    				{
    					bHasMetMajor = true;
    					break;
    				}
    			}
    		}
    		if(!bHasMetMajor)
    		{
    			iPriority += /*-50*/ GC.getAI_GRAND_STRATEGY_CONQUEST_NOBODY_MET_WEIGHT();
    		}
    	}
    
    	// How many turns must have passed before we test for us having a weak military?
    	if(GC.getGame().getElapsedGameTurns() >= /*60*/ GC.getAI_GS_CONQUEST_MILITARY_STRENGTH_FIRST_TURN())
    	{
    		// Compare our military strength to the rest of the world
    		int iWorldMilitaryStrength = GC.getGame().GetWorldMilitaryStrengthAverage(GetPlayer()->GetID(), true, true);
    
    		if(iWorldMilitaryStrength > 0)
    		{
    			int iMilitaryRatio = (GetPlayer()->GetMilitaryMight() - iWorldMilitaryStrength) * /*100*/ GC.getAI_GRAND_STRATEGY_CONQUEST_POWER_RATIO_MULTIPLIER() / iWorldMilitaryStrength;
    
    			// Make the likelihood of BECOMING a warmonger lower than dropping the bad behavior
    			if(iMilitaryRatio > 0)
    				iMilitaryRatio /= 2;
    
    			iPriority += iMilitaryRatio;	// This will add between -100 and 100 depending on this player's MilitaryStrength relative the world average. The number will typically be near 0 though, as it's fairly hard to get away from the world average
    		}
    	}
    
    	// If we're at war, then boost the weight a bit
    	if(pTeam.getAtWarCount(/*bIgnoreMinors*/ false) > 0)
    	{
    		iPriority += /*10*/ GC.getAI_GRAND_STRATEGY_CONQUEST_AT_WAR_WEIGHT();
    	}
    
    	// If our neighbors are cramping our style, consider less... scrupulous means of obtaining more land
    	if(GetPlayer()->IsCramped())
    	{
    		PlayerTypes ePlayer;
    		int iNumPlayersMet = 1;	// Include 1 for me!
    		int iTotalLandMe = 0;
    		int iTotalLandPlayersMet = 0;
    
    		// Count the number of Majors we know
    		for(int iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)
    		{
    			ePlayer = (PlayerTypes) iMajorLoop;
    
    			if(GET_PLAYER(ePlayer).isAlive() && iMajorLoop != GetPlayer()->GetID())
    			{
    				if(pTeam.isHasMet(GET_PLAYER(ePlayer).getTeam()))
    				{
    					iNumPlayersMet++;
    				}
    			}
    		}
    
    		if(iNumPlayersMet > 0)
    		{
    			// Check every plot for ownership
    			for(int iPlotLoop = 0; iPlotLoop < GC.getMap().numPlots(); iPlotLoop++)
    			{
    				if(GC.getMap().plotByIndexUnchecked(iPlotLoop)->isOwned())
    				{
    					ePlayer = GC.getMap().plotByIndexUnchecked(iPlotLoop)->getOwner();
    
    					if(ePlayer == GetPlayer()->GetID())
    					{
    						iTotalLandPlayersMet++;
    						iTotalLandMe++;
    					}
    					else if(!GET_PLAYER(ePlayer).isMinorCiv() && pTeam.isHasMet(GET_PLAYER(ePlayer).getTeam()))
    					{
    						iTotalLandPlayersMet++;
    					}
    				}
    			}
    
    			iTotalLandPlayersMet /= iNumPlayersMet;
    
    			if(iTotalLandMe > 0)
    			{
    				if(iTotalLandPlayersMet / iTotalLandMe > 0)
    				{
    					iPriority += /*20*/ GC.getAI_GRAND_STRATEGY_CONQUEST_CRAMPED_WEIGHT();
    				}
    			}
    		}
    	}
    
    	// if we do not have nukes and we know someone else who does...
    	if(GetPlayer()->getNumNukeUnits() == 0)
    	{
    		for(int iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)
    		{
    			PlayerTypes ePlayer = (PlayerTypes) iMajorLoop;
    
    			if(GET_PLAYER(ePlayer).isAlive() && iMajorLoop != GetPlayer()->GetID())
    			{
    				if(pTeam.isHasMet(GET_PLAYER(ePlayer).getTeam()))
    				{
    					if (GET_PLAYER(ePlayer).getNumNukeUnits() > 0)
    					{
    						iPriority -= 50; 
    						break;
    					}
    				}
    			}
    		}
    	}
    
    	return iPriority;
    }
    
    CULTURE
    Code:
    /// Returns Priority for Culture Grand Strategy
    int CvGrandStrategyAI::GetCulturePriority()
    {
    	int iPriority = 0;
    
    	// If Culture Victory isn't even available then don't bother with anything
    	VictoryTypes eVictory = (VictoryTypes) GC.getInfoTypeForString("VICTORY_CULTURAL", true);
    	if(eVictory == NO_VICTORY || !GC.getGame().isVictoryValid(eVictory))
    	{
    		return -100;
    	}
    
    	// Before tourism kicks in, add weight based on flavor
    	int iFlavorCulture =  m_pPlayer->GetFlavorManager()->GetPersonalityIndividualFlavor((FlavorTypes)GC.getInfoTypeForString("FLAVOR_CULTURE"));
    	iPriority += (10 - m_pPlayer->GetCurrentEra()) * iFlavorCulture * 200 / 100;
    
    	// Loop through Players to see how we are doing on Tourism and Culture
    	PlayerTypes eLoopPlayer;
    	int iOurCulture = m_pPlayer->GetTotalJONSCulturePerTurn();
    	int iOurTourism = m_pPlayer->GetCulture()->GetTourism();
    	int iNumCivsBehindCulture = 0;
    	int iNumCivsAheadCulture = 0;
    	int iNumCivsBehindTourism = 0;
    	int iNumCivsAheadTourism = 0;
    	int iNumCivsAlive = 0;
    
    	for(int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)
    	{
    		eLoopPlayer = (PlayerTypes) iPlayerLoop;
    		CvPlayer &kPlayer = GET_PLAYER(eLoopPlayer);
    
    		if (kPlayer.isAlive() && !kPlayer.isMinorCiv() && !kPlayer.isBarbarian() && iPlayerLoop != m_pPlayer->GetID())
    		{
    			if (iOurCulture > kPlayer.GetTotalJONSCulturePerTurn())
    			{
    				iNumCivsAheadCulture++;
    			}
    			else
    			{
    				iNumCivsBehindCulture++;
    			}
    			if (iOurTourism > kPlayer.GetCulture()->GetTourism())
    			{
    				iNumCivsAheadTourism++;
    			}
    			else
    			{
    				iNumCivsBehindTourism++;
    			}
    			iNumCivsAlive++;
    		}
    	}
    
    	if (iNumCivsAlive > 0 && iNumCivsAheadCulture > iNumCivsBehindCulture)
    	{
    		iPriority += (GC.getAI_GS_CULTURE_AHEAD_WEIGHT() * (iNumCivsAheadCulture - iNumCivsBehindCulture) / iNumCivsAlive);
    	}
    	if (iNumCivsAlive > 0 && iNumCivsAheadTourism > iNumCivsBehindTourism)
    	{
    		iPriority += (GC.getAI_GS_CULTURE_TOURISM_AHEAD_WEIGHT() * (iNumCivsAheadTourism - iNumCivsBehindTourism) / iNumCivsAlive);
    	}
    
    	// for every civ we are Influential over increase this
    	int iNumInfluential = m_pPlayer->GetCulture()->GetNumCivsInfluentialOn();
    	iPriority += iNumInfluential * GC.getAI_GS_CULTURE_INFLUENTIAL_CIV_MOD();
    
    	return iPriority;
    }
    DIPLOMACY
    Code:
    /// Returns Priority for United Nations Grand Strategy
    int CvGrandStrategyAI::GetUnitedNationsPriority()
    {
    	int iPriority = 0;
    	PlayerTypes ePlayer = m_pPlayer->GetID();
    
    	// If UN Victory isn't even available then don't bother with anything
    	VictoryTypes eVictory = (VictoryTypes) GC.getInfoTypeForString("VICTORY_DIPLOMATIC", true);
    	if(eVictory == NO_VICTORY || !GC.getGame().isVictoryValid(eVictory))
    	{
    		return -100;
    	}
    
    	int iNumMinorsAttacked = GET_TEAM(GetPlayer()->getTeam()).GetNumMinorCivsAttacked();
    	iPriority += (iNumMinorsAttacked* /*-30*/ GC.getAI_GRAND_STRATEGY_UN_EACH_MINOR_ATTACKED_WEIGHT());
    
    	int iVotesNeededToWin = GC.getGame().GetVotesNeededForDiploVictory();
    
    	int iVotesControlled = 0;
    	int iVotesControlledDelta = 0;
    	int iUnalliedCityStates = 0;
    	if (GC.getGame().GetGameLeagues()->GetNumActiveLeagues() == 0)
    	{
    		// Before leagues kick in, add weight based on flavor
    		int iFlavorDiplo =  m_pPlayer->GetFlavorManager()->GetPersonalityIndividualFlavor((FlavorTypes)GC.getInfoTypeForString("FLAVOR_DIPLOMACY"));
    		iPriority += (10 - m_pPlayer->GetCurrentEra()) * iFlavorDiplo * 150 / 100;
    	}
    	else
    	{
    		CvLeague* pLeague = GC.getGame().GetGameLeagues()->GetActiveLeague();
    		CvAssert(pLeague != NULL);
    		if (pLeague != NULL)
    		{
    			// Votes we control
    			iVotesControlled += pLeague->CalculateStartingVotesForMember(ePlayer);
    
    			// Votes other players control
    			int iHighestOtherPlayerVotes = 0;
    			for (int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)
    			{
    				PlayerTypes eLoopPlayer = (PlayerTypes) iPlayerLoop;
    
    				if(eLoopPlayer != ePlayer && GET_PLAYER(eLoopPlayer).isAlive())
    				{
    					if (GET_PLAYER(eLoopPlayer).isMinorCiv())
    					{
    						if (GET_PLAYER(eLoopPlayer).GetMinorCivAI()->GetAlly() == NO_PLAYER)
    						{
    							iUnalliedCityStates++;
    						}
    					}
    					else
    					{
    						int iOtherPlayerVotes = pLeague->CalculateStartingVotesForMember(eLoopPlayer);
    						if (iOtherPlayerVotes > iHighestOtherPlayerVotes)
    						{
    							iHighestOtherPlayerVotes = iOtherPlayerVotes;
    						}
    					}
    				}
    			}
    
    			// How we compare
    			iVotesControlledDelta = iVotesControlled - iHighestOtherPlayerVotes;
    		}
    	}
    
    	// Are we close to winning?
    	if (iVotesControlled >= iVotesNeededToWin)
    	{
    		return 1000;
    	}
    	else if (iVotesControlled >= ((iVotesNeededToWin * 3) / 4))
    	{
    		iPriority += 40;
    	}
    
    	// We have the most votes
    	if (iVotesControlledDelta > 0)
    	{
    		iPriority += MAX(40, iVotesControlledDelta * 5);
    	}
    	// We are equal or behind in votes
    	else
    	{
    		// Could we make up the difference with currently unallied city-states?
    		int iPotentialCityStateVotes = iUnalliedCityStates * 2;
    		int iPotentialVotesDelta = iPotentialCityStateVotes + iVotesControlledDelta;
    		if (iPotentialVotesDelta > 0)
    		{
    			iPriority += MAX(20, iPotentialVotesDelta * 5);
    		}
    		else if (iPotentialVotesDelta < 0)
    		{
    			iPriority += MIN(-40, iPotentialVotesDelta * -5);
    		}
    	}
    
    	// factor in some traits that could be useful (or harmful)
    	iPriority += m_pPlayer->GetPlayerTraits()->GetCityStateFriendshipModifier();
    	iPriority += m_pPlayer->GetPlayerTraits()->GetCityStateBonusModifier();
    	iPriority -= m_pPlayer->GetPlayerTraits()->GetCityStateCombatModifier();
    
    	return iPriority;
    }
    SCIENCE
    Code:
    /// Returns Priority for Spaceship Grand Strategy
    int CvGrandStrategyAI::GetSpaceshipPriority()
    {
    	int iPriority = 0;
    
    	// If SS Victory isn't even available then don't bother with anything
    	VictoryTypes eVictory = (VictoryTypes) GC.getInfoTypeForString("VICTORY_SPACE_RACE", true);
    	if(eVictory == NO_VICTORY || !GC.getGame().isVictoryValid(eVictory))
    	{
    		return -100;
    	}
    
    	int iFlavorScience =  m_pPlayer->GetFlavorManager()->GetPersonalityIndividualFlavor((FlavorTypes)GC.getInfoTypeForString("FLAVOR_SCIENCE"));
    
    	// the later the game the greater the chance
    	iPriority += m_pPlayer->GetCurrentEra() * iFlavorScience * 150 / 100;
    
    	// if I already built the Apollo Program I am very likely to follow through
    	ProjectTypes eApolloProgram = (ProjectTypes) GC.getInfoTypeForString("PROJECT_APOLLO_PROGRAM", true);
    	if(eApolloProgram != NO_PROJECT)
    	{
    		if(GET_TEAM(m_pPlayer->getTeam()).getProjectCount(eApolloProgram) > 0)
    		{
    			iPriority += /*150*/ GC.getAI_GS_SS_HAS_APOLLO_PROGRAM();
    		}
    	}
    
    	return iPriority;
    }
    I hope this helps people decipher why AI's are choosing to do what.

    FYI If you want to have an idea of what each AI is doing check their attitude to CS's. If they are attacking them then they are almost certainly following conquest. If they are bullying then they are not likely to be following CULTURE or DIPLOMACY and are more likely to be following CONQUEST. If they are PROTECTING CS's then they are likely following DIPLOMACY or CULTURE. The AI's GS SIGNIFICANTLY affects how it deals with CS's so they make a good barometer for AI GS interpretation. In particular the above applies to CS's that are CLOSE to the AI in question. Ones further away are less useful as barometers.
     
  14. presdigitate

    presdigitate Chieftain

    Joined:
    Jun 24, 2005
    Messages:
    4
    I recently tried a BNW game with 21 AI civs / 41 city-states on a huge map, king difficulty, epic length. I was really interested in doing a test to see how quickly borders would expand, so I just ran the whole game on autoplay (i.e., no human player involvement) using the Fire Tuner. At about turn 686 (out of 750) Egypt won the game with a science victory. So, at least when competing against other AI civs, the AI can effectively win a science victory.
     
  15. Winston

    Winston Warlord

    Joined:
    Jul 23, 2003
    Messages:
    203
    @Gabriel

    So if you disabled culture as a victory condition at the start of the game, then the AI would switch priorities to be more science based?
    I enjoy BNW but I have noticed it's significantly easier to beat because it has slowed AI science progress and normally the AI doesn't make a serious effort with tourism (just culture) - that's actually quite sensible if you're not going for a tourism win (tourism doesn't provide much by itself).
    I do remember one time when the AI made a good attempt at a culture victory by picking cathedrals, pagodas and sacred sites very early in the game - this strategy allowed it to become influential with most the other AIs. Maybe the devs programmed this strategy in or maybe it fluked it - it was a good idea though.
     
  16. Brevity

    Brevity Chieftain

    Joined:
    Oct 28, 2012
    Messages:
    15
    I've seen the AI attempt a Science Focused strategy, though yeah they seem to heavily skew towards pursuing culture there's still the odd AI player that goes for the Space Race.

    One not so subtle thing however that appears to be working against it, and what makes the AI such a poor Science contender even on the highest difficulty level is there utter lack of regard towards the "city science tax."

    I had a game where Augustus was producing easily 3x my raw beaker output per turn (3000+ to my 1050~ish) on Immortal. But I easily beat him to the modern era and stayed a full one and a half to two eras ahead of him, once I caught the AI's tech lead, all the way to the end of the game. The game ended with me launching the ship while second place was a full 15 techs behind, simply because even to this day the AI just spams cities (Rome had 20+ cities at the end of the game, most self-settled to my 4) on any allowable spot on the map regardless of its actual strategic viability, inflating their tech costs to truly astronomical figures, with little to no actual game value in return for the investment.

    If the AI was more mindful of the implications of city spamming I'm confident it would put up a much better fight, especially the City State monsters (Alex, Enrico, Ram K) who dip heavily in Patronage for even more extra beakers. As it currently stands though, I wouldn't hold my breath for an AI spaceship launch against a player who even moderately understands concepts of Beelining, Research Agreements, the Rationalism Tree, Specialists, Spy Usage, Bulbing, Academies and city placement, they just can't compete at those tech costs.
     
  17. Gabriel Pyyrhic

    Gabriel Pyyrhic Warlord

    Joined:
    Apr 22, 2011
    Messages:
    189
    Location:
    Australia
    @Winston

    Well sort of.
    If you disable Culture Victory then it will not pursue a GRAND STRATEGY designed to WIN a CULTURAL VICTORY. So yes this will increase the chance of it choosing a SCIENCE VICTORY, but it will also increase the chance of it pursuing a CONQUEST or DIPLOMATIC VICTORY. Unless the SV was the second highest priority out of the list of VC, then removing the CV will make little difference. What it will likely do is increase the number of times the SV is chosen, especially for those CIVS that are strongly CULTURALLY FLAVOURED, and have more reason to pursue a SV then a DV or CONQUEST VICTORY.

    However the way the code works (and I do not believe this part has changed from vanilla) is that the SV is a fallback VICTORY for anyone without good reason to pursue something else, or for those CIVS strongly FLAVOURED in the SCIENCE direction, and less so in the others.

    I have not looked at how the numbers all compare (ie how many priority points each CIV could feasibly get in each victory condition) but assume they are not all the same.

    SV has less inputs that for sure.

    FYI If you look at the BASE ALGORITHM I mentioned (ie the bit I bolded) you will see step 1 uses the FLAVOUR for each CIV for each of the VICTORY CONDITIONS and also a BASE FLAVOUR for the victory conditions. I don't not know what this BASE FLAVOUR is ATM, it could be (and I am just guessing here) a base priority for the VICTORY CONDITIONS that is CIV independent. So in other words a hard coded way of prioritising certain victories over others without considering any other factors. I will look into it when I get some time, hopefully later tonight.

    What I have been meaning to do for some time was to actually have a look at the numbers generated by this code and see what the MAX/MIN amounts are.

    Logging allows you to see what each CIV is pursuing at any given moment (can be turned on through the CONFIG file in your DOCUMENTS/MY GAMES/CIV directory and is updated every turn. NOTE: IIRC GS are only chosen after 50 turns have gone by. It is interesting to look at the log as it also tells you other info like its appraisal of your MILITARY STRENGTH, its current BIAS for OPINION and APPROACH etc.

    Finally (sorry for the lack of brevity) in regards to the AI's choices when it is pursuing a GS. Essentially pursuing a GS forces the AI to increase the priority of it building/researching/doing etc things that it considers is helpful for that VC. Essentially it uses numbers (like the flavours) that go up/down each turn and picks a priority based on the highest (like the AI does pretty much everything). So if it was pursuing a CV and its is programmed to consider CATHEDRALS/etc CULTURAL assets (which it probably is) then what you are saying is likely an outcome of the AI rather then circumstance.

    FYI Programming an AI like this (using numbers as levers) does not ensure the most efficient or effective AI, but it does create an AI that is better at adjusting to circumstance and reprioritising as needed. Additionally it makes the AI just a little bit unpredictable, even if you know how it works, which in my opinion is a good thing.

    Hope this helps
     
  18. Horizons

    Horizons Needing fed again!

    Joined:
    Feb 22, 2007
    Messages:
    1,401
    Gender:
    Male
    Location:
    UK
    Late game tech is so expensive it's nearly impossible to finish the tech tree before the time limit is up.
     
  19. Gabriel Pyyrhic

    Gabriel Pyyrhic Warlord

    Joined:
    Apr 22, 2011
    Messages:
    189
    Location:
    Australia
    I have my suspicions this is all born about from the BULBING phenomenon. As people save their GS and then BULB them all together at the end of the game it allows a SV strategy to skip through the late game very quickly. IF you do not do this you will likely struggle.

    I do not know why they don't just restrict bulbing to the era the GS is spawned, or within a set number of turns of spawning. The UN victory could then be pushed back a little (techwise) and the later eras experienced more fully then they often are.

    Personally I don't bulb-save, as a means of making the game more challenging without boosting difficulty through AI/player handicaps.

    As far as I am aware the AI does not bulb-save so its more or less even. (I CANNOT SAY THIS IS CERTAIN THOUGH, MERELY ANECDOTAL).
     
  20. chazzycat

    chazzycat Deity

    Joined:
    Oct 13, 2010
    Messages:
    2,918
    huh. no wonder the AI loves to go culture...every single civ in the game is increasing their priority.
     

Share This Page