Version 0.82 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.)


There's actually quite a bit of new stuff in this release and some have big implications:

- War strategy: The AI will now sometimes start plans for a second (or more) war if it's got a huge advantage in its current conflict. This will have a significant effect, reducing the predictability of war cycles for warmonger AIs. In addition, the AI will now break out of wars of distraction ... if nothing happens in a war and the AI isn't planning anything, it will make peace so it can get on to something useful.

- Spy AI: This has been majorly retooled. You will notice. The AI will now steal your treasury and more intelligently use poison and unhappiness. Also, the AI is now able to use espionage on offense in war to remove city defenses in front of its incoming stacks. It's pretty awesome when it happens.

- AI customization: As requested, a few "magic numbers" in the SDK have been exposed to XML. Right now it's a few ratios to control how the AI decides to attack/bombard cities. Request more if you have something in particular in mind, and let me know what values you try and what effect it has.

- AI logging: This is mainly for modders and myself, but BBAI can now log AI actions for post-analysis. It requires adding the compiler option LOG_AI at compile time.

Enjoy!

New in Better BTS AI 0.82
Spoiler :

Merged in UP 1.3
Added files BetterBTSAI.h and BetterBTSAI.cpp
Small change (in many places) to code comment format to prepare for Doxygen documentation
Reorganized GlobalDefinesAlt.xml

Bugfix
- Fixed bug in AI valuation of techs which enable their favorite religion

City AI
- AI now will not build workers in pop 1 capital at start of game
- Higher production/population cities will fill more of worker need
- Inland cities will now produce settlers to support colonization of other continents/islands
- AI now considers value of mine/lumbermill + railroad when picking tile improvements whether railroad is in place or not

Diplomacy AI
- AI less likely to vote for/propose votes for peace if it's in an early/evenly matched war
- AI vote for/proposing votes for city exchange now based on teams, not players
- Added AI logic so that it will more correctly consider whether to accept human players as vassals in mods that allow that

War Strategy AI
- AI will now consider starting additional wars if it has huge power advantage over current target
- AI will now end wars which have been going on for a while but there has been no fighting and it has no plans
- AI now considers current would-be-enemy power when switching WARPLAN from PREPARING_TOTAL to TOTAL
- When outgunned in an area, AI more readily adopts defensive strategy
- Fixed issue where AI would not declare war on capital area enemy because it didn't have large enough attack force in shared colony areas

War Tactics AI
- Exposed several magic numbers for when the AI decides to attack/bombard cities in GlobalDefinesAlt.xml
- Fixed issue where attack city stacks would sometimes waste time by moving together to a staging city before merging

Espionage AI
- Unified decisions on what missions AI spies will run based on attitude and warplans
- On Aggressive AI, AI spies will now go after rivals civ is pleased towards
- Spies now move before other units (so revolt city can have an effect)
- Spies positioned in enemy cities will now cause revolts to lower defenses when attackers are in position
- Greatly reduced AI spies pillaging random improvements
- AI spies will now go after bonus tiles, very rarely target non-bonus improvements
- Spies now will move to and wait in cities which AI is targetting for conquest
- Added consideration to have spies pick different target cities/plots
- AI now will more likely steal enemy treasury if itself or enemy is in financial trouble
- AI will now consider using unhappiness mission in cities close to happy cap, not only those already over it
- Spies will now steal techs more often when AI is behind in tech, including stealing techs from friends when necessary
- Fixed issue blocking AI from using the steal treasury spy mission
- Poison city mission now valued based on producing food shortages, not just producing unhealthiness

Missionary AI
- AI will now build missionaries to push holy city religions when in free religion
- AI now gives higher weight to building non-state religion missionaries for any holy city religions is has, especially with a shrine
- Improved AI decisions on when to build missionaries

Tech AI
- Added new function AI_techValue, moved existing tech valuation code there

General AI
- AI now values gifted units much more highly, in line with other gifts
- Gifted obsolete or non-combat units are not valued as highly as current combat units

AI Logging
- Added logging system for easily tracking AI decision making (requires Release or Debug build)

CIV4GameInfoSchema
- New era tech cost modifier field no longer required, will be set to 0 for all era for mods that don't specify them instead of failing to load XML
 
Great update! Espionage fixes sound promising.

One question though:

"AI now will not build workers in pop 1 capital at start of game"

What's the deal with this one? Everywhere in the forums people say that worker first is the right choice about 90% of the time. Is this not the case with AI?
 
Wow, looks great. Have these changes been added to the RevDCM svn yet?
 
Great update! Espionage fixes sound promising.

One question though:

"AI now will not build workers in pop 1 capital at start of game"

What's the deal with this one? Everywhere in the forums people say that worker first is the right choice about 90% of the time. Is this not the case with AI?

Worker first? Really? I always go worker as soon as I hit Pop 2. Work boat is a different matter though, as the city keeps growing. What difficulty level are you talking?

Several things are different for the AI which mean that human strategies don't always work as well. On Immortal and Deity, the AI starts with at least one worker so it's kind of a moot point. The AI also doesn't have the same lower happiness/health caps that the player does on Monarch+, so growing its capital early is more useful.

This change was made from watching AI starts on Prince and Monarch ... often times when the AI went worker first it then had a worker sitting around doing nothing for several turns. The AI doesn't integrate city training choices and tech research like humans do, so it would often go after a religion or hunting while its worker waited until the AI decided to get Ag or Mining. Or, it will get Mining but then require Bronze Working to clear trees off of hills, so its worker remains idle.

It's certainly easy to change back if we get to the point where it makes sense for the AI.
 
I also occasionally build a worker as my first build. IF you have an improvement enabling tech, it seems like a smart choice to me.

What does the AI build instead now as their first build? On higher difficulty levels they start with lots of military units, so unlike a human player they never feel the need to build more of those on turn 1. My fear is the AI would now go for settlers instead. That's even worse than a worker for long term growth.

At least that's what the AI always did in Planetfall before I put a stop to it: start building a colony pod on the first turn, thus keeping their capital at size 1 for a very long time.
 
Yeah, the thing about growing to size 2 before starting a worker is that it usually only adds 1 :hammers: worth of production, and so doesn't get you the first worker any faster than if you just start with it. My impression is that leaving aside instances where you want to go workboat first, you should go worker first if when it shows up it you have the techs to put up some tile improvements on bonus tiles. If everything in your BFC requires animal husbandry but you need to go two techs before you get AH, sure, toss out a warrior or scout first.

But yeah, judging from the high end posters in the strat and tips forum, my impression is that worker first is usually a good move because the sooner you get your bonuses developed, the faster your growth will be overall and you'll more than make up the time spent not growing right at the start.
 
But yeah, judging from the high end posters in the strat and tips forum, my impression is that worker first is usually a good move because the sooner you get your bonuses developed, the faster your growth will be overall and you'll more than make up the time spent not growing right at the start.

I guess, if you are playing BTS.

A lot of us dislike BTS, and play mods. RoM, for instances, has a bunch of techs that enable roads, farms, etc, and you'll just waste your hammers and food churning out a worker. It's usually 50-70 turns before you can even make farms or cottages.
 
I guess, if you are playing BTS.

Well, good thing this mod isn't called BTS Better AI or anything. ;)

Seriously, though, it makes sense for the AI to check and see the viability of worker first rather than having a hard and fast rule about it... but given that BBAI probably should neither rule out nor mandate worker first.
 
- AI now values gifted units much more highly, in line with other gifts

What does this mean? Do you mean you can get diplo bonuses for gifting units? Are you changing some that was intentionally left weak? I got the impression from other players that gifting units for diplo bonuses could become an exploit issue. Gift your AI friends obsolete units so they can upgrade on the cheap and get a diplo bonus. Maybe gift a soon-to-be-enemy a bunch of units that you have a strong counter for (give them millions of spears when you have maces ready to go), and they'll build fewer defenders thinking they have a good number of defenders already.

I'm not sure if the above issue is serious but I'm curious about whether all these sorts of considerations have been taken into account? Or am I misinterpreting what the change means?
 
Do you mean you can get diplo bonuses for gifting units?

You can get diplo bonuses "our trade relations have been fair and forthright" and penalties "you have traded with our worst enemies", subject to the usual caps. It came up when we talked about the strategy of gifting tactical nukes to warring parties.

Gift your AI friends obsolete units so they can upgrade on the cheap and get a diplo bonus.

The diplo bonus has been increased by a factor of around 5-10 for this situation, depending on how obsolete the units are.
 
I'm really looking forward to the new Espionage AI.

- AI now considers value of mine/lumbermill + railroad when picking tile improvements whether railroad is in place or not

In this situation, will the AI build the railroad first, and then convert the windmill to a mine? If it upgrades the other way round, then it will have a couple of turns of lower yields (unless mine beats windmill without the railroad).

- AI vote for/proposing votes for city exchange now based on teams, not players

What do you do if the city is being exchanged within a team, such as from master to vassal, or vica versa? In these situations I would expect civs to vote based on their attitude to players.

- AI will now end wars which have been going on for a while but there has been no fighting and it has no plans

If the AI has a huge war weariness advantage, it might want to keep the war going to cripple its opponent. At minimum, it should extract some gold for peace.
 
You can get diplo bonuses "our trade relations have been fair and forthright" and penalties "you have traded with our worst enemies", subject to the usual caps. It came up when we talked about the strategy of gifting tactical nukes to warring parties.



The diplo bonus has been increased by a factor of around 5-10 for this situation, depending on how obsolete the units are.

Do you know where can I read the code?

EDIT... lol grammar my like?
 
Do you know where can I read the code?

cvUnit::gift()
Code:
//GET_PLAYER(pGiftUnit->getOwnerINLINE()).AI_changePeacetimeGrantValue(eOwner, (pGiftUnit->getUnitInfo().getProductionCost() / 5));
	if( pGiftUnit->isCombat() )
	{
		GET_PLAYER(pGiftUnit->getOwnerINLINE()).AI_changePeacetimeGrantValue(eOwner, (pGiftUnit->getUnitInfo().getProductionCost() * 3 * GC.getGameINLINE().AI_combatValue(pGiftUnit->getUnitType()))/100);
	}
	else
	{
		GET_PLAYER(pGiftUnit->getOwnerINLINE()).AI_changePeacetimeGrantValue(eOwner, (pGiftUnit->getUnitInfo().getProductionCost()));
	}

You can compare the values with those calculated by CvPlayerAI::AI_dealVal(), as used in CvDeal::addTrades().
 
You can get diplo bonuses "our trade relations have been fair and forthright" and penalties "you have traded with our worst enemies", subject to the usual caps. It came up when we talked about the strategy of gifting tactical nukes to warring parties.


I never knew the AI actually took gifting units into account. Perhaps there should be a separate diplo modifier "You gifted units to us!" and "You gifted units to our worst enemy!" I know BBAI doesn't want to change gameplay, but it seems like a much better way to communicate that to players.

Also, I know the AI gifts units to colonies, but perhaps it can gift surplus units to friends involved in a war which it is not involved in itself?

Also, I know Dom Pedro has done a lot of work with AI diplo options like calling in allies and other things that were reserved for human-only interaction. Perhaps this can be merged into BBAI, maybe as an option? It seems like games would be much more realistic and dynamic if the AI were capable of this, not to mention I don't like to see the AI treat a human player differently than another AI.


But anyway, you outdo yourself with every update, Jdog! Coordinating spies with attack stacks is certainly a huge improvement, and allowing powerful civs to start multiple wars is awesome.
 
Also, I know the AI gifts units to colonies, but perhaps it can gift surplus units to friends involved in a war which it is not involved in itself?

That's a good idea ... the AI can sometimes have more units after a war than it wants, so finding a useful way to unload them if it's not going into another war would be good.

Also, I know Dom Pedro has done a lot of work with AI diplo options like calling in allies and other things that were reserved for human-only interaction. Perhaps this can be merged into BBAI, maybe as an option? It seems like games would be much more realistic and dynamic if the AI were capable of this, not to mention I don't like to see the AI treat a human player differently than another AI.

Yes, I definitely intend to bring DPII's diplomacy changes and additions over and adapt them as need be.
 
This is not a discussion of 0.82 per se...but I didn't want to start a new thread for this.

I looked but couldn't find if this topic/question had been brought up before, so I will ask you JDog. The question/comment is this:

In games...when I receive a great general, I generally use my first one to become a "super medic" (and do not use it for an attack for risking losing it) giving it all the healing promotions and then move on to withdraw from combat options. This unit is so important in conducting blitzkrieg type wars in that, along with spies leveling defenses, I can attack and take a city, and then move on with minimal "heal time" to the next city. When my units are healing in 2-3 IN enemy land instead of 6+ turns, it makes warring much more efficient and constructive. From what I've seen, the AI NEVER does this. And, honestly, I'm not sure the AI CAN do that. But...that is why you are here and hence my question. Is it possible to have the AI plan for this...or at least implement it when possible? This would help the AI not stall so easily on attacks once it has entered enemy territory. Is this in the capabilities of coding BBAI? Thanks for any response. If what I said doesn't make sense, let me know...
 
Back
Top Bottom