AND2 and SVN Bug Reports - A New Dawn 2 ONLY

45°38'N-13°47'E;13471032 said:
I've had a look at the logs but not at the code and I see that Alphabet has always small values in comparison to other techs that AI can consider to research. Is there something wrong with the code or just with the tech? I mean, can we fix it by simply increasing tech value or should AI evaluate better that tech and it's simply underestimating it because AI can't understand its use?

Here's the valuation in CvPlayerAI.cpp:

Code:
        if (GC.getTechInfo(eTech).isTechTrading() && !GC.getGameINLINE().isOption(GAMEOPTION_NO_TECH_TRADING))
        {
                iValue += 500;

                iValue += 500 * iHasMetCount;
        }

I think a lot of the valuation for tech effects are underpowered since the new C2C building AI code for techs. Since buildings can be 7500+ (since a tech may unlock multiple techs), this makes the AI weight of 500 (or even 500 * 10) is pretty low. I think increasing the base value by 5 would work.
 
I've drastically increased value for Alphabet in rev827 since AI was ignoring it. Even now, AI sometimes prefer Math or Monarchy to enter Classical Era. AI is choosing alphabet when there are other civs around so that they can trade techs.
In rev827 I've also made handicap level visible when hovering over the civ name in the list near the minimap; it's useful when playing with Flexible AI difficulty. This leads me to another problem anyway. I think handicap levels are really too close to each other. Even when using Flexible AI, some civs go up to Deity very fast, some others go down to Settler in the same time, but their gap in terms of techs, military strenght and so on remains the same. I've never ever seen an AI which suffered from an increased handicap level falling behind, not to mention seeing them decreasing again their handicap level. Same for AIs who were falling behind and had their difficulty level decreased. This is plainly wrong IMO; right now Flexible AI doesn't do almost anything. To make things worst, if only AI is using Flexible Difficulty but human player is not, I've seen that although I was the tech and score leader other civs were getting their difficulty increased, making them fall behind further.
There's another thing that's bugging me since some time, we've talked about it already but I'm not convinced it's working as intended. Here's the relevant code

Code:
int CvTeam::getResearchCost(TechTypes eTech) const
{
	int iCost;
	int iFinalMultiplier = 1;

	FAssertMsg(eTech != NO_TECH, "Tech is not assigned a valid value");

	iCost = GC.getTechInfo(eTech).getResearchCost();

	if ( iCost > MAX_INT/10000 )
	{
		iCost /= 10000;
		iFinalMultiplier = 10000;
	}

[COLOR="Red"]	//	Arkatakor
	if (!isHuman() && !isBarbarian())
	{
		//	The handicap type will be based on the average handicap of all human players
		iCost *= GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIResearchPercent();
	}[/COLOR]
	else
	{
		iCost *= GC.getHandicapInfo(getHandicapType()).getResearchPercent();
	}

	iCost /= 100;

	iCost *= GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getEraInfo(GC.getGameINLINE().getStartEra()).getResearchPercent();
	iCost /= 100;

	iCost *= std::max(0, ((GC.getDefineINT("TECH_COST_EXTRA_TEAM_MEMBER_MODIFIER") * (getNumMembers() - 1)) + 100));
	iCost /= 100;

	return std::max(1, iCost*iFinalMultiplier);
}

what happens when using FlexibleAI? I've always thought that if AI handicap level increases (say from Prince to Monarch), then AI uses XML values from Prince and among them iAIResearchPercent, which goes from 80 to 75 in the given case. Which is odd because it makes research easier for AI when going up on handicap level. Or maybe I don't understand whose handicap we're are talking about. Afforess or Arkatakor what do you think about it?
 
Yeah, the code you posted there, I don't agree with Arkatakor's change. What the change does is make AI tech cost depend on the average human difficulty level. That is not really what we want, we want it to depend on AI difficulty level. Try this:

Code:
int CvTeam::getResearchCost(TechTypes eTech) const
{
	int iCost;
	int iFinalMultiplier = 1;

	FAssertMsg(eTech != NO_TECH, "Tech is not assigned a valid value");

	iCost = GC.getTechInfo(eTech).getResearchCost();

	if ( iCost > MAX_INT/10000 )
	{
		iCost /= 10000;
		iFinalMultiplier = 10000;
	}

	[COLOR="Red"]if (!isHuman())
	{
		iCost *= GC.getHandicapInfo(getHandicapType()).getAIResearchPercent();
	}
	else
	{
		iCost *= GC.getHandicapInfo(getHandicapType()).getResearchPercent();
	}[/COLOR]

	iCost /= 100;

	iCost *= GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getEraInfo(GC.getGameINLINE().getStartEra()).getResearchPercent();
	iCost /= 100;

	iCost *= std::max(0, ((GC.getDefineINT("TECH_COST_EXTRA_TEAM_MEMBER_MODIFIER") * (getNumMembers() - 1)) + 100));
	iCost /= 100;

	return std::max(1, iCost*iFinalMultiplier);
}
 
Yeah, the code you posted there, I don't agree with Arkatakor's change. What the change does is make AI tech cost depend on the average human difficulty level. That is not really what we want, we want it to depend on AI difficulty level. Try this:

Code:
int CvTeam::getResearchCost(TechTypes eTech) const
{
	int iCost;
	int iFinalMultiplier = 1;

	FAssertMsg(eTech != NO_TECH, "Tech is not assigned a valid value");

	iCost = GC.getTechInfo(eTech).getResearchCost();

	if ( iCost > MAX_INT/10000 )
	{
		iCost /= 10000;
		iFinalMultiplier = 10000;
	}

	[COLOR="Red"]if (!isHuman())
	{
		iCost *= GC.getHandicapInfo(getHandicapType()).getAIResearchPercent();
	}
	else
	{
		iCost *= GC.getHandicapInfo(getHandicapType()).getResearchPercent();
	}[/COLOR]

	iCost /= 100;

	iCost *= GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getEraInfo(GC.getGameINLINE().getStartEra()).getResearchPercent();
	iCost /= 100;

	iCost *= std::max(0, ((GC.getDefineINT("TECH_COST_EXTRA_TEAM_MEMBER_MODIFIER") * (getNumMembers() - 1)) + 100));
	iCost /= 100;

	return std::max(1, iCost*iFinalMultiplier);
}

Ok, that solves the problem of average human difficulty level, I can try that. But I still don't get how it works. To me, it looks like it's working in the opposite direction as intended. AIResearchPercent is decreasing as handicap level gets harder (80 for Prince, 75 for Monarch and so on). So when AI should get a harder level, result is that it techs faster.

And anyway there's a similar code in CvPlayerai.cpp

Code:
											//				//	[COLOR="Red"]Arkatakor - The handicap type will be based on the average handicap of all human players
			iTechPathLen *= GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIResearchPercent();
			iTechPathLen /= 100;[/COLOR]
											
			iTechPathLen *= GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getResearchPercent();
			iTechPathLen /= 100;

			iTechPathLen *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getResearchPercent();
			iTechPathLen /= 100;

it's inside void CvPlayerAI::AI_doCivics(). So I suppose I should change

Code:
iTechPathLen *= GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIResearchPercent();

to

Code:
iTechPathLen *= GC.getHandicapInfo(getHandicapType()).getAIResearchPercent()

and probably reverse the xml value scale in handicapinfo.xml
 
Hmm. Good point. Looking at the BTS code, it just uses this:

Code:
int CvTeam::getResearchCost(TechTypes eTech) const
{
	int iCost;

	FAssertMsg(eTech != NO_TECH, "Tech is not assigned a valid value");

	iCost = GC.getTechInfo(eTech).getResearchCost();

	iCost *= GC.getHandicapInfo(getHandicapType()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getEraInfo(GC.getGameINLINE().getStartEra()).getResearchPercent();
	iCost /= 100;

	iCost *= std::max(0, ((GC.getDefineINT("TECH_COST_EXTRA_TEAM_MEMBER_MODIFIER") * (getNumMembers() - 1)) + 100));
	iCost /= 100;

	return std::max(1, iCost);
}

We should probably be using the standard BTS code here.
 
Hmm. Good point. Looking at the BTS code, it just uses this:

Code:
int CvTeam::getResearchCost(TechTypes eTech) const
{
	int iCost;

	FAssertMsg(eTech != NO_TECH, "Tech is not assigned a valid value");

	iCost = GC.getTechInfo(eTech).getResearchCost();

	iCost *= GC.getHandicapInfo(getHandicapType()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getResearchPercent();
	iCost /= 100;

	iCost *= GC.getEraInfo(GC.getGameINLINE().getStartEra()).getResearchPercent();
	iCost /= 100;

	iCost *= std::max(0, ((GC.getDefineINT("TECH_COST_EXTRA_TEAM_MEMBER_MODIFIER") * (getNumMembers() - 1)) + 100));
	iCost /= 100;

	return std::max(1, iCost);
}

We should probably be using the standard BTS code here.

I know that's the original BTS code, I think we've added that part of the code with Arkatakor short after I took over the project from you more than 2 years ago. IIRC we decided to do it to better tweak AI research depending on handicap level. I'll do some more test to see if I can make it work reversing xml scale or if it's better to get rid of that part of the code completely and revert back to the original code (I'll also remove iAIResearchPercent from xml, it was introduced specifically for this part of the code, it's not part of original BTS).
 
I've downloaded this weekend your last update, GREAT JOB GUYS.

Anyways, i don't have surround and destroy active and I don't know where to find it to activate. Can someone help?
 
I think it's one of the options that was permanently disabled because it's unbalancing and the AI don't know how to use it.
 
I've downloaded this weekend your last update, GREAT JOB GUYS.

Anyways, i don't have surround and destroy active and I don't know where to find it to activate. Can someone help?
Yep, it's been removed because AI has no clue on how to use it.
 
SVN 828

@ Afforess - I got that same error message again, this time it was 6 times when I was cycling around my 70 City empire.

It seemed to partiallydisable the keyboard input, and then crashed to desktop.

*Edit* I have a theory, as I have enabled Dynamic Great wall, each time I cycle through a city with the great wall animation in its city limits, it say's it can't produce the animation and causes the python error.

As it only happens in certain cities and not every one, and only those on border, which I'll test, it would be reasonable to assume such.

Or I could just look up the error code *Meh*
 
Is Archer Bombard broken for Archery units for anyone else right now? I was just trying out a new game and in my game, Archers couldn't range bombard but Catapults and Modern Grenadiers could (did a quick check with WB). It is revision 829 with a fresh update SVN/export version files/copy to mod folder.
 
@Vokarya - I've been told that its working as designed, its meant to do that??? Archery is the only one's that can't bombard.

On my constant crashes, I think I had a corrupted save, I think I tried to start a game when it was only 1/2 way through coping the latest SVN to the mods folder. The game loaded, so I didn't worry about it, but it seems it caused the crashing.

I reloaded from a pre-"Messed up loading save", and its played for 1 hr with no crashes, where before it would crash within 5 turns.

Sorry about that, my bad. :( :rolleyes:
 
When I use Ballista with Archery Bombard on, it does 0% damage, even if the stack is all healthy.

I'm getting bombardment damage with a Ballista. There's a separate bug in the reporting system that says it's dealing 0% damage when it's dealing more than that. It seems to me that if a unit range bombards an undamaged unit, it shows no damage but the unit is taking damage:
View attachment 383473
I've scored three hits on the stack with Ballistas and they've each knocked a Bengal Tiger from 2 strength down to 1.3.
When bombarding a damaged unit, then a % is shown.
View attachment 383474

I think the bug is that the reporting system is showing the damage the unit already had instead of showing how much was dealt by the bombarding attack.
 
Hinduism doesn't seem to be founding properly right now either. A dozen civilizations in the attached save have Literature but Hinduism hasn't founded anywhere.
 
Hi people. Dowloaded AND2 from SVN a couple of days ago...the number of changes is astonishing.

Anyway i started a game GEM with preset civs marathon speed. I settle and the food bar is at 0/62 with +4 food/turn. So i end turn and the food bar now is at 4/93 . Apparenlty the food bar has increased by 50%.

Is this a WAD or a bug. I understand that the food bar is effected by the game speed and by the tribalism civic (which indeed gives +50%)but still it shouldn't change like that mid game.

Also when chaning production: Say you are building A and before completion you enter city change to B. The production bar will still show the progress of A. I had to zoom out of the city and then double click it again to see the new production bar.

Also when i enter the world map and wento to the reaveal tile tab the black mesh (fow) was missing from greenland to the half of the pacific
Any thoughts?!
 
Archery Bombard working fine for me. I just have to build or capture a stack of early ballista and catapults. It works like archery/siege bombard of old and reflects era weapon capabilities more realistically. I have not evaluated longbow men if they can archery bombard (Battle of Agincourt), but by that era, I am using other deadlier units.
 
Back
Top Bottom