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

AI Declaring War when creating a colony

Discussion in 'Civ4 - Bug Reports' started by Wheem, Feb 20, 2008.

  1. Wheem

    Wheem Chieftain

    Joined:
    Sep 28, 2007
    Messages:
    34
    Location:
    Alabama, USA
    I posted (in the standard BtS forum) some time ago about this happening to me before, and it has happened again under very similar circumstances. The situation is as follows:

    I'm relatively friendly with another civilization, and the very instant that they create a colony/vassal civ, they issue a declaration of war against me. They don't actually launch an invasion, just a declaration of war (if I reload a previous save, the war still comes as soon as they create the colony).

    In the first case, it happened with the Native Americans; this time it happened with the Greeks (under Pericles). My relations level with the Greeks was Pleased (and I think the same with the Native Americans last time), and there's no other reason that I can find for the war declaration. I wasn't in any other wars, we had an open borders agreement, we were trading partners (and had been for a very long time), we were far away from each other, etc...

    Like I said, there's no invasion force that I can see, just a random declaration of war at the same time they form a colonial civilization for a vassal.

    Edit: Just like when this happened to me the first time, I do not get any popup diplomatic window with the other civ's leader telling me that they're declaring war.

    Also, I reloaded the game from the turn before his colony creation + war declaration, and asked if he could spare his map info for a good friend. Pericles agreed, and this got us the "10 turn peace treaty" agreement. I end the turn, and lo-and-behold, he declares war on me at the same time he creates his colony (this time it was Mayan, instead of German; everything else remained the same).

    This is really annoying, since I do not want a war with the Greeks (not that they actually have an invasion force assembled, mind you).
     
  2. Mesousa

    Mesousa -8.38 -6.67

    Joined:
    Apr 19, 2006
    Messages:
    478
    It's a well known bug introduced by the official 3.13 patch. Use Bhruic's unofficial patch for 3.13, it fixes it. Apply Bhruic's patch and go back to a save before the creation of the colony.
     
  3. Wheem

    Wheem Chieftain

    Joined:
    Sep 28, 2007
    Messages:
    34
    Location:
    Alabama, USA
    Ah, thanks, that seems to have worked (good thing too, since the Chinese created a colony in about 10 turns as well :goodjob:)
     
  4. Napalm102

    Napalm102 Warlord

    Joined:
    Aug 8, 2006
    Messages:
    215
    Yeah it is no fun when it happenes to you. But I had this happen to an AI once! Shaka apparently wiped out a civ on other continent, then after astronomy he colonizes an large island and grants independance. Boom, his newly created vassal declares war on him :lol: Good too see that AI gets shafted too.
     
  5. ScribJellydonut

    ScribJellydonut Monarch

    Joined:
    Mar 19, 2008
    Messages:
    44
    I've been having the same thing happen to me(except I'm the one colonizing and declaring war on other civs). I downloaded the patch but not there isn't a colonize button lol.
     
  6. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,559
    Location:
    Baden-Württemberg, Germany
    this bug was introduced by Firaxis trying to allow more than 18 civs in a game - by allowing new colonies to take over slots of dead Civs, which causes lots of weirdness. Bhruic's patch IIRC reverted this back to the hard 18 Civ limit so if you ever had 18 Civs in that game you won't be able to create new colonies.
    Welcome to CFC :band:
     
  7. ScribJellydonut

    ScribJellydonut Monarch

    Joined:
    Mar 19, 2008
    Messages:
    44
    Hmmm. Thanks for the explanation and the welcome. I think I counted only 15 civs left on the map, though. Does it matter the map size(i.e. is the programmed limit in the patch for large maps maybe only 12 civs even if I started with 18, so that colonies could not be created until the total went under the map limit). I will reload it later tonight when I have time and check and verify though. You're most likely right. If the computer creates a colony in fog of war, do I get to meet that colony or do I have to discover them as if they were a new civilization?
     
  8. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,559
    Location:
    Baden-Württemberg, Germany
    1) before 3.13 which created this bug there was a hard limit of 18 Civs on any map (size does not matter). This means Players ever alive. In 3.13 publishers wanted to make this a soft limit of 18 Civs alive at any one time and created this bug in the process. Bhruic's patch IIRC reverts to the hard limit - so if there where 18 Civs total since the start of the game the limit is met and no more Civs can join.
    2) If a colony is created you need to meet it for contact to be established...
     
  9. ck07

    ck07 Mud Mover

    Joined:
    Dec 24, 2007
    Messages:
    177
    This also happens when I have vassals and then create a colony. The instant I created the colony, one of my vassals declared war on me (and on my other pre-existing vassal and on the new vassal). Tried backing up and changing various parameters, but the DoW still occurred at the instant of creation of the colony.
     
  10. Neato

    Neato Dog Culture Advisor

    Joined:
    Jan 14, 2008
    Messages:
    99
    Location:
    Dog Empire
    I have the unofficial patch, and I'm playing on a map that definitely had less than 18 civ's, but everytime I try liberating a new colony, I still get messages saying that I declared war on the rest of the world?

    Any new thoughts?
     
  11. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,559
    Location:
    Baden-Württemberg, Germany
  12. Neato

    Neato Dog Culture Advisor

    Joined:
    Jan 14, 2008
    Messages:
    99
    Location:
    Dog Empire
    Well, now you have me doubting that I installed the unofficial patch, but a few months ago, I uninstalled then reinstalled everything, and I swear that getting the unofficial patch was part of the process.

    Here's the game. (Note: this is the first time I've posted a game - the experience is quite intimate, I feel like I'm sharing something quite private. Interesting)
     

    Attached Files:

  13. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,559
    Location:
    Baden-Württemberg, Germany
    could you just check the following:
    go to
    \program files\firaxis games\sid meier's civilization 4\beyond the sword\assets
    and check the date on which the following file was last modified:
    CvCoreGameDLL.dll
    that is the quickest way to find out if you really installed Bhruic's patch :)

    I will check the save tonight.
     
  14. Neato

    Neato Dog Culture Advisor

    Joined:
    Jan 14, 2008
    Messages:
    99
    Location:
    Dog Empire
    I've got Friday, September 21st, 2007 as my Modified date. Is that congruent with Bhruic's patch?
     
  15. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,559
    Location:
    Baden-Württemberg, Germany
    no that is patch 3.13 - the latest of Bhruic's releases was November 2nd
    this explains the bug you are seeing :)
     
  16. Neato

    Neato Dog Culture Advisor

    Joined:
    Jan 14, 2008
    Messages:
    99
    Location:
    Dog Empire
    Oh good lord. Sorry for wasting people's time!

    Thanks for the help Ori! :goodjob:
     
  17. Yakk

    Yakk Cheftan

    Joined:
    Mar 6, 2006
    Messages:
    1,288
    An attempt to fix this a "more right" way:
    Code:
    	bool bPlayerExists = GET_PLAYER(eNewPlayer).isAlive();
    	FAssert(!bPlayerExists);
    	if (!bPlayerExists)
    	{
    		if (GET_PLAYER(eNewPlayer).isEverAlive()) {
    			// Erase all traces of the players existence in teams...
    			TeamTypes eNewPlayersOldTeam = GET_PLAYER(eNewPlayer).getTeam();
    			CvTeam& NewPlayersOldTeam = GET_TEAM(eNewPlayersOldTeam);
    			// Expunge the player from the old team:
    			NewPlayersOldTeam.changeEverAliveCount(-1);
    			// Find a team that is free, ideally one that was never used before:
    			TeamTypes ok_candidate = NO_TEAM; // as a default...
    			TeamTypes good_candidate = NO_TEAM; // as a default...
    			for (int iI = 0; iI < MAX_TEAMS; iI++)
    			{
    				CvTeam& kLoopTeam = GET_TEAM((TeamTypes)iI);
    				if (kLoopTeam.getAliveCount() == 0) {
    					ok_candidate = (TeamTypes)iI;
    				}
    				if (kLoopTeam.getEverAliveCount() == 0) {
    					good_candidate = (TeamTypes)iI;
    					break;
    				}
    			}
    			// This should only happen rarely...
    			if (good_candidate == NO_TEAM) {
    				good_candidate = ok_candidate;
    			}
    			FAssert(good_candidate != NO_TEAM);
    			// This should never happen -- but if it does, revert to old behavior
    			if (good_candidate == NO_TEAM) {
    				good_candidate = eNewPlayersOldTeam; // ok, we are desperate
    			}
    
    			// Splat the new team!
    			CvTeam& NewPlayersNewTeam = GET_TEAM(good_candidate);
    			bool TeamReuseWorked = NewPlayersNewTeam.ReuseTeam();
    			FAssert(TeamReuseWorked);
    
    			// Clear the player, and set the player to the new team:
    			GET_PLAYER(eNewPlayer).reset(GET_PLAYER(eNewPlayer).getID());
    			GET_PLAYER(eNewPlayer).setTeam(NewPlayersNewTeam.getID());
    		}
    		int iBestValue = -1;
    		LeaderHeadTypes eBestLeader = NO_LEADER;
    		CivilizationTypes eBestCiv = NO_CIVILIZATION;
    From CvPlayer.cpp, in the splitEmpire() function. (code at start and end is already in splitEmpire()).

    And from CvTeam.cpp:
    Code:
    bool CvTeam::ReuseTeam() {
    	TeamTypes eID = getID();
    	CvTeam& TeamToReuse = GET_TEAM(eID);
    	if (this->getAliveCount() > 0) {
    		return false;
    	}
    	// clear this team:
    	this->reset(eID);
    	for(TeamTypes oTeam = (TeamTypes)0; oTeam < MAX_TEAMS; oTeam = (TeamTypes)(oTeam+1))
    	{
    		CvTeam& kLoopTeam = GET_TEAM(oTeam);
    		kLoopTeam.m_aiStolenVisibilityTimer[eID] = 0;
    		kLoopTeam.m_aiWarWeariness[eID] = 0;
    		kLoopTeam.m_aiTechShareCount[eID] = 0;
    		kLoopTeam.m_aiEspionagePointsAgainstTeam[eID] = 0;
    		kLoopTeam.m_aiCounterespionageTurnsLeftAgainstTeam[eID] = 0;
    		kLoopTeam.m_aiCounterespionageModAgainstTeam[eID] = 0;
    		kLoopTeam.m_abHasMet[eID] = false;
    		kLoopTeam.m_abAtWar[eID] = false;
    		kLoopTeam.m_abPermanentWarPeace[eID] = false;
    		kLoopTeam.m_abOpenBorders[eID] = false;
    		kLoopTeam.m_abDefensivePact[eID] = false;
    		kLoopTeam.m_abForcePeace[eID] = false;
    		kLoopTeam.m_abVassal[eID] = false;
    	}
    	// clear the map!
    	for (int iI = 0; iI < GC.getMapINLINE().numPlotsINLINE(); iI++)
    	{
    		CvPlot* pLoopPlot = GC.getMapINLINE().plotByIndexINLINE(iI);
    
    		pLoopPlot->changeVisibilityCount(eID, -pLoopPlot->getVisibilityCount(eID), NO_INVISIBLE, false);
    
    		for (int iJ = 0; iJ < GC.getNumInvisibleInfos(); iJ++)
    		{
    			pLoopPlot->changeInvisibleVisibilityCount(eID, ((InvisibleTypes)iJ), -pLoopPlot->getInvisibleVisibilityCount(eID, ((InvisibleTypes)iJ)));
    		}
    
    		if (pLoopPlot->isRevealed(eID, false))
    		{
    			pLoopPlot->setRevealed(eID, false, false, eID, true);
    		}
    	}
    }
    
    This is a new method, so bool ReuseTeam(); has to be added to the interface of the class CvTeam.

    This seems to work -- I have a that used to cause 2 civilizations to go to war with me, and now it doesn't. My diplomatic state towards the new civilization is blank.

    The remaining flaws:
    1> The civ name and leader name are the old ones.
    2> The civ history (in the histograph) remains (This might be a feature!)
    ...
    and
    3> The culture of the old player stays on the map.

    Removing the culture of the "undead" player isn't that hard. I have it written but not tested (just loop over every tile in the game, and set the dead player's culture to 0).
     
  18. OpticalOrange99

    OpticalOrange99 Chieftain

    Joined:
    Jun 3, 2007
    Messages:
    26
    Are they never going to fix this? This happened to me too. Seems like a bloody simple bug to fix.
     
  19. matros

    matros Chieftain

    Joined:
    Oct 1, 2005
    Messages:
    35
    Location:
    Hlohovec, SK
    A funny thing happened to me yesterday - I played Europe map, as Victoria of English. The romans were wiped out early in the game (probably by the Greeks). Later on, I created a colony... now it gets weird...

    The colony name is Amercan Empire, their leader's name is Julius Ceasar(!), but he has a picture of Abe Lincoln(!!!) and the moment I created the colony, the Greeks and the Holy Romans declared war on me.

    I think the Greeks and HRE, were the civs, who were at war with the Romans at the "time of their death", but I am not sure... Do you think this has anything to do with it?

    (BTW the only mod I am using, is the Unaltered Gameplay Mod and I really don't remember if I am using the Unofficial patch) Thanks for any ideas:)

    M.
     
  20. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,559
    Location:
    Baden-Württemberg, Germany
    yes it has something to do with it - and in unmodded games the unofficial patch will fix this.
     

Share This Page