Version 1.01 discussion thread

jdog5000

Revolutionary
Joined
Nov 25, 2003
Messages
2,601
Location
California
(You can always get the latest stable release from the download thread or sourceforge. Development versions and updated source code can also be checked out from sourceforge.)

This version fixes a few bugs and makes some important tweaks/additions to the big changes introduced in 1.00. War decisions also got some new features, the AI is now capable of starting wars much earlier in the game to choke opponents and will now target cities for conquest which have resources it desperately needs. And of course the latest Unofficial Patch is included.

The full change list is as follows:

New in Better BTS AI 1.01
Spoiler :

Merged in UP 1.6

Bugfixes
- AI now considers monuments a cultural building when evaluating techs (thanks denev)
- Fixed detection of when to have AIs go for wonders for cultural reasons in late game (thanks Fuyu)
- Fixed bug introduced with Lead from Behind which allowed siege units to attack cities/stacks with non-combat units after all defenders were knocked below the siege combat limit
- Fixed diplomatic side effects of new early game changes to AI_isLandTarget (thanks Fuyu)
- Fixed issue causing crashes with debug DLLs under rare circumstances (I think ...)

Victory strategy
- Tweaked Conquest 3 and 4 so that they work better for isolated starts and continents maps
- Boosted value of Apollo granting tech for civs running Space 2
- AIs going for diplo victory now more highly value techs allowing construction of diplo wonder
- AIs going for diplo victory now more highly value building wonders which allow diplo votes
- Vassals now a little more likely to try space strategy

War strategy
- Changes to encourage aggressive AI players to consider limited wars in early game to choke opponents, should make first couple eras a little less predictable in normal games
- If AI wants to declare war for a long time but doesn't and has no units moving to start war, it will eventually re-plan its wars (mainly handles case where AI can't move its units into position)
- If AI is preparing a dogpile attack and the enemies of its target break off war, then it will replan
- Improved AI detection of when its wars were cold and it might as well break them off
- When AI has many more units in enemy territory or en route than its enemies have in its territory, it is now less inclined make peace. Conversely, you can now move a big attack force into AI territory and sue for peace. Replaced prior flawed city danger based method and expanded to include non-Aggressive AI games.
- AI decisions to raze cities now factor in cultural victory, resources, how good a holy city is, and how likely the conquerer is to hold the city

War tactics
- Fixed issue where AI would pull back its troops to its own borders to regroup instead of regrouping in enemy territory
- AI now puts extra emphasis on state religion holy cities of enemies in picking target cities (thanks Lunar Mongoose)
- More changes to AI target city values to put higher value on wonders, holy cities, and needed resources

City AI
- AIs in isolated starts now will build fewer units until they meet somebody
- Turned down AI production of transports and attack ships when approaching unit spending caps

Tech AI
- Big boost to value placed on ocean-capable transports when AI has naval assault war plans

General AI
- Changed AI_enemyTargetMissionAIs to AI_enemyTargetMissions, now counts how many units are in enemy territory or making war like moves into potential enemy territory
 
Great to see you further improving BetterAI to fix some issues which were bound to arise after the previous huge changes in 1.0.

Question:

If you play under the following settings:
Immortal AI, aggressive AI, Conquest victory condition only, no vassals starting condition, no city razing, epic speed, huge world, 11 AI's, big and small map type (somewhat continents like but with more random land mass size).

Would you expect several AI's to go into Conquest 3 or 4 mode? (especially since other victory conditions aren't enabled). How many?
Does the 'no vassals' hurt the AI aggressiveness a lot or can AI's now really conquer a large territory and thus become powerful on their own?

What if you also enable diplomatic victory? Might some large AI go for diplomatic victory (with its large amount of votes) and conquest victory?
 
Awesome tweaks!!

I cant wait to dive into a new game! (Been playing colonization :p- nearly finished my current game)
 
Some game developer should hire you, jdog. I would definitely buy the game if you helped build the AI. People like you make single player games fun.
 
Some game developer should hire you, jdog. I would definitely buy the game if you helped build the AI. People like you make single player games fun.

He's not going anywhere without me... Right JDog? *looks around nervously*
 
jdog5000, first of all, thank you for this amazing AI. You deserve the highest praise!

Secondly, I have questions to you:

- There is a custom victory condition, Mastery Victory by Sevo. Assuming you know it (if you don't know about it, I'll be happy to provide details to make my case more understandable), how do you see the impact of your new AI on this victory type? As it basically means that all victory conditions are on by default, it means that AI will choose among those I presume, but what happens if the AI (or the player as the AI sees it) actually achieves a victory condition, but the game does not end?

- If I implemented a limit to the number of units a plot can hold (I believe there is/was a mod like this somewhere), how much would this disrupt the AI strategies? Would it hurt it big time, or would it still perform reasonably well?

Thanks in advance!
 
- If I implemented a limit to the number of units a plot can hold (I believe there is/was a mod like this somewhere), how much would this disrupt the AI strategies? Would it hurt it big time, or would it still perform reasonably well?

hi avain,

i have a mod of exatly that -its an old relic by the j - its avaible somewhere on the site - it gives many options to almost every xml file - promotions, terrain, features, civs, units, whatever you can think of,
i was wondering too how the ai would act if i try ti make like civ5,
interesting huh?

hdog5000,
thank you as always.

is this 101f version?
 
hi avain,

i have a mod of exatly that -its an old relic by the j - its avaible somewhere on the site - it gives many options to almost every xml file - promotions, terrain, features, civs, units, whatever you can think of,
i was wondering too how the ai would act if i try ti make like civ5,
interesting huh?

Thanks.
I don't want to limit it to 1, because it's a guaranteed failure I'd wager. I'm thinking on 4-5-6, and then gradually increasing it with techs to like 8-9.
 
Due to implemention of Lead from Behind, siege units will defend first instead of other units since siege units have lower strength/combat winning chances.

It's too easy to kill siege units out of KI stacks now since they will die first. Could you add an exception that siege units will defend at last? They have high value imo.
 
Lower chances to win should definitely not make them move up in defender ranks. If they defend then that should happen because they are the best defenders available. If that is not so, what exactly do you think is happening? I could not find any code that would cause LFB to prefer siege over anything else.
 
It was a welcome change to see the Vikings raze a city that they could take but not hold. I did notice that the AI still moved its entire stack onto the space containing the city ruins. Does the AI have the ability to move only one (low value) unit to raze the city, while keeping the rest of its stack on safer ground?
 
Lower chances to win should definitely not make them move up in defender ranks. If they defend then that should happen because they are the best defenders available. If that is not so, what exactly do you think is happening? I could not find any code that would cause LFB to prefer siege over anything else.

It seems that one unit will not defend and let the siege units die first. I don't know why. It's a strength 12 unit with a new unit combat type.

Does the unit combat type matter for lead from behind calculation?

3 new units + 3 catapult -> attack with 3 modern armor -> 3 catapults killed

3 grenadiers + 3 catapults -> attack with 3 modern armor -> 3 grenadiers killed


The new units have a national limit. I guess this is increasing their value since anyone wanted to have lead from behind working with "heroes" right? Could this be the problem?

How to remove this behavior jdog?



Screenshots for better understanding:







 
The fanatics will defend first if I remove the national limit. I have just tried it out. But I cannot find any code that makes them not defending first if they are national limited (MaxPlayerInstances). Help please. :)
 
Wierd ... maybe ( take this with a pint or tw o of salt, as every hunch without code basing is ) you are running code that skips everyone else from the best defender routine if there are nat limited units there? It might be simply a function order issue ...
 
I did not alter this. Should be a Lead from Behind or BBAI issue. I don't even know where to look at.

What about this?

PHP:
	<Define>
		<DefineName>LFB_BASEDONLIMITED</DefineName>
		<iDefineIntVal>5</iDefineIntVal>
	</Define>

But I cannot find LFB_BASEDONLIMITED in more sdk files than CvGlobals.cpp. Weird.


Edit2: But I have found another BASEDONLIMITED:

PHP:
	// Check if unit is limited in how many can exist
	if (GC.getLFBBasedOnLimited() > 0)
		if (isLimitedUnitClass(getUnitClassType()))
			iValueRating += GC.getLFBBasedOnLimited();

This must be the reason - and/or the define above.


Edit3:

PHP:
	<Define>
		<DefineName>LFB_BASEDONLIMITED</DefineName>
		<iDefineIntVal>0</iDefineIntVal>
	</Define>

works like a charm. :)
 
Haven't read all but LFB checks for limited units and changes a value that is needed for calculation. It seems as if important units are protected if their chances to win are low.
PHP:
// Method to evaluate the value of a unit relative to another
int CvUnit::LFBgetRelativeValueRating() const
{
	int iValueRating = 0;

	// Check if led by a Great General
	if (GC.getLFBBasedOnGeneral() > 0)
		if (NO_UNIT != getLeaderUnitType())
			iValueRating += GC.getLFBBasedOnGeneral();

	// Assign experience value in tiers
	if (GC.getLFBBasedOnExperience() > 0)
	{
		int iTier = 10;
		while (getExperience() >= iTier)
		{
			iValueRating += GC.getLFBBasedOnExperience();
			iTier *= 2;
		}
	}

	// Check if unit is limited in how many can exist
	if (GC.getLFBBasedOnLimited() > 0)
		if (isLimitedUnitClass(getUnitClassType()))
			iValueRating += GC.getLFBBasedOnLimited();

	// Check if unit has ability to heal
	if (GC.getLFBBasedOnHealer() > 0)
		if (getSameTileHeal() > 0)
			iValueRating += GC.getLFBBasedOnHealer();

	return iValueRating;
}

and

// Take the unadjusted odds and adjust them based on unit value
int CvUnit::LFBgetValueAdjustedOdds(int iOdds) const
{
	// Adjust odds based on value
	int iValue = LFBgetRelativeValueRating();
	long iAdjustment = -250;
	if (GC.getLFBUseSlidingScale())
		iAdjustment = (iOdds - 990);
	// Value Adjustment = (odds-990)*(value*num/denom)^2
	long iValueAdj = (long)(iValue * GC.getLFBAdjustNumerator());
	iValueAdj *= iValueAdj;
	iValueAdj *= iAdjustment;
	iValueAdj /= (long)(GC.getLFBAdjustDenominator() * GC.getLFBAdjustDenominator());
	int iRank = iOdds + iValueAdj + 10000;
	// Note that the +10000 is just to try keeping it > 0 - doesn't really matter, other than that -1
	// would be interpreted later as not computed yet, which would cause us to compute it again each time

	return iRank;
}


So the behaviour is intentional! If you don't want limited units to be protected disable this part:

PHP:
    // Check if unit is limited in how many can exist
    if (GC.getLFBBasedOnLimited() > 0)
        if (isLimitedUnitClass(getUnitClassType()))
            iValueRating += GC.getLFBBasedOnLimited();
 
Ya but I'm glad that you can easily disable the limited behavior in LeadFromBehind_GlobalDefines.xml.

PHP:
    <Define>
        <DefineName>LFB_BASEDONLIMITED</DefineName>
        <iDefineIntVal>0</iDefineIntVal>
    </Define>
 
I appear to be getting the following compiler errors:

Spoiler :

CvGameCoreDLL error LNK2019: unresolved external symbol "void __cdecl logBBAI(char *,...)" (?logBBAI@@YAXPADZZ) referenced in function "public: virtual void __thiscall CvPlayerAI::AI_conquerCity(class CvCity *)" (?AI_conquerCity@CvPlayerAI@@UAEXPAVCvCity@@@Z)


Spoiler :

CvGameCoreDLL fatal error LNK1120: 1 unresolved externals


Any ideas?
 
Top Bottom