Unofficial BTS 3.13 patch

I think the river gets added for the river benefits (fresh water, trade routes), not to improve the overall terrain by creating flood plains, so this might not have been unintentional. Still, I like this change, it's just annoying and irritating to find those desert tiles.

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
 
Great to see you continue your work Bhruic, though it's sad you have to, i.e. that the official patch is taking so long.



I think the river gets added for the river benefits (fresh water, trade routes), not to improve the overall terrain by creating flood plains, so this might not have been unintentional. Still, I like this change, it's just annoying and irritating to find those desert tiles.

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

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.
 
I believe I was one of the people who requested this change, so thank you. :goodjob: My reasoning was similar to yours.

I thought you requested it, but oddly I couldn't find where you did when I went looking.

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.

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

Bh
 
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?
 
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
 
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?
 
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.

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.
 
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.
 
Do you play with No Tech Brokering? If so, that's why, you can no longer trade techs that you have stolen.

Bh
 
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.
 
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
 
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.

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. ;)
 
Of course I tend to play my games to the end regardless of how well I'm doing. ;)

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.
 
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?
 
Poking through the CityAI code today, I found the following strange section in CvCityAI::AI_neededDefenders

Good catch. :goodjob:

How does that sound?

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
 
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.
 
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.
 
Back
Top Bottom