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

Unofficial BTS 3.13 patch

Discussion in 'Civ4 - General Discussions' started by Bhruic, Oct 5, 2007.

  1. grumbler

    grumbler Prince

    Joined:
    Oct 29, 2001
    Messages:
    492
    Location:
    In front of the screen
    Apparently. ;)

    (^ click link for once again updated installer)
     
  2. Bhruic

    Bhruic Emperor

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    Yeah, I know they are added for fresh water... But the point is, Flood Plains have a 100% chance of appearing on desert squares next to rivers. To my mind, that means any desert tile adjacent to a river should be Flood Plains. Adding the extra river to give fresh water was breaking this rule, so I consider it a "bug" to be fixed - which I did.

    Bh
     
  3. Roland Johansen

    Roland Johansen Deity

    Joined:
    Apr 29, 2003
    Messages:
    4,292
    Location:
    the Netherlands
    I believe I was one of the people who requested this change, so thank you. :goodjob: My reasoning was similar to yours.

    If I recall correctly, you can't have deserts in the BFC anyway, so it won't improve the starting position directly. It improves the immediate surroundings of the starting position and I guess it will rarely make these surroundings overpowering.
     
  4. Bhruic

    Bhruic Emperor

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    I thought you requested it, but oddly I couldn't find where you did when I went looking.

    Yeah, the BFC squares would have been upgraded to Flood Plains regardless.

    Bh
     
  5. glider1

    glider1 Deity

    Joined:
    May 29, 2006
    Messages:
    2,784
    Location:
    Where animals hop not run
    Thanks for the updated patch Bhruic seriously :goodjob:
    Cheers.
     
  6. obsolete

    obsolete Deity

    Joined:
    Dec 17, 2005
    Messages:
    6,201
    Location:
    Planet Earth
    I assume there was some AI changes in the patch as well? I just noticed a UN vote, where all the AI's didn't blindly follow "Ban Nukes!" That was shocking... Or is this a fluke?
     
  7. Bhruic

    Bhruic Emperor

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    As much as I'd like to take credit, I don't think I made any changes to AI voting, so I'll have to go with 'fluke'.

    Bh
     
  8. obsolete

    obsolete Deity

    Joined:
    Dec 17, 2005
    Messages:
    6,201
    Location:
    Planet Earth
    Well that is interesting. Because ever since the first Vanilla release, I have NEVER seen an AI vote 'NO' for banning nukes. Somehow, your patch has altered something.

    Most things seemed to be hard-coded for just one answere with the UN resolutions. Just like emancipation, it doesn't matter how stupid it is in that point of time for an AI to vote yes, they will ALL vote yes no matter what for universal emancipation. This was actually a very good exploit and why I never went after democracy in Vanilla.

    Somehow, your patch is changing how the AI votes.

    BTW, I only noticed one spy bug last night (I think?). I was under buddism, and Saladin was under Hinduism. But at the very end of the game, he switched to free-religion. As soon as he did that, I got a -15% bonus discount for shared religion vshim. I don't understand how that is possible, as Justinian was the one who even founded buddism even. And I never captured any cities.

    Any thoughts on what could have caused this?
     
  9. Roland Johansen

    Roland Johansen Deity

    Joined:
    Apr 29, 2003
    Messages:
    4,292
    Location:
    the Netherlands
    I've read a report about the AI voting 'no' to the banning nukes UN vote and that poster was also surprised. Maybe it's a rare occurrence but apparently it can happen. Maybe it has to do with the technological situation in the world. When you're ahead in research and most of the AI civilization don't have uranium or haven't researched the technology to see uranium, then it's quite logical to vote in favour of the ban. When you have build some nukes and an AI who also just discovered uranium hasn't constructed any yet, then it is logical that it doesn't want to ban nukes.

    Very often the human player will be ahead at this stage of the game because most players will quit when they're not ahead at this stage or earlier. Thus the situation where it is beneficial for the AI to NOT ban nukes doesn't occur very often.
     
  10. obsolete

    obsolete Deity

    Joined:
    Dec 17, 2005
    Messages:
    6,201
    Location:
    Planet Earth
    Ohh, I also forgot. This patch now prevents me from STEALING a tech, and then trading it in the same turn. I used to be able to jump 3 levels in a turn that way. Steal-trade-steal.
     
  11. Bhruic

    Bhruic Emperor

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    Do you play with No Tech Brokering? If so, that's why, you can no longer trade techs that you have stolen.

    Bh
     
  12. obsolete

    obsolete Deity

    Joined:
    Dec 17, 2005
    Messages:
    6,201
    Location:
    Planet Earth
    Oh I can trade them alright, it's just I cant trade them anymore on the same turn I stole them. Also, the menu that shows "Player WANTS x-tech" doesn't update with the tech I stole until the next turn starts.

    I was wondering if you did this on purpose to fix a game-mechanic you thought was flawed, and just didn't document it in the patch.
     
  13. Bhruic

    Bhruic Emperor

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    Odd. The only change with regards to stealing tech I made was the "No Tech Brokering" change. AFAIK, I didn't touch anything else.

    Bh
     
  14. jkp1187

    jkp1187 Unindicted Co-Conspirator

    Joined:
    Aug 29, 2004
    Messages:
    2,496
    Location:
    Pittsburgh, Pennsylvania
    I see the "no" votes on the non-proliferation treaty all the time in the UN. Basically, if one player gets nukes, and the others don't have any but have the ability to build them, those civs tend to vote "no".

    Of course I tend to play my games to the end regardless of how well I'm doing. ;)
     
  15. Roland Johansen

    Roland Johansen Deity

    Joined:
    Apr 29, 2003
    Messages:
    4,292
    Location:
    the Netherlands
    I'm also not a quitter. I was just trying to find a reasonable explanation why the idea that the AI always votes in favour of the ban of nukes exists on the forum. Thanks for confirming that this perception is nonsense.
     
  16. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    Poking through the CityAI code today, I found the following strange section in CvCityAI::AI_neededDefenders:

    Code:
    	if ((GC.getGame().getGameTurn() - getGameTurnAcquired()) < 10)
    	{
    		if (bOffenseWar)
    		{
    			if (!hasActiveWorldWonder() [B]|| isHolyCity()[/B])
    			{
    				iDefenders /= 2;
    				iDefenders = std::max([B]1[/B], iDefenders);
    			}
    		}		
    	}
    	
    	if (GC.getGame().getGameTurn() - getGameTurnAcquired() < 10)
    	{
    		iDefenders = std::max([B]2[/B], iDefenders);
    		if (AI_isDanger())
    		{
    			iDefenders ++;
    		}
    		if (bDefenseWar)
    		{
    			iDefenders ++;
    		}
    	}
    
    The first weirdness is the handling of holy cities recently captured holy cities during offensive war. It sure seems to me that a holy city should get extra protection, not less! This seems like a bug to me.

    The second odd bit is not so critical, but during offensive war the first if recently acquired clause sets the minimum number of defenders to 1 and the second one will then always immediately bump it up to 2.

    Here's my thought on how it could be written:

    Code:
    	if ((GC.getGame().getGameTurn() - getGameTurnAcquired()) < 10)
    	{
    		if (bOffenseWar)
    		{
    			if (!hasActiveWorldWonder() [B]&& !isHolyCity()[/B])
    			{
    				iDefenders /= 2;
    				iDefenders = std::max(1, iDefenders);
    			}
    		}
    		else
    		{
    			iDefenders = std::max(2, iDefenders);
    		}
    
    		if (AI_isDanger())
    		{
    			iDefenders ++;
    		}
    		if (bDefenseWar)
    		{
    			iDefenders ++;
    		}
    	}
    
    How does that sound?
     
  17. Bhruic

    Bhruic Emperor

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    Good catch. :goodjob:

    Close, but not quite. The problem with the way you've got it written is what if bOffenseWar is true, and either hasActiveWorldWonder() or isHolyCity() is true? Then it won't hit either of the std:max() calls.

    A better way to handle it, imo:
    Code:
    if ((GC.getGame().getGameTurn() - getGameTurnAcquired()) < 10)
    {
    	iDefenders = std::max(2, iDefenders);
    
    	if (bOffenseWar)
    	{
    		if (!hasActiveWorldWonder() && !isHolyCity())
    		{
    			iDefenders /= 2;
    		}
    	}		
    	
    	if (AI_isDanger())
    	{
    		iDefenders++;
    	}
    	if (bDefenseWar)
    	{
    		iDefenders++;
    	}
    }
    
    Bh
     
  18. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
  19. glider1

    glider1 Deity

    Joined:
    May 29, 2006
    Messages:
    2,784
    Location:
    Where animals hop not run
    Is this the final simplification?

    Code:
    Code:
    if ((GC.getGame().getGameTurn() - getGameTurnAcquired()) < 10)
    {
    	iDefenders = std::max(2, iDefenders);
    
    	if (bOffenseWar)
    	{
    		if (!(hasActiveWorldWonder() || isHolyCity()))
    		{
    			iDefenders /= 2;
    		}
    	}		
    	
    	if (AI_isDanger() || bDefenseWar)
    	{
    		iDefenders++;
    	}
    }
    
    What about a city with national wonders? Are they not significant too?

    When you look at the original code I feel for the poor coder! The writing at that point looks like they must have needed a strong cup of coffee or eight hours of sleep or both. :)

    Does this "bug" partially mean that the AI would have a tendancy to hesitate during an offensive campaign, when there is a possibility of a counter attack on it from a third party civ, because it realises that it's Holy City is exposed!?! and so must consider a retreat?

    What a good find!!! :goodjob::goodjob: A really good bug fix that should mean AI's fight better wars.
    Cheers.
     
  20. mjs0

    mjs0 The 4th X

    Joined:
    Nov 9, 2001
    Messages:
    1,063
    Location:
    Central Florida
    That looks like a 'simplification' too far to me since the original would increment iDefenders twice if both bDefenseWar and AI_IsDanger() were true, merging into one if statement leaves it incrementing only once.
    (Unless I am missing something and there is a reason the two are mutually exclusive.)

    If you desperately want to make the code shorter you could change the final section to read:
    Code:
    iDefenders += bDefenseWar + AI_IsDanger();
    but whatever you do don't
    Spoiler :
    write the way an (ex) co-worker used to code, making the entire function a single line such as:
    Code:
    if ((GC.getGame().getGameTurn() - getGameTurnAcquired()) < 10)
    iDefenders = std::max(2, iDefenders) / ( 1 + (bOffenceWar && !hasActiveWorldWonder() && !isHolyCity()))
               + bDefenceWar 
               + AI_IsDanger();

    I don't believe national wonders are significant as they cannot be captured (they disappear on capture don't they?) and this code is only relevant to recently captured cities.

    oh, and a big :goodjob: to the original bugspotter.
     

Share This Page