Specific Bug Reports

I should really stop trusting you blindly :p

iValue += std::min(4,std::max(1, AI_bonusVal(bla)/10));

This will add at least 1 point, and at most 4 points for a single resource. Which makes a lot more sense.

... Oops.

Well in my defense, I really feel like a function called "min(4, x)" should "enforce a minimum value of 4 onto x"... But of course that's what max() does, and I have to presently type *sheepish* again. My other two recent faux pawz were minor and forgivable though... this blunder here may require an army of sheep in order to look sheepish enough. Sigh. Thanks Fuyu!

Edit - Nevermind, I forgot, that's what the extremely-complicated AI_baseBonusVal() function does. Right, so JDog already took out the min() condition entirely in his update the other day, which I agree with... and cut the divisor in half from 10 down to 5, which I can't argue with without knowing more about the AI_bonusVal() return range... So it's a moot point, but yeah, sorry. I'm gonna try really hard to regain your blind trust in the future. :)
 
I'm still using the 1.0 version of Better AI. I have merged it in to my mod and I just suddenly realized that peace treaties after wars last only one turn. I thought they should last the 10 turns as it says inside the (). I don't know if this is a bug in my own mod so I'll need to test this with better ai only. I'll report back soon...

EDIT: Sorry, this is a false report. It seems that the problem is in my mod... :sad:
 
void CvUnitAI::AI_barbAttackSeaMove()

Code:
	if( GC.getGameINLINE().getSorenRandNum(3, "AI Check trapped") == 0 )
	{
		// If trapped in small hole in ice or around tiny island, disband to allow other units to be generated
		bool bScrap = true;
		int iMaxRange = [COLOR="Red"]maxMoves()[/COLOR] + 2;

I believe maxMoves() should be baseMoves().

There are many similar codes in the file (or other).
It makes that AI_assaultSeaReinforce() is too slow.

Sorry if it is already reported.
 
LOL, the AI has just razed his own city after it has been conquered by me. This is not questionable, this is a bug:

attachment.php
 
Cybah, I'm going to need a save or something more to go on here (BULL AI saves are fine). You're reporting a bunch of things which don't make sense given the code that's in place. For example, it's always been impossible for a leader to choose to raze a city where it has 25% cultural claim or higher, as it sounds like was the case in what you just posted.
 
void CvUnitAI::AI_barbAttackSeaMove()

Code:
	if( GC.getGameINLINE().getSorenRandNum(3, "AI Check trapped") == 0 )
	{
		// If trapped in small hole in ice or around tiny island, disband to allow other units to be generated
		bool bScrap = true;
		int iMaxRange = [COLOR="Red"]maxMoves()[/COLOR] + 2;

I believe maxMoves() should be baseMoves().

There are many similar codes in the file (or other).
It makes that AI_assaultSeaReinforce() is too slow.

Sorry if it is already reported.

Thanks! That should help speed things up.
 
Cybah, I'm going to need a save or something more to go on here (BULL AI saves are fine). You're reporting a bunch of things which don't make sense given the code that's in place. For example, it's always been impossible for a leader to choose to raze a city where it has 25% cultural claim or higher, as it sounds like was the case in what you just posted.

No chance, it's my mod.

The city plot had 99% culture of netherlands (my enemy). I took the city some rounds before.

I AM observing, that the AI is nearly destroying 50% of all the cities it is conquering, no matter if the AI was the previous owner and no matter how many world wonders are in the city. The AI is even razing holy cities.
 
Hmmm ... then there's something screwy going on with your merge it would seem.

A couple things:

1. Have you somehow changed the value for RAZING_CULTURAL_PERCENT_THRESHOLD to 0? The default is 25, and that should block razing of cities where AI has 25% or more culture.

2. To get BBAI log output, compile your mod with /DLOG_AI compiler flag. If you use a Makefile, you might have a line that starts with:

Final_Release_GLOBAL_CFLAGS =

and you could add it to that, otherwise look for /D_USRDLL and add the new one after that where it occurs. You might want to add it for debug and release.

3. I think you might want to check your source code merge for the CvPlayerAI::AI_conquerCity function against the BBAI sources on svn.
 
Believe me, I did not alter AI decisions. ;) I'm using modcomps and own game options. That's all. Everything else is BBAI related.
 
You're not giving jdog a chance to track down this bug if it's in BBAI. You have a test case only you can reproduce in code you won't share. If you want jdog's help, you really need to give him something he can go on.
 
I don't have the time to play stock BBAI games and observe AI behavior. My mod (BASE) is public (@civforum.de), but not well translated into english. I can give you the link but since the debug option is not set, you won't get BBAI logs. My sources are not public, that's right, but everytime I see an update on SVN, I'm merging the code with my source files. There is in fact no difference to BBAI on that function.

Everything I report is NOT related to my mod. AI behavior is untouched.

I know it's hard to track down without a savegame or log, but I guess reporting is still better than keeping quiet about it.
 
This is similar to #563.

void CvUnitAI::AI_attackSeaMove()
Code:
/********************************************************************************/
/* 	BETTER_BTS_AI_MOD						06/14/09	Solver & jdog5000	*/
/* 																			*/
/* 	Naval AI																*/
/********************************************************************************/
	if (plot()->isCity(true))
	{
		int iOurDefense = GET_TEAM(getTeam()).AI_getOurPlotStrength(plot(),0,true,false,true);
		int iEnemyOffense = GET_PLAYER(getOwnerINLINE()).AI_getEnemyPlotStrength(plot(),2,false,false);

		if( getDamage() > 0 )	// extra risk to leaving when wounded
		{
			iOurDefense *= 2;
		}

		if( iEnemyOffense > iOurDefense/4  || iOurDefense == 0) //prioritize getting outta there
		{
			if (AI_anyAttack(2, 50))
			{
				return;
			}

			if (AI_shadow(UNITAI_ASSAULT_SEA, 4, 34, false, true, [COLOR="Red"]getMoves()[/COLOR]))
			{
				return;
			}
I believe that it should be
Code:
			if (AI_shadow(UNITAI_ASSAULT_SEA, 4, 34, false, true, [COLOR="Blue"](movesLeft() / GC.getMOVE_DENOMINATOR())[/COLOR]))
			{
				return;
			}
or
Code:
			if (AI_shadow(UNITAI_ASSAULT_SEA, 4, 34, false, true, [COLOR="Blue"]baseMoves()[/COLOR]))
			{
				return;
			}
(Sorry, I have no idea about your intention and which should be.)

At all events, AI_shadow should receive a max path TURNS at sixth argument, should not receive a MOVEMENT POINT.
(There is many similar getMoves() in the file (or others). For example, AI_pirateBlockade(). It causes too slow.)
 
Are you sure about that (that this causes slowdowns)?
The default value of that sixth argument is MAX_INT, and it doesn't loop over plots in the vincinity but over player units and will always do a generatePath(pLoopUnit->plot(), 0, true, &iPathTurns), which is the slow part of the function as far as I can see.

You are of course right about the meaning of said 6th argument, it's max for path TURNS, not movement points.
 
Are you sure about that (that this causes slowdowns)?
bool CvUnitAI::AI_pirateBlockade()
Spoiler :
Code:
	while (pUnitNode != NULL)
	{
		CvUnit* pLoopUnit = ::getUnit(pUnitNode->m_data);
		pUnitNode = pLoopPlot->nextUnitNode(pUnitNode);
		if (isEnemy(pLoopUnit->getTeam(), pLoopUnit->plot()))
		{
			if (pLoopUnit->getDomainType() == DOMAIN_SEA && !pLoopUnit->isInvisible(getTeam(), false))
			{
				if (pLoopUnit->canAttack())
				{
					if (pLoopUnit->currEffectiveStr(NULL, NULL, NULL) > currEffectiveStr(pLoopPlot, pLoopUnit, NULL))
					{
						[COLOR="Red"]iBestHostileMoves[/COLOR] = std::max(iBestHostileMoves, [COLOR="Red"]pLoopUnit->getMoves()[/COLOR]);									
					}
				}
			}
		}
	}
	if (iBestHostileMoves > 0)
	{
		for (int iX = -[COLOR="Blue"]iBestHostileMoves[/COLOR]; iX <= [COLOR="Blue"]iBestHostileMoves[/COLOR]; iX++)
		{
			for (int iY = -[COLOR="Blue"]iBestHostileMoves[/COLOR]; iY <= [COLOR="Blue"]iBestHostileMoves[/COLOR]; iY++)
			{
				CvPlot * pRangePlot = plotXY(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), iX, iY);
				if (pRangePlot != NULL)
				{
					aiDeathZone[GC.getMap().plotNumINLINE(pRangePlot->getX_INLINE(), pRangePlot->getY_INLINE())]++;
				}
			}
		}
	}
pLoopUnit->getMoves() is movement range that is multiplied by GC.getMOVE_DENOMINATOR().
It is too large more than net movement range, and total loop count is too large too.

.....


Whoops!
GC.getMOVE_DENOMINATOR() is only 60!
I have changed it to 2520(L.C.M. 2~10) in my modmod and speed problem has been caused by it...:hammer2:.

At least, I believe jdog intended it is net movement range, not denominated movement point.
 
I haven't checked the code or XML, but is it possible that sea units' movement points are 1-based rather than 60-based since they don't need to support the changes to tile MP costs that roads and railroads provide?
 
My bad, I thought you meant AI_shadow was slowed down. :hammer2:

MOVE_DENOMINATOR only has one value, I don't think water is handled any different from land.
 
There is no difference about MOVE_DENOMINATOR between land unit and sea unit.

Yea, sea unit doesn't need fractional movement point.
But there is no reason that makes different algorithm about movement point between land unit and sea unit.
And MOVE_DENOMINATOR supports both of land unit and sea unit.
 
PHP:
		// Reasons to always raze
		if( 2*pCity->getCulture(pCity->getPreviousOwner()) > pCity->getCultureThreshold(GC.getGameINLINE().culturalVictoryCultureLevel()))

You do not check for cultural victory enabled. Should be:

PHP:
		// Reasons to always raze
		if( 2*pCity->getCulture(pCity->getPreviousOwner()) > pCity->getCultureThreshold(GC.getGameINLINE().culturalVictoryCultureLevel()) && GC.getGameINLINE().culturalVictoryValid())


Cause of this missing code, cities with a lot of world wonders will always get destroyed - since world wonders provide massive culture.

Also, holy cities should never get destroyed (if not unlikely to hold them) since those cities with their holy wonder provide a lot of gold.
 
Back
Top Bottom