Version 0.45 Discussion Thread

jdog5000

Revolutionary
Joined
Nov 25, 2003
Messages
2,601
Location
California
You can always get the latest stable release here at CFC or sourceforge. Development versions and updated source code can also be checked out from sourceforge. There will also sometimes be development versions on CFC, see the development thread for more info.

The focus of this update is naval invasions. City build decisions, transport behavior, and invasion troop behavior has all been updated and further coordinated. One new behavior is that the AI will sometimes use naval invasions to supplement ground wars and can now launch naval attacks on enemies on the same continent that it can't reach over land. The AI will now also pickup troops which get stranded on the map.

I've run a lot of tests and caught a lot of corner cases where the new behavior needed to be adapted. It's playing quite well, I've seen Classical era naval invasions wipe out civs early and civs approach Domination victory on Archipelago maps. That said, it is impossible to test all scenarios so please report your observations both good and bad!

Better BTS AI v0.45 Changelog
_________________________
Spoiler :

Bugfix
- Fixed bug in player closeness calculations causing the AI to be blind to its actual proximity to other players
- Fixed bug with needed defenders where the AI would choose to defend a recently captured holy city less than a normal city
- Fixed bug causing player ID to be used in place of actual attitude when checking for denials in bonus, civic, and religion trading
- Fixed bug in paradrop code causing AI to avoid paradropping onto terrain bonuses under certain circumstances
- Fixed bug in AI denial of switching civics when in Emancipation
- Fixed bug introduced in unofficial patch causing immunity to collateral damage
- Fixed bug with espionage mission to spread culture to an enemy city
- Fixed bug causing combat promotions to be counted twice for aircraft
- Fixed bug (introduced) in consideration of plot defense when selecting bases for offensive air units
- Fixed bug (introduced) causing crashes if there was an unowned fort on the map
- Fixed bug in unit AI type matching for retreating emptied transports
- Fixed bug in unit AI's determing if a transport had required space to hold them where they didn't consider other units intending to load
- Fix for naval blockades reaching across land, including across diagonal water tiles (fixed both actual range and graphically shown range)
- Fixed bug (introduced) caused by different fixes to the espionage mission to spread culture in this mod and the Unofficial Patch

War strategy AI
- Modified how closeness is used for determining who to attack, different settings for regular and Aggressive AI
- Created new function CvTeamAI::AI_calculateBonusWarValue so AI will consider declaring war for resources, weighted towards resources AI doesn't have and plots that are more easily captured
- Modified city attack targetting by terrain bonuses to consider how important bonus is to AI

City AI
- AI will now more likely fill empty transports when enagaged in transcontinental war, making reinforcements and second waves on invasions more likely
- When doing invasions, AI will now be more likely to have cities with free air experience fill vacancies on carriers
- When doing invasions, AI will now have cities with high production more often fill needs for aircraft carriers
- When doing invasions, if AI has at least 50% of its possible missile capacity it will no longer always build missiles
- Rewrote CvCityAI::AI_isAirDefended so that it considers unit damage, movement, AI type and can also count land units
- Normal workboat build blocked if there's an enemy sea unit camping outside city
- Coastal cities will now build boats as if planning a sea invasion if there is no route to enemy cities
- Improved handling of building troops to fill transports, unified between coastal and non-coastal cities
- Non-coastal cities now help fill carriers, missile carriers
- The AI was blocked from building attack troops if it felt it was unable to build good ones, now if it is at war it can build them but with low probability so it can fight back a little early in the game
- AI will now emergency build fighter planes if its air defenses are shot down but it still has lots of bombers and missiles
- If not critical, AI will let cities with high production or free air experience usually build most planes
- Cities with military production bonuses now a bit more likely to build military units
- AI will now always build some assault transports if it has significant overseas colonies to help defend them
- AI will now build reserve sea units to defend its settler transports in later eras
- Reduced construction of escorts that are weaker than the transports they would be escorting (Caravels escorting Galleons primarily)

Espionage AI
- When a spy has waited in a city but has no mission available, they are now more likely to move around and explore instead of sitting
- Revamped desired Espionage rate and priority weighting calculations, AI now always update weights, relations play a larger role
- Neutral priority weighting is now 10 instead of 0, differentiates between
- When AI starts preparing for war against another player they will heavily shift their espionage spending towards that player
- AI will attempt to gain passive mission levels against adversaries
- AI will now actually load spies onto the spy transport it builds

Gold AI
- AI now has a budget for troop upgrades each turn based on how much gold it wants to have, it won't spend more than this budget on non-critical units when at peace
- AI now prioritizes upgrading escort ships to same extent as transports

Naval AI
- Modified bombard behavior. Priority remains on supporting player's ground troops, if none then consider supporting other troops with common enemy and spreading out stacks to increase reach of blockade.
- Modified and expanded Solver's changes to retreat from city/fort AI to be more specialized for various unit AI types, only move if there's a real threat
- Increased city danger threshold so enemy ships do not runaway so easily
- Damaged ships will stay in city unless city is highly threatened
- Galleons assigned escort roles before Frigates are available will now change their UnitAI type to assault transport instead of getting stuck in their role after better escorts come along
- Transport ships waiting in port will now only unload their cargo during a land war if an enemy city can be reached by land, the player is on the defensive locally, or a stack of enemy units shows up. Increases naval invasions of distant enemies on Pangea maps, sea assaults to complement land assaults.
- Assault flotillas now leave behind empty transports
- Assault ships now assume cities whose defenses the player can't see are properly defended (previously counted as a single defender). Should make invasions more likely to occur near blockades, attack ships, prior invasions.
- AI will now try to break blockades if it has many attack ships in port
- Transports will now pickup units stranded on small islands
- Transports looking for cargo to pickup now use PUF_isAvailableGroupHeadUnitAIType instead of just counting unit ai types, should stop assault transports from waiting forever for units attached to a settler to load or waiting forever on small islands for units already in their cargo to load
- EscortAI units will now also shadow settler_sea units when there is nothing else to do
- Added a pathlength consideration to AI_pickup so that mostly loaded flotillas don't sail around the world to pickup one more unit (previously they would have waited trying to load the units they already had on board until someone else came around)
- SettlerSea transports now only run pickup if they're not full (another change necessary since transports no longer try to pickup the units they're already holding)
- Modified CvUnitAI::AI_shadow to optionally ignore units in cities, far away
- Reserve sea units will now shadow empty settler transports out at sea
- Attack sea units won't run around the world to shadow transports and carriers
- Slow escorts (Caravels mainly) will now protect large flotillas instead of doing nothing
- Escorts with nothing to do will now return to the primary area if it's not too far away so that primary area city production decisions take them into consideration

Air AI
- Modified and expanded Solver's changes to retreat from city/fort AI to be more specialized for various unit AI types, only move if there's a real threat
- Increased city danger threshold so enemy aircraft do not retreat so easily
- Attack planes in endangered cities will now more likely to airstrike attackers
- Improved code for defense planes in endangered cities so they stay to defend longer and either airstrike or patrol
- Improved efficiency of danger threshold check for ships and planes
- Improved code for moving planes to offensive or defensive bases to take city threat into account
- AI bombers will no longer consider basing in undefended forts even if the fort is unthreatened
- AI bombers will now consider moving to a city with two defenders (down from requiring 3), change made because of added threat logic and should allow AI to now use almost all of its cities as airbases
- Fixed bug introduced in Unofficial Patch 0.19 causing bombers to skip their turns whenever an interceptor was around
- Many improvements to better handle damaged planes in threatened cities
- Added two functions for defensive airstrikes to make both air defense and offense units more directly aid in defending cities from enemy stacks
- AI air defense units wake from airpatrol every turn, re-decide roles/need
- AI air defense units now consider how many other air defense units there are in the city and guarantee air defense
- Air defense units with Interceptor promotions now will be more likely to patrol when city is threatened
- Added new function for weighting bases for attack air units with new consideration for supporting offensive stacks and defending endangered cities, plus keeping planes safe from sneak attacks when at peace
- When at war forts are now more likely to be used as offensive bases, though cities are still preferred
- AI will again consider basing attack planes in teammate's territory (plot defense considerations effectively disabled this in many circumstances in earlier versions of mod)
- AI will now consider basing attack planes in vassal territory, though it will only use them if it owns no good base cities or forts itself
- Attack air units will now pull out of cities/forts if the defenders leave
- Airstrikes will no longer target enemies in adjacent territory when the territory is only adjacent to owned water tiles
- Fighters now always move before bombers, they're much better at taking on enemy fighters
- New function in CvPlot to count how many air units are running intercept missions already
- Added emphasis for both offensive and defensive units on the the players primary area

Unit AI
- AI will skip bombarding and go straight to attacking cities when it has good initial attack odds and a big strength advantage
- Stranded units with nothing to do will wait once someone is coming to get them instead of mindlessly patrolling
- Stranded settlers will now wait if someone is coming to get them instead of just scrapping after 20 turns
- Attack unit stacks will now break up when assigned to defend workers so that some of the units can do other things (protect other workers, get in transports)
- Units set to UNITAI_ATTACK will now get in transports instead of aimlessly patrolling when player is preparing invasion force
- If attack_city units cannot reach an enemy city while in land war, they will try airlifts and then load into boats
- Tweaked circumstances where attack units load into transports to encourage filling up boats
- Fixed discrepancy where attack units could group with settlers and then get in boats but were highly unlikely to get in boats with waiting settlers
- Speed up to AI_group so it loops over selection groups instead of units
- Attack units now do a bit better of defending cities in the new world if the AI hasn't sent/built enough city defense units yet
- Removed blanket block for loading transports when in land war, now handled by specific unit ai logic
- Tweaked loading of Counter units (Axemen, etc) onto boats to integrate with other changes
- Removed redundant logic from counter ai routine

Barbarian AI
- Barb ships will now often blockade cities for a few turns before moving on if they have no nearby targets
- Barb ships trapped by ice or around 1-tile islands are now removed so more can spawn
- Barb ship spawn rate throttled so they don't swamp the seas before players build navies
- Improved barb ship blockade decisions so they stick around for a while but will then should actually move to another area
- Barb ships less suicidal, more oppurtunistic
- Reduced range in which barb ships detect unprotected resources by 25%
- Barbarians now will build defenders in captured cities first, not buildings

General AI
- Modified city closeness calculations to use population from both cities, not just pop of the other city
- Created functions for determining when cities share the same water area (lake, ocean)
- Removed the unused partial implementation of a new A* solver for closeness
- A bonus which enables the civ's unique unit is now valued more
- Added function to calculate plot strength of teammates and (if desired) vassals
- AI will now be more likely to sacrifice green units when assaulting a well-defended city
- AI will now be reluctant to sacrifice units with medic promotions when assaulting a well-defended city
- Created function PUF_isAvailableGroupHeadUnitAIType for counting number of unit ai's on a plot which might actually load onto a transport (aren't in another group, aren't already cargo)

Combat Mechanics
- Modification for air v air combat to make veteran units more valuable, especially when wounded. Air v air combat is now more much more similar to land combat. This change can be disabled/enabled using BBAI_AIR_COMBAT in GlobalDefinesAlt.xml

Customization
- Added GlobalDefinesAlt.xml to mod files to allow some customization of what new features are running

Debug
- Added SDK and adapted python code from AIAutoPlay mod to faciliate testing
- Modified debug mode output to show relevant information for these developments
- Added string to lower right flag help text showing Better BTS AI version number currently running
- Added SDK and adapted python code from ChangePlayer mod to facilitate testing
- Added new Python module Tester for testing purposes

Better BTS AI also includes Dresden & Solver's unofficial 3.17 patch version 0.21.


Next steps include examining Vassal decision making with one goal being to make the AI sometimes pursue complete conquest. Also I will attempt to address the issue of the AI plowing under cottages unnecessarily.
 
Looks great. I'm going to start a new game soon, so I'll let you know how things go.
 
A thought on barbarian ships.

What if they spawned based off of "unguarded" land adjacent to water squares, instead of based off "unguarded" water squares?

That both makes sense, and would provide a throttle to the barbarian ship spawn rate.
 
A thought on barbarian ships.

What if they spawned based off of "unguarded" land adjacent to water squares, instead of based off "unguarded" water squares?

That both makes sense, and would provide a throttle to the barbarian ship spawn rate.

That would certainly help reduce the rate in those games where there are tonnes of little one tile islands scattered about near your mainland. On archipelago barb galleys are everywhere. I don't particulaly mind it though - your triremes reach 10xp really fast.
 
Yes, it would fix the issues seen in that thread ... if the AI has no overland path to any enemy cities in its area it operates as if running a naval assault, cities will build transports and attack units will load into them. With vanilla BTS, the AI will send a transport that happens to be full on the first turn of such a war but otherwise will almost certainly unload the troops who will then sit idle and not get back in the boats.

It does not fix the related settler problem you mention, I hadn't seen that one before. It shouldn't be too hard to fix, I'll look into it.
 
Naval invasion is much better ;)

Played through most of a game with Gandhi on continents at Noble level. I had minimum city garrison and had good relations with the two other civs on my island (same religion, defense packs). I had enough power to keep them from picking me off. I was trying to play game without invading/rushing.

We met the other Island pretty late into the game, which had 4 civs, with Hannibal being slightly dominant over it. I don't recall his score but it was 500-1000 more than mine and he was at the top by a good margin. I was in the middle of the pack and probably .5 his power. After a few turns 20-30 he DoW'd and I thought all was normal as the first boat landed and dropped off 3 or so cavalry. Well the next turn another 15-20 landed and it was over quickly. I think I had just gotten riflemen, so it was pretty hopeless.
 
Naval invasion is much better....first boat landed and dropped off 3 or so cavalry. Well the next turn another 15-20 landed and it was over quickly. I think I had just gotten riflemen, so it was pretty hopeless.
Sorry to hear you got done for toast, but wow nice stuff by the AI then.
Cheers.
 
Hello, I recently made a post in the Rise of Mankind forum regarding some proposed changes to diplomacy. Zappara (that mod's creator) suggested that I bring those suggestions over here as he indicated they would most likely require SDK changes.

Below is a copy of the post with the proposed diplomacy changes, my apologies if any of these have already been suggested by others.


1. Separate open borders for military / trading purposes
2. The ability to offer gold per turn for either open borders.
3. Ability to sell spare units to other nations
4. Ability to hire mercenaries from other nations
5. Ability to click "Refuse to talk" to a certain civ, thereby blocking contact requests
6. Ability to declare war on vassals at any point. Nothing sucks worse than your capitulated vassal thumbing their nose at you and not a damn thing you can do about it.
7. Add a horizontal scroll bar to the top of the Glance screen. Playing on huge maps with high numbers of civs, by the time you reach the new world or other continents and find civs there you cannot see their portrait at the top as it is so far to the right it's completely hidden and therefore you cannot click to sort their relationships with the rest of the world in ascending/descending order. I find this very frustrating when trying to figure out who fits where into the political situation on the new continent. The only alternative you really have is to ask them 53,509,875,802,475 "how do you feel about" questions and try to guesstimate an exact number.
8. Limit the amount of times an AI civ is allowed to ask you to go to war with them or cancel deals with so and so, i.e. one war request every X turns or one embargo request per Y turns. No negative modifier for the first refusal. After Z turns free of any requests, the counter is reset and the next proposal to be rejected would be treated as a "first" refusal.
9. Ability to ask a civ to cancel specific deals as opposed to ALL deals.
10. Tremendously expanded AP options. As I mentioned, a concept of Influence points would be excellent. For instance you gain x influence per turn for each city with the AP religion, you gain y influence per turn for each AP related religious building you own, you gain z influence for each religious wonder related to the AP, and so on and so on. Again, you get these every turn and they are cumulative. Correspondingly, the AP screen is now interactive and if you have the requisite number of points you can click the motion you would like to propose, with a limit of one motion per N turns.

Same concept for the UN also.

11. Some new AP motion options.
Excommunication - (Requires 3/4 majority) Vote to revoke ABC civ's status as a member of the religious bloc. That civ can still keep it's AP based religion, however it loses all "We care for our brothers and sisters of the faith" bonuses, can no longer build missionaries of that religion's type, and loses it's seat at the AP. If my "religious unhappiness" idea is incorporated, this motion succeeding would greatly increase the chances for religious revolution within the affected civ if they continue operating the AP religion. This would be helpful for times you need or would like to go to war with a certain nation but don't want to start a bloodfest within your bloc, this makes it easier.
Outlaw Civic - (Requires 2/3 majority) Vote to ban a certain civic from being adopted by full members ONLY. Of course, ultimately each civ is still free to run that civic if they want but at the cost of increased chance of religious schism and a negative diplomacy modifier with all the other member states. An example of how this would be helpful would be to ban civics containing a "No State " clause, thereby ensuring the AP members retain their faith and preventing you from losing that "brothers and sisters of the faith bonus"
Free Trade - (Requires standard majority) Vote to enact open borders (trade only) between all FULL members.
Enemy of the Faith - (Requires 2/3 majority) Vote to label a specific religion an "enemy" of the church. If successful, all FULL AP members gain a positive modifier with each other indicating their solidarity (and a corresponding negative with members of that religion), and in addition stop trying to build or spread anything to do with that faith.

12. Some kind of triangular diplomacy. Not so much in the Nixon-Kissinger sense of using two countries against one another to achieve your desired result, but rather I mean in a more literal sense, being able to bring more than one party to the table and being able to work out deals amongst multiple nations at once. IRL examples include the G8, the Yalta Conference, and many many many others.

13. Fractional tech trades. The ability to say I will not give you the entire technology, but here's 2000 toward your research. This would facilitate more diplomacy as often deals fall through because there simply is not enough room to compromise under the current mechanics.

Expanding on influence points from point 10, I envisioned "influence points" as being very similar to espionage points. You accumulate them per turn based on your domination of the religion (For AP based on cities with state religion, religious buildings, etc) and then can spend those points at the resolutions screen to propose motions of YOUR choice as opposed to random resolutions popping up every so often. For the United Nations, I can't really think of any "UN specific" buildings, so I was thinking that you should receive a certain quota of resolutions that you can propose per X turns based on your total votes in the chamber. Nations with a greater proportion of votes can propose motions more frequently than more minor nations, and so on. Also, it doesn't make any sense that only the resident of either can do the proposing. Nations other than the US (or the entire Security Council for that matter) propose motions to the UN all the time, clergy from outside Italy have historically been able to propose and institute changes throughout the years of Catholicism. I say any (FULL) member of the AP should be able to select motions to propose and you have to rely on your votes and your influence in the world to get the outcome you want and if you don't, then oh well that's just the breaks of being a part of a large deliberative body. Same for the UN, all members should be able to float proposals. The only proposal that should require you being the resident is trying to seek victory through the AP/UN. Perhaps as a counterbalance, the resident can have some sort of veto power, but vetoing a motion with overwhelming support creates negative diplomatic modifiers with the nations who wanted it?


Also, I realize some of my new AP motions talk about religious schisms and "religious unhappiness". This is from another proposal of mine to create a mod similar to revolutions but purely from a religious standpoint. The goal being to simulate the fracturing of religions, i.e. Roman Catholic vs. Eastern Orthodox, or Protestant vs. Catholic, or Sunni vs. Shi'ite, etc... You can read more about it at http://forums.civfanatics.com/showthread.php?t=302805 if you want.
 
@Complex
Some nice ideas that cross various domains, not necessarily Better BTS AI. There are two interface issues you address that could go to the BUG team:
1) Glance screen suggestions
2) Refuse to talk - this could simply be made an interface option where the player can refuse any contact with an AI regardless of the situation. The AI would continue to attempt to contact the player but would be automatically "snubbed" as if they had been manually snubbed through the diplomacy interface. This would allow the player to choose who they do not want to talk to based on a judgement about whether they care about the negative approval points that would accumulate against them over time from the AI being automatically snubbed. This is an interface change because in reality, you snub them anyway but just get irritated by the interface interruption in the process.

Cheers.
 
There is the asymmetry problem. Are PCs treated differently than NPCs with regards to "I want help with this war" and "I refuse to join you in war"?
 
Thanks for your great ideas for Better BTS this year Yakk. Have a good XMAS! What are "PCs" (people civs??). I want to better understand the asymmetry you talk of because I'm seriously thinking of implementing that "AI be gone" interface change which would only apply to the interaction between humans and perceived insignificant AI's you no longer want to be bothered by.
Cheers.
 
If it means anything, I'm also for the "Ignore AI" option...

By the way, I finally saw a full blown invasion fleet in my latest (AI Autoplayed) game. It was a thing of beauty.
 
Obviously I needed to clarify. I'm for an Ignore AI option, of course with the ability to select which one.
 
As you can see here, the AI is not attacking the enemy stacks with its defending air units. Justinian has no aircraft and no intercepting units yet. Can this be done better?

 
Thanks for your great ideas for Better BTS this year Yakk. Have a good XMAS! What are "PCs" (people civs??). I want to better understand the asymmetry you talk of because I'm seriously thinking of implementing that "AI be gone" interface change which would only apply to the interaction between humans and perceived insignificant AI's you no longer want to be bothered by.
Cheers.
Player Characters vs Non-Player Characters.

Or Player Civs and Non-Player Civs. :)

I believe there are still asymmetries in the AI code, where it treats another AI differently than a Player. There are some obvious ones (where it looks at the AI's personality code for compatibility, which Player's lack) - but what about the "please go to war" stuff?

Maybe they did get rid of all of them.
 
As you can see here, the AI is not attacking the enemy stacks with its defending air units. Justinian has no aircraft and no intercepting units yet. Can this be done better?

Maybe those early fighters(?) only have UNITAI_DEFENSE_AIR?
 
no. :) ... the AI is using them for attacks. But not always/not the defending ones as you can see on the screenshot.
 
Top Bottom