Version 0.40 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 can also be checked out from sourceforge.

The focus of this release is air combat, as you can see from the air section of the change log. There is one important change to the game mechanics for air combat in this release with the intention of making veteran units more important. See the air combat discussion threat for more info. It can be disabled by changing the BBAI_AIR_COMBAT setting in GlobalDefinesAlt.xml if you so desire.

Better BTS AI v0.40 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

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 or free sea experience 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

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

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

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

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

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

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


The focus going forward is:

- Examine city build decisions, especially to make unit production cities build more of a civs units.

- Get transports to pick up extra units after an invasion succeeds, move a small army to the new world on terra maps, more quickly reinforce existing invasions

- Look into AI for voting on AP/UN motions

- Continue exploring espionage AI
 
Going to give this version a try now.

Would be wonderful if worker AI could be looked at again (remove waste with continous rebuilding of improvements, stop cottages on hills, etc).
 
Would be wonderful if worker AI could be looked at again (remove waste with continous rebuilding of improvements, stop cottages on hills, etc).
I was thinking about this. Would it be possible to deny the AI from building over Villages and Towns (let them roll over hamlets and cottages though if they want) unless there is a resource there, or the city is starving? That alone would fix 90% of the problems with AI building. On top of that if you could make it so the AI cannot build over a farm/cottage in the same city where it is already building over the opposite improvement type (How many times have you seen the AI be in the middle of building a farm over a Town, while at the same time building a cottage over a farm for the same city?) you'd probably fix the other 10% of this issue. It just breaks my heart to see the poor AI do this, and it has to be devestating to it's economy.
 
I was thinking about this. Would it be possible to deny the AI from building over Villages and Towns (let them roll over hamlets and cottages though if they want) unless there is a resource there, or the city is starving? That alone would fix 90% of the problems with AI building. On top of that if you could make it so the AI cannot build over a farm/cottage in the same city where it is already building over the opposite improvement type (How many times have you seen the AI be in the middle of building a farm over a Town, while at the same time building a cottage over a farm for the same city?) you'd probably fix the other 10% of this issue. It just breaks my heart to see the poor AI do this, and it has to be devestating to it's economy.

If you manage to pull this off, that would be an awesome improvement! :) I think the first part is rather easily done, but the second part will be harder. Good luck, though! :D

Version 0.40 will be included in the next version of Merged Mod, by the way.
 
I'm sorry to say that I'm getting a CvGameCore.dll crash while using BUG Mod 3.5 merged with 0.40... All you have to do with the 1848 game that I've attached is hit return... I've been playing around with 1847 save to see if I can avoid it, but so far no luck... it is dumping hard on my install... I'm using Vista Home Premium if that matters...

Thoughts?
 

Attachments

  • mpenning AD-1848.CivBeyondSwordSave
    602.2 KB · Views: 118
  • mpenning AD-1847.CivBeyondSwordSave
    594 KB · Views: 82
I'm running BUG Mod 3.5 (latest svn) with 0.40M... no problems at all.
 
I'm running BUG Mod 3.5 (latest svn) with 0.40M... no problems at all.

Are you saying that the 1848 save game doesn't crash for you? If so, which operating system are you using?
 
Your save is definitely crashing. I used a debug build from the current BetterAI SVN as well as the current BUG SVN to load it and the crash is consistent.

The problem is that there is a fort on a copper hill that is now in neutral territory thanks to war. During the turn of Player 3 (Joao), an Airship in Basra is running AI_airOffensiveCity() and making the following check against that unowned fort (line 15873)
Code:
		// Limit to cities and forts, true for any city but only this team's forts
		if (pLoopPlot->isCity(true, getTeam()))
		{
			if (pLoopPlot->getTeam() == getTeam() || [COLOR="Blue"]GET_TEAM(pLoopPlot->getTeam()).isVassal(getTeam())[/COLOR])
			{
				if (atPlot(pLoopPlot) || canMoveInto(pLoopPlot))

But, since the plot is unowned, pLoopPlot->getTeam() returns NO_TEAM and so GET_TEAM(NO_TEAM).isVassal(3) goes down in flames.

For your game, you can go into WorldBuilder on the 1848 save and remove the fort on that tile and the game will continue without the crash. If you want to avoid any spoiler info I can probably do it for you. Otherwise, check below for a hint as to the location.
Spoiler for location of fort :
it's at plot 8,8 (near Dresden :D) which is basically South of Anasazi and a little east; turn resource flags on and look for the copper and you can't miss it)


For BetterAI's purposes, we need to verify that pLoopPlot->getTeam() is not NO_TEAM prior to calling isVassal(). Perhaps the initial check should be something like this?
Code:
		// Limit to cities and forts, true for any city but only this team's forts
		if (pLoopPlot->isCity(true, getTeam()) [COLOR="Blue"]&& pLoopPlot->getTeam() != NO_TEAM[/COLOR])
It works but it was just the first thing that popped into my head and so might not be optimal. For one thing, that would be potentially 3 separate pLoopPlot->getTeam() calls in a row so I'd probably just do it once and store the result in a variable.
 
Your save is definitely crashing. I used a debug build from the current BetterAI SVN as well as the current BUG SVN to load it and the crash is consistent.

The problem is that there is a fort on a copper hill that is now in neutral territory thanks to war.
<spoiler>
</spoiler>
Awesome, thanks for tracking that down... it made me sick to stop the game at that point because I just scored such a great city from Saladin - 4 Settled GGs :D.
 
BTW, I worldbuilder'd that crash only to have it crop up again in another war... I'm probably going to hold off on playing until a patched version is published... could you drop us a note when this one gets fixed?
 
How 'old' is this bug? And it's totally unrelated to any BUG release, correct?
 
It's purely a BetterAI bug from version .40 (and jdog's already committed an SVN update to fix it). And indeed it was totally unrelated to the BUG mod. Gatling just happened to be using BUG as well when he found it.
 
Top Bottom