Specific Bug Reports

Ooops - I solved the problem, I forgot to patch warlords to 2.08 - it's working now!

J

PS: A big thanks to the development team on this, you've really improved the game!
 
While working on the Smarter Orcs mod, I found the following defect that is likely hidden when playing Vanilla or Warlords.

((UnitTypes)(GC.getCivilizationInfo(getCivilizationType()).getCivilizationUnits()

can return NO_UNIT (and will, in some mods).

There are a few places in the BetterAI code which don't account for this. There are two instances in CvPlayerAI::AI_getStrategyHash(), and one in CvCityAI::AI_buildingValueThreshold().
 
CvUnitAI::AI_anyAttack allows an attack on a city with no defenders through its series of if statements in plot for loops. Unfortunately, several places in the code require an enemy unit to be attacked, so one gets a crash.

My fix was:

Code:
								CvUnit* enemy = pLoopPlot->getBestDefender(NO_PLAYER,getOwnerINLINE()); //wish I could use the summoned unit here
								// Smarter Ocs start- crash fix.
								if (enemy != NULL)
								{
with the obvious end-brace later in the code.
 
The code from BetterAI in comments does not work; while using it, I can easily get negative numbers of bonuses in a city. I replaced it with the vanilla code (not in comments).
Code:
			if (((pPlotCity != NULL) && GET_TEAM(getTeam()).isHasTech((TechTypes)(GC.getBonusInfo(eNonObsoleteBonus).getTechCityTrade()))) ||
//			if (GET_TEAM(getTeam()).isHasTech((TechTypes)(GC.getBonusInfo(eNonObsoleteBonus).getTechCityTrade()))) // BetterAI // Smarter Orcs - defective; reverted to older code.
//			{
//				if (pPlotCity != NULL || // BetterAI// Smarter Orcs - defective; reverted to older code.
 
There are a couple division by 0 possibilities here:

Code:
		iValue /= (max(0, (iDifferentAreaTile - ((iNumCityPlots * 2) / 3))) + 2);
should be:
Code:
		iValue /= (max(1, (iDifferentAreaTile - ((iNumCityPlots * 2) / 3))) + 2); // Smarter Orcs fix


Code:
	iValue /= (max(0, (iBadTile - (iNumCityPlots / 4))) + 3);
should be
Code:
 	iValue /= (max(1, (iBadTile - (iNumCityPlots / 4))) + 3); // Smarter Orcs fix.
 
Code:
							if (GET_PLAYER(getOwnerINLINE()).AI_getAttitude(pLoopPlot->getOwnerINLINE()) ==	ATTITUDE_FRIENDLY)
							{
								iValue /= 10;
							}
should be:
Code:
							if (GET_PLAYER(getOwnerINLINE()).AI_getAttitude(pLoopPlot->getOwnerINLINE()) ==	ATTITUDE_FRIENDLY)
							{
								iTempValue /= 10; // Smarter Orcs defect fix.
							}
 
Less code this time, since some of the related material has changed dramatically in Smarter Orcs.

1) The non-obsolete bonus code does not account for the possibility that this is the last bonus of the type, and this player presently owns it.

2) The following code has two defects; the second comparison is invalid, and this can easily result in a negative value:

Code:
					if ((iTempValue	> 80) && (pLoopPlot->getOwnerINLINE() == getID()))
					{
						//captured territory special case
						iTempValue *= (100 - iTempValue);
						iTempValue /= 100;
					}
I'm really not certain what the above code is supposed to do (if you know, please clarify it for me), but here's a version without the above defects; if the plot is really valuable, and another team was the original owner, but is no longer, reduce the value of the plot by the percentage that the city's owner owns it by:
Code:
					// Smarter Orcs start
					if ((iTempValue	> 80) && (pLoopPlot->findHighestCultureTeam() != getTeam()) && 
						(pLoopPlot->getTeam() != pLoopPlot->findHighestCultureTeam()))
					{
						//captured territory special case
						iTempValue *= (100 - iPlotOwnedPercent);
						// Smarter Orcs end
						iTempValue /= 100;
					}
 
There is division by iProductionAdvantage and iGreatPeopleAdvantage. For mods that use certain negatives for modifiers, it's possible to get either of these values to 0, which causes a crash.

Code:
	iProductionAdvantage = ((iProductionAdvantage * (iNumCities - 1) + 200) / (iNumCities + 1));
	//Smarter Orcs start - patch to prevent crash
	if (iProductionAdvantage <= 0)
	{
		iProductionAdvantage = 1;
	}
	// Smarter Orcs end
	iProductionMultiplier *= iProductionAdvantage;
	iProductionMultiplier /= 100;

	iCommerceMultiplier *= 100;

	iCommerceMultiplier /= iProductionAdvantage;

	int iGreatPeopleAdvantage = 100 * getTotalGreatPeopleRateModifier();
	iGreatPeopleAdvantage /= GET_PLAYER(getOwnerINLINE()).AI_averageGreatPeopleMultiplier();
	iGreatPeopleAdvantage = ((iGreatPeopleAdvantage * (iNumCities - 1) + 200) / (iNumCities + 1));
	iGreatPeopleAdvantage += 200; //gpp multipliers are larger than others so lets not go overboard
	iGreatPeopleAdvantage /= 3;
	//Smarter Orcs start - patch to prevent crash
	if (iGreatPeopleAdvantage <= 0)
	{
		iGreatPeopleAdvantage = 1;
	}
	// Smarter Orcs end
	//With great people we want to slightly increase food priority at the expense of commerce
	//this gracefully handles both wonder and specialist based GPP...
	iCommerceMultiplier *= 100;
	iCommerceMultiplier /= iGreatPeopleAdvantage;
 
Dunno if this is the right place to report this but,

Every single game, after a while the graphics switch from normal to, not so normal, as illustrated by the picture:


Note that i don't have this problem without the better ai mod in use, so i'm suspecting it has something to do with this, somehow.

I have bts latest version of betterai, 3.17 and the Bug mod installed.

What can i do? Can lowering graphic settings help?

Also i just noticed that my penninsula looks like England. :p
 
That graphics bug happened to me in default vanilla Civ until I got a new video card. I'm 99.9% sure it's related to you having a low end Video Card. Try installing the latest drivers for it, and also think about upgrading your system.

Anyway it has nothing to do with this mod.
 
Yes, the "black ice" bug is usually because your graphics card does not support (well) the shaders Civ IV uses. This is very common if running Civ IV under VMware Fusion on a Macbook Pro.
 
My video card is an Ok one, the best of the older generation. :( My computer itself cant support a new gen video card so i have to get a new computer. :(

But for some reason i don't get it while playing without betterAI installed. >.< any reason why?
 
There's a bug in the curren SVN (rev 406) implementation of the Spread Culture espionage fix. You now have the full Unofficial Patch fix but you also have the remnants of a previous fix so the mission actually spreads 500% culture in BetterAI. There is a report with saves and screenshots posted by PieceOfMind in the BTS forum.

Here's the relevant code from CvPlayer::doEspionageMission():
Code:
				/********************************************************************************/
				/**		BETTER_BTS_AI_MOD						8/16/08		Dresden & jdog5000	*/
				/**																				*/
				/**		Bugfix																	*/
				/********************************************************************************/
				/* original BTS code
				iCultureAmount /= 10000;
				*/
				iCultureAmount /= 100;
				/********************************************************************************/
				/**		BETTER_BTS_AI_MOD						END								*/
Since the block following that code uses the Unofficial Patch change of pCity->changeCulture() instead of the original BTS 3.17 pCity->changeCultureTimes100(), you need to go back to the original BTS code in the quoted piece and use iCultureAmount /= 10000 again.
 
I made recently some civic changes to my mod and at that time I looked in SDK files how AI player decides what civic options it should use. One thing that I noticed was that even though BtS has civic modifier for building health changes, this modifier doesn't seem to have any affect in SDK how AI player values building health changes. Regular BtS doesn't use this particular modifier but many mods do use it, so perhaps someone could take a look at it? I can't now remember if there was any other modifiers that weren't included in AI player's civic calculations as it's been month since I looked through that code section.
 
I believe I should post about it here...

I am using v0.60h(I downloaded from the development thread, is it the same one that you did put up today a new thread for??) merged with BUG mod.

This error is, without a doubt, Better AI related(or dumb me related!).

It only seems to happen when I use that new "Planet Generation" function from the BTS. While it loads the map I get a few error pop-ups such as:

Assert Failed

File: c:\mods\bts\beyond better ai\trunk\cvgamecoredll\cvglobals.cpp
Line: 3493
Expression: strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
Message: info type NO_FEATURE not found, Current XML file is: xml\GameInfo/CIV4EspionageMissionInfo.xml

----------------------------------------------------------

If I ignore it once I get:

Assert Failed

File: c:\mods\bts\beyond better ai\trunk\cvgamecoredll\cvglobals.cpp
Line: 3493
Expression: strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
Message: info type DIRECTION_NORTH not found, Current XML file is: xml\GameInfo/CIV4EspionageMissionInfo.xml

----------------------------------------------------------

And:

Assert Failed

File: c:\mods\bts\beyond better ai\trunk\cvgamecoredll\cvglobals.cpp
Line: 3493
Expression: strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
Message: info type DIRECTION_NORTHEAST not found, Current XML file is: xml\GameInfo/CIV4EspionageMissionInfo.xml

----------------------------------------------------------

And so on... If I click "Ignore Always" it will load the map then, but I guess I shouldn't play on it an?

So, why is this happening?

Ps: Funny part is that I have no folder that is named like this.
 
Now, I get also an error while making a Teutonic(terrible spelling I believe) kind of maps. This error was with me playing only Better AI mod, no BUG(nothing in custom assets either, I made a brand new one to be sure). This one I can't even ignore because it freezes the game.

Assert Failed

File: c:\mods\bts\beyond better ai\trunk\cvgamecoredll\cvplayer.cpp
Line: 1893
Expression: false
Message: python findStartingPlot() returned an invalid plot index!

----------------------------------------------------------

Again this folder from oblivion shows up... Any suggestions? Can anybody check it something like it happens with them too?

I will try to save a map in vanilla and load it up as a public map with BetterAI mod. Maybe it works.

EDIT: Yep, it worked. It seems the problem is while making a new map. No idea what is is though, it is only happening with a few map modes, not all(I checked most).
 
What exactly did you do to produce the first set of errors? I tried doing "Custom Game" with a bunch of different map scripts and then choosing "Regenerate Map" once the map had loaded and didn't have any problems. Not sure what you meant by "Planet Generation" ...

I did manage to reproduce the assert firing when using the Tectonics maps script. I don't know why it crashed on you, after ignoring the asserts the map loaded for me. It should be a non-fatal problem, basically what's happened is that the Python script for Techtonics failed to find a starting location for a player and isn't reporting that back correctly to the DLL ... it's saying it found one but the starting plot is not defined. The DLL logic for picking a starting location will then take over after the assert is ignored and everything should work out okay. The map maker for Tectonics may not have had access to a debug DLL and so may not have seen these minor errors, with a normal DLL the asserts don't fire and everything would appear to work just fine.

The phantom folders are where the source code for building the debug dll is located on my computer ... glad I didn't name the folders anything too weird! The information of where the source for the different parts of the debug dll most be compiled in and shown in the assert to help figure out what went wrong. So, no worries about that.
 
Top Bottom