Specific Bug Reports

The AD code is more correct this time. I added more functionality in the modcomp then I have/had in AND. ;)
 
It's strange that you don't update your own mod with your modcomp. :D
 
Too many other features to add; it'd be 5 minutes I don't have, for functionality that isn't that earthshattering. ;)
 
In CvCityAI::AI_chooseProduction(), the following code is involved in deciding whether the AI should build a worker.
Code:
if (bDanger && (iExistingWorkers == 0) && (isCapital() || (iNeededWorkers > 0) || (iNeededSeaWorkers > iExistingSeaWorkers)))
Maybe I just don't understand the strategy that the AI is using here, but I'm pretty sure that should be "!bDanger". I don't think the AI wants to build a worker as a response to being in danger.

[edit]
Or maybe I'm wrong about this... is the AI choosing to build a worker because it expects improvements to be pillaged? I guess I should just not post "bug reports" until I properly understand what's going on.
 
I agree. The AI seemed to try to start a war wayyy too early. I added some code to block it. Feel free to nitpick it
think the early warplans are just a byproduct of jdog's changes to CvTeamAI::AI_isLandTarget, and you can keep this from happening by adding a true to the argument list when using that function in doWar, that way you actually save cpu cycles.


Code:
                                                if ((iPass > 1) || AI_isLandTarget((TeamTypes)iI[B], true[/B]) || AI_isAnyCapitalAreaAlone() || GET_TEAM((TeamTypes)iI).AI_isAnyMemberDoVictoryStrategyLevel4())
                                                {
                                                    if ((iPass > 0) || (AI_calculateAdjacentLandPlots((TeamTypes)iI) >= ((getTotalLand() * AI_maxWarMinAdjacentLandPercent()) / 100)) || GET_TEAM((TeamTypes)iI).AI_isAnyMemberDoVictoryStrategyLevel4())
                                                    {
                                                        iValue = AI_startWarVal((TeamTypes)iI);

                                                        if( iValue > 0 && gTeamLogLevel >= 2 )
                                                        {
                                                            logBBAI("      Team %d (%S) considering starting TOTAL warplan with team %d with value %d on pass %d with %d adjacent plots", getID(), GET_PLAYER(getLeaderID()).getCivilizationDescription(0), iI, iValue, iPass, AI_calculateAdjacentLandPlots((TeamTypes)iI) );
                                                        }

                                                        if (iValue > iBestValue)
                                                        {
                                                            iBestValue = iValue;
                                                            eBestTeam = ((TeamTypes)iI);
                                                        }
                                                    }
                                                }

Code:
                                        if (AI_isLandTarget((TeamTypes)iI[B], true[/B]) || (AI_isAnyCapitalAreaAlone() && GET_TEAM((TeamTypes)iI).AI_isAnyCapitalAreaAlone()))
                                        {
                                            if (GET_TEAM((TeamTypes)iI).getDefensivePower() < ((iOurPower * AI_limitedWarPowerRatio()) / 100))
                                            {
                                                iValue = AI_startWarVal((TeamTypes)iI);

                                                if( iValue > 0 && gTeamLogLevel >= 2 )
                                                {
                                                    logBBAI("      Team %d (%S) considering starting LIMITED warplan with team %d with value %d", getID(), GET_PLAYER(getLeaderID()).getCivilizationDescription(0), iI, iValue );
                                                }

                                                if (iValue > iBestValue)
                                                {
                                                    FAssert(!AI_shareWar((TeamTypes)iI));
                                                    iBestValue = iValue;
                                                    eBestTeam = ((TeamTypes)iI);
                                                }
                                            }
                                        }

I think dogpile warplans should still be possible, very early.
 
What I think is right:
Code:
	int iHealth = goodHealth() - badHealth();
[COLOR="Green"]/********************************************************************************/
/*	Better Evaluation							09.03.2010		Fuyu		    */
/********************************************************************************/[/COLOR]
	[COLOR="Gray"]int iHappyAdjust = 0;[/COLOR] [COLOR="Green"]// <-Don't redefine these variables where are already defined.[/COLOR]
	[COLOR="Gray"]int iHealthAdjust = 0;[/COLOR] [COLOR="Green"]// <-Don't redefine these variables where are already defined.[/COLOR]
	if (getProductionBuilding() != NO_BUILDING)
	{
		iHappyAdjust += getAdditionalHappinessByBuilding(getProductionBuilding());
		iHealthAdjust += getAdditionalHealthByBuilding(getProductionBuilding());
	}
[COLOR="Green"]/********************************************************************************/
/*	BE	END																		*/
/********************************************************************************/
/************************************************************************************************/
/* BETTER_BTS_AI_MOD                      09/02/10                         jdog5000 & Fuyu      */
/*                                                                                              */
/* City AI                                                                                      */
/************************************************************************************************/[/COLOR]
	int iTargetSize = iGoodTileCount;

	[COLOR="Green"][s]//iTargetSize = std::min(iTargetSize, 2 + getPopulation() + goodHealth() - badHealth() + getEspionageHealthCounter() + std::max(0, iHealthAdjust));[/s][/COLOR]
	iTargetSize -= std::max(0, (iTargetSize - (1 + getPopulation() + goodHealth() - badHealth() + getEspionageHealthCounter() + std::max(0, iHealthAdjust))) / 2);
	
	if( iTargetSize < getPopulation() )
	{
		iTargetSize = std::max(iTargetSize, getPopulation() - (AI_countWorkedPoorTiles()/2));
	}
	
	[COLOR="Green"]// Target city size should not be perturbed by espionage, other short term effects[/COLOR]
	iTargetSize = std::min(iTargetSize, getPopulation() + (happyLevel() - unhappyLevel() + getEspionageHappinessCounter() + std::max(0, iHappyAdjust)));
[COLOR="Green"]/************************************************************************************************/
/* BETTER_BTS_AI_MOD                       END                                                  */
/************************************************************************************************/[/COLOR]

Once again it was Afforess how noticed that the AI isn't focusing enough on city growth, I believe that might have been one reason.

Ok this is a stupid question. I tried to compile including this code, but apparently getAdditionalHealthByBuilding() and getAdditionalHappinessByBuilding() 'does not take 1 arguments'. The functions seem to require three arguments, the latter two of which are "int& iGood, int& iBad". I have no idea what to put for these arguments to make it compile. Please help!
 
You're obviously using Better BTS AI, which does not include the updated BULL code required for this.
iHappyAdjust += getAdditionalHappinessByBuilding(getProductionBuilding());
can be replaced by
int iGood = 0; int iBad = 0;
iHappyAdjust += getAdditionalHappinessByBuilding(getProductionBuilding(), iGood, iBad);
 
You're right, that works. Thanks.
 
You have no idea how happy it makes me that Better AI was able to make use of those functions from BULL. :D While they were very "simple" to write, it took a lot of time to track down all the sources from the XMLs, processBuilding(), etc. :eek:
 
I think I've found a bug with Better AI. I'm playing with v 1.01f, BUG 4.4 and my own mod which just adds new units/techs etc... In two consecutive games I discover a tech and am unable to trade it away, once with Theology and once with Education. When I press the F4 key it shows that the OTHER AIs "Can't Trade" even though they have the prereqs (I can check using Ctrl-Alt-L) - when I switch to the other AI it shows that my Civ "Can't Trade". It's like it's applying the Tech Monopoly AI code to the human player. I can supply a save game if needed.
 
I think I've found a bug with Better AI. I'm playing with v 1.01f, BUG 4.4 and my own mod which just adds new units/techs etc... In two consecutive games I discover a tech and am unable to trade it away, once with Theology and once with Education. When I press the F4 key it shows that the OTHER AIs "Can't Trade" even though they have the prereqs (I can check using Ctrl-Alt-L) - when I switch to the other AI it shows that my Civ "Can't Trade". It's like it's applying the Tech Monopoly AI code to the human player. I can supply a save game if needed.

Check in the xml if the tech has <bTrade>0</bTrade>.
 
Check in the xml if the tech has <bTrade>0</bTrade>.

It's set to 1 as it should be and I can trade the tech later on. I'm thinking this has something to do with the tech diffusion code in Better AI. It seems to be applying some of the AI tech trade code to the human player. If I turn tech diffusion off and load the game would I be effectively backing out? Will try that later today.
 
Never mind - looks like I bulbed Education and the game doesn't allow you to trade a tech you bulb on the turn you bulb it.
 
Top Bottom