[BTS] Development thread

jdog5000

Revolutionary
Joined
Nov 25, 2003
Messages
2,601
Location
California
This thread is for the development and testing of "beta" versions of the mod before official releases. The latest beta development version can be found at:

Development download at CFC.

This beta download will be updated only when there's a forthcoming release which I would like help testing.

If you are interested in checking out the absolute latest code (with the crash/bug risks that come with the territory), then visit the sourceforge repository for the project. In particular, you can use svn (a version control system) to check out "nightly" builds of the project from:

https://civ4betterai.svn.sourceforge.net/svnroot/civ4betterai/trunk/Better BTS AI/

For more about using svn, check out this how to guide. I use TortoiseSVN.
 
One of the big changes for 0.40 is the AI use of fighters and bombers for defense. If you want to see an example of what's changed so far, try out the attached test case save with 0.37 and 0.40 ... you should see a pretty dramatic difference.

View attachment air test multi target4.zip

Here are the components of the new behavior:

1. Sensing threat to the city they're stationed in. You can see the danger level of a plot in debug mode by holding down alt and mousing over the plot. At .33 the defense handling kicks in, at 1.0 attack units will retreat while defense units still around till 1.33.

2. CvUnitAI::AI_defendBaseAirStrike() new function for running airstrikes in a two-tile radius.

3. CvUnitAI::AI_defensiveAirStrike() new function for running airstrikes around the player's cities (not just the current base).

Among the new features for these airstrike functions is a weighting by the strength of the attacking units, in the standard airstrike code weighting was just based on how much damage you could deal ... ie, hitting a warrior down 34% health was considered equal to a tank down 34%.

Also note that the unit type isn't as important to the AI as the UNITAI that the unit is assigned. Again, in debug mode it will tell you what unit is running what AI and this can be changed in the world builder. ATTACK_AIR and DEFENSE_AIR are the main ones for this.

So, what we're looking for are cases where the current code doesn't perform intelligently. One way to create more "real" situations than the immobile barbs in the above test case would be to change the cost of air units to -1 in XML and autoplay a game into the right era. Then, you can add just the planes you want using the worldbuilder (remember to also check the UNITAIs, fighters default to defense). Create your save and then automate one turn (Ctrl+Shift+m) and check the log and map. You can immobilize units by setting them to UNITAI_UNKNOWN.
 
Update submitted to SVN: 0.40 revision j

Both the sources and the SVN copy of the mod have been updated. See link in first post.

0.40 will be a major overhaul of the air units in the game, both offensive and defensive. This particular revision focuses on large changes to where the AI decides to base its bombers.

Original BTS calculations (still invoked when at peace) focused on city threat (CvCityAI::AI_cityThreat), a city which had a higher threat measure was a more appealing base. Several components of city threat make sense, closeness to other player or enemy cities for example. There are other considerations there that don't make sense however, like the number of wonders in a city and, most importantly, how many enemy units are next to the city ... you don't want to move a bomber into a city you're about to lose! City threat also had a fixed radius and didn't consider the range of the bomber.

New calculations loop over the range of the bomber, weighing the various targets that the bomber will then pick between on its next turn: enemy units in our territory, enemy cities (especially if we're threatening them), resources to bomb, and our units in enemy territory to provide air support for.

The results of testing so far are looking quite good, but please try it out and compare results with 0.37 or earlier releases.
 
Just a quick question on the espionage aspects of 0.40:
- When AI starts preparing for war against another player they will heavily shift their espionage spending towards that player....

Will this give the AI's war plan's away do you think? It is definetely a good idea that espionage spending should rise, but at a guess it should only do so if the AI were capable of sudden espionage spending increases for other reasons as well, which would act as a mask of their true intention. I'm not aware of how the AI might suddenly increase espionage spending in other ways other than a war plan.

Cheers.
 
What if we added a large random portion to espionage spending? And some "stickyness" to it.

In short, make it so that a spy surge could happen randomly, as well as a prelude to invasion?

At the same time, the AI should notice spy surges possibly?
 
The most recent version I can find from the links in the first post is 0.40e. How do I get hold of 0.40j?
 
What if we added a large random portion to espionage spending? And some "stickyness" to it. In short, make it so that a spy surge could happen randomly, as well as a prelude to invasion? At the same time, the AI should notice spy surges possibly?

Yeah you, Jdog and others have got some real interesting thoughts going on in the "espionage target weightings" forum.
http://forums.civfanatics.com/showthread.php?t=285258

My only concern is that it's not yet the time to work on the espionage aspects in Better BTS 0.4. This version is more about air warfare. Modifying the espionage system, should be allocated it's own independent version number.

Cheers.
 
The most recent version I can find from the links in the first post is 0.40e. How do I get hold of 0.40j?

Updated the CFC development download to 0.40j ... previously you had to get it from the sourceforge SVN repository. CFC is probably more user friendly :crazyeye:
 
I'm curious... will BUG mod be integrated with 0.40? This would be awesome if possible
 
Updated the CFC development download to 0.40L, this is a release candidate so it's got everything I'm planning for 0.40!

Note that it includes changes to air combat mechanics as discussed in the air combat thread ... this is a gameplay change, but I felt it was a necessary one to make veteran air units important. That said, there's an easy switch to go back to the old style: just change the BBAI_AIR_COMBAT value in GlobalDefinesAlt.xml to 0.

If you want to help make sure everything is working well, check out the debug thread for some tips. The download includes the 0.37 dll also so you can switch and see what's different (could also go all the way back to vanilla BTS too ...). Note that fighters were pretty sticky before, they didn't move much from their current city and once they started an interception mission they didn't change their mind on future turns much.

Things to look for:

- Air unit basing: This is critical if they're to do their job well!

Are defensive air units in the right positions at the appropriate densities? Are they running interception when needed? Are they reasonably prepared for sneak attacks? Do other fighters move in when an important city's squadron is knocked out?

Are offensive air units in position to support attacking ground troops? Do they use vassal/team territory for bases appropriately (new feature)? Do they use forts when appropriate?

- Defending the homeland:

Do offensive and defensive air units hit enemy incursions into their territory effectively? Do they appropriately pull out when their base is seriously threatened? Does a reasonable air defense stay behind to defend the city against bombing?

- Mission selection:

Do bombers succeed in knocking down defenses for ground troops without giving away target cities? Do they support naval invasions appropriately? Do they take out resources effectively?

Are there an appropriate number of fighters running interception? Do "extra" healthy fighters do useful things?
 
It is quite easy to merge into BUG. It literally took me 2 minutes to merge the AI Autoplay python from Better AI into BUG. I expect similar results with ChangePlayer. If those are the only Python files different from the Unofficial Patch, I can write up a simple set of merge instructions later this week. I'd do it tonight, but I need to get Unofficial Patch 0.21 ready for testing first. :p
 
you can add changeplayer.py to the same xml config file you needed for autoplay -> done.

Do they appropriately pull out when their base is seriously threatened?

Do you mean fleeing behavior? I just thought of this. The AI should flee with the last units from cities which will be captured and form a new emergency unit stack.
 
Woot! Genghis was just about to win a Domination victory on an Archipelago map when time expired in my last test. I've been working hard on the naval invasion part of the AI, found several places where there was (I believe pretty obviously) unintended behavior slowing/stalling the AI's ability to launch naval invasions and keep them rolling.

The strangest behavior was that AI transports which weren't full yet would sit in cities trying to pick up units they already had on board. I'm not kidding. The transports would stick around in a city and run pickup missions if there were units with the appropriate kinds of attack AI in the same plot. The units they already have picked up are on the same plot and were counted. The transports would eventually fill up if the surrounding cities produced new attack units as those units would move to fill the transports. On small islands, however, a big flotilla could wait indefinitely trying to pickup the troops it already had.

There were a lot of fallout changes from fixing this, as transports were now moving all around the AI empire trying to pickup units. Escorts have been improved and I toned down the transport motion a bit so that it wouldn't be easy to pick off half-loaded troop ships with submarines or privateers.

One more new behavior to test before 0.45 is ready for the world.
 
Woot! Genghis was just about to win a Domination victory on an Archipelago map when time expired in my last test. I've been working hard on the naval invasion part of the AI, found several places where there was (I believe pretty obviously) unintended behavior slowing/stalling the AI's ability to launch naval invasions and keep them rolling.

The strangest behavior was that AI transports which weren't full yet would sit in cities trying to pick up units they already had on board. I'm not kidding. The transports would stick around in a city and run pickup missions if there were units with the appropriate kinds of attack AI in the same plot. The units they already have picked up are on the same plot and were counted. The transports would eventually fill up if the surrounding cities produced new attack units as those units would move to fill the transports. On small islands, however, a big flotilla could wait indefinitely trying to pickup the troops it already had.

There were a lot of fallout changes from fixing this, as transports were now moving all around the AI empire trying to pickup units. Escorts have been improved and I toned down the transport motion a bit so that it wouldn't be easy to pick off half-loaded troop ships with submarines or privateers.

One more new behavior to test before 0.45 is ready for the world.

Awesome jdog I can't wait. I assume the spread culture mission was fixed. If not there'll be a bit of :trouble:, :deal:, :run: if you know what I mean. :p

But seriously I appreciate the effort - there is no better BtS mod than Better BtS AI! :goodjob:
 
I have a minor request for the next update. If it is easy, could you please have it so that AI Allies to a human don't gift techs to vassals. Actually the whole gifting techs to vassals should be reexamined, AIs automatically gift all techs to vassals, even voluntary ones, which is not very smart, though the overall behavior is just questionable. Gifting techs when an AI is allied with a human though should not occur.
 
I'd be tempted to set the "If you are gifted a technology as a vassal, and you do not know at least 1 technology that requires that technology, then you cannot trade away that technology" as a general rule.

This makes the "gifting technologies to vassals" becomes both something the AI does, and a good move on the part of the AI. The vassal will leak tech, but cannot leak 'bleeding edge' tech.
 
Top Bottom