[BTS] Development thread

Break, no, make a little screwy for a turn, maybe. In fact, for single player it probably isn't an issue at all because of the timing of saves.

I added some logic to force an update of the strategy hash when loading saves from old versions, not sure if I checked it in to svn yet.
 
Some news:

Version 0.90 is well under way, it contains a significant number of changes to how the AI goes about war from both a tactical and strategic view. I plan to put a development test version up in the near future which should be stable but is not yet feature complete.

The remaining big component for 0.90 is the first complete iteration on the new "playing to win" system ... in short, each AI player will regularly evaluate what are its best approaches to winning and shift its play style accordingly. What a particular leader thinks is best in a particular game will depend on its personal tendencies, the game state, and some randomness for unpredictability. I'll start a new thread on this soon so you all can help set up tendencies for the different leaders.

The initial implementation will be a bit conservative (subtle shifts in behavior) while the logic/balance is worked out, but by version 1.0 we should get to a point where AIs going for space or military victories will really start to behave differently in the middle ages.
 
Sounds great, jdog.
 
It's a great idea. If this can be gotton going, civ4 will still have a lot of life left in it even when civ5 comes out. The main thing that kills civ4 is the long turn times in the late game and the lack of a long range planning AI. However my suspicion is that when civ5 comes out, civ4 will still be a perfect platform for playing interesting short games on small maps where the unit numbers don't build up to bloated levels. With a quality AI like this project, I for one will probably still play civ4. Really epic large scale games will probably be much more suited to civ5, because of the new single unit ideas and multiprocessor support. But if you think about civ4 with a quality AI on small maps, it still could be a very nice game to play for many years. After all classic turn based games like chess, are really a setup where the moment of battle comes quickly and sharply and it is very elegant. Civ4 is still capable of succinctness like chess, on small maps with a quality AI.

Cheers
 
New development version posted, 0.90n ... a huge list of changes focused around getting the new "playing to win" system going and war strategy/tactics. The game has been stable through quite a few tests, so there shouldn't be any crash issues. A save from 0.90 cannot be loaded with earlier versions however.

The playing to win system is not fully implemented ... the AIs will pick victories to go for (see the thread on this for more), but only some of the changes to their strategies at different levels have been implemented. The biggest changes are for Conquest and Domination, where the AI now will get very aggressive if it has a large power lead. The AI will now also not accept capitulation from another player it detects as being in later stages of going for Space or Culture victories (until it captures their key cities and ruins their chances).

So while that system is a work in progress under the hood, there are quite a few other changes in place. Let me know what you think!

New in Better BTS AI 0.90
Spoiler :

Merged in Unoffical Patch 1.50
Added the Lead From Behind mod by UncutDragon (improves selection of order for attack for both human and AI stacks, preserving GG, medics, experienced units)
Added CIV4LeaderHeadInfos.xml and CIV4CivilizationsSchema.xml to mod files for new victory strategy system

Bugfix
- Fixed divide by 0 issue with debug text which could cause crashes in debug logging when loading world builder scenarios using a non-Final_Release DLL
- Fixed bug (introduced) where giving pillage orders to a stack or multi-move unit would pillage multiple times
- Fixed bug (introduced) allowing ships to move diagonally over isthmuses under some circumstances
- Fixed bug (introduced) slowing AI expansion, especially on Archipelago maps

Victory Strategy AI
- Switched all cultural victory logic to new victory strategy framework
- AIs gunning for cultural victory now much less likely to declare war the closer they get, biggest reduction for TOTAL war, smaller reduction for DOGPILE
- AIs in late stages of cultural victory more willing to agree to peace
- Updated close to cultural victory detection so that AIs who haven't been trying but get reasonably close will pursue it, and so that they can detect when human player is pursuing this strategy
- First complete implementation of AI victory strategy framework for Conquest, Domination, Space, and Diplomacy
- Levels 3 & 4 of each victory strategy are now based on observables, not hidden AI leader tendencies. So, other AIs can now understand when other AIs are going for a particular victory, and it also serves as an estimate of what the human player is doing.
- AIs going for CONQUEST and DOMINATION victories willing to spend more gold on units
- Improved existing system for AI going for DOMINATION to build health buildings to help boost pop

War strategy AI
- AI now detects when other players are close to victory and greatly boosts start war value against them (still plays within leader's attitude no war probabilities, so won't declare on friendly)
- If enemy is (still) running higher levels of CULTURE or SPACE victory, AI will not accept capitulation until it ruins the enemies chance of winning
- AIs running highest levels of CONQUEST and DOMINATION strategies may ignore leader's attitude no war probabilities and attack highest value target
- AI calculations of the state of their wars now work better with minor civs (for mods)
- Smoothed AI valuation of how much bombard strength it needs to build for its attack stacks, upped desired bombard strength in era of walls and castles. AI should now produce considerably more siege, especially the bigger AIs.
- Reduced AI valuation of interception probability as criteria for UNITAI_COUNTER units, to reduce drive to switch infantry to SAM
- AI now won't start air blitz build logic until it can build bombers (previously started with fighters)
- Added AI_STRATEGY_ALERT1 and AI_STRATEGY_ALERT2, AI will now analyze if it might be attacked in the near future and take pre-emptive action
- AI now generates extra defence in its high culture cities a bit earlier when going for cultural victory
- Removed some of the reductions to defender builds when AI is running AI_STRATEGY_GET_BETTER_UNITS (should help AI defend itself early in game)
- Added AI_STRATEGY_TURTLE implementation, if AI is badly outgunned and either recently attacked or losing badly, it will use any offensive stacks it has for defense and go into a defensive survival shell
- AI now plans ahead to counter units of enemies it is preparing for war against based on what it can see
- Added function so AI can calculate the air power of its rivals
- Corrected AI valuation on interception abilities for UNITAI_COUNTER units so that it doesn't switch Infantry to SAM until rivals have air units
- Adjusted Dagger and Crush strategy thresholds so if AI has started them it is more likely to keep them up

War tactics AI
- Reworked AI logic for when to raze cities it conquers
- AI carriers will now move to support/air defend ground troops, support invasions
- AI now values active wonders a little more in deciding cities to target
- Fixed bug where AI would over value holy cities of religions other than its state religion
- Upped threat cities feel when they are next to much more powerful rivals
- The strategy FAST_MOVERS no longer limits the AI from forming main stacks of mixed fast and slow units, but it will still form small fast attack groups
- Augmented the strategy LAND_BLITZ, a more restrictive case of FAST_MOVERS, so that main stacks will be made of multi-move units when possible in the modern era

Naval AI
- Assault transports no longer set off to join transport groups already mounting assaults
- When assault transports head out for invasion, other transport groups which were going to join them will now pick a new mission
- Improved handling for when multiple transports are moving to pickup a stack of stranded units, the closest set of transports will now get the task

Pirate AI
- Reduced suicide of pirateers starting from inside their own borders

Worker AI
- Fixed several issues and improved efficiency of CvUnitAI::AI_nextCityToImprove

City AI
- When at war, AI now is less zealotful in building production buildings. They have to be able to be completed faster, and it will only start them probabilistically so not all cities will be building them at once
- Improved AI city build decisions when empire is under seige, especially for small empires
- Added calculations of actual health/happy effects of buildings from BUG mod (thanks EmperorFool)
- Fixed logic bugs in AI valuation of when happy or healthy from buildings was extra important
- AI now actually considers health effects of power, dirty power, coal, and oil
- Reworked AI valuation of buildings with health effects so all effects are considered
- Buildings with negative health effects are now strongly avoided if city has health problems
- AI now better evaluates when building bAreaCleanPower building is useful
- Reworked AI valuation of buildings with happiness effects so all effects are considered
- Buildings with negative happiness effects are now strongly avoided if city has happiness problems
- AI now values buildings which reduce war weariness, previously only avoided buildings which increased it
- AI now values religious buildings for AP religion more than other relgious buildings based on boosted yield
- AI now values religious buildings for state religion more than other religious buildings based on yield boosts from wonders
- Tweaks to help AI build mobile defense/counter attack force when outgunned
- Lowered max build turn limit for high priority production buildings when AI is in a tough war
- AI will now probably only build one workboat using very early capital logic as originally intended (speeds expansion in water resource heavy starts)
- Resolved issues where AI early game build logic would get confused because Warriors cannot be built as UNITAI_CITY_DEFENSE

Tech AI
- Separated out building and unit valuation into own function for debugging and future efforts
- Adjusted valuation of tech based on units enabled, boost to defensive units under ALERT and TURTLE and offensive when going for conquest victory
- AIs going for DOMINATION victory will aim for Galleons earlier

Civic AI
- If AI is leader of AP, it now values state religion civics more
- AI now values benefits it receives from wonders for state religion buildings when computing value for state religion civics

Diplomacy AI
- All AIs will check more frequently for tech trades when well behind in tech race, biggest benefit for those who typically wait longest

Gold AI
- Improved AI budgeting for unit upgrades in scenarios, advanced start

Missionary AI
- Fixed issues and improved logic in AI usage of MISSIONARY strategy (religious full-court press)

General AI
- Changed player consistent random method for picking strategies from being based on capital city location to a stored rand, so AI player tendencies will be consistent even if capital moves

Efficiency
- Several efficiency improvements were added with Lead From Behind
- Improved efficiency of several unit motion selection loops, reducing number of calls to generatePath

Customization
- Split GlobalDefinesAlt.xml into a few separate files by type
- Improved handling of default values for new BBAI variables in case xml files are accidentally missing or something
- Added BBAI_TURTLE_ENEMY_POWER_RATIO to BBAI_AI_Variables
- Added BBAI_VICTORY_STRATEGY_CONQUEST, etc to BBAI_Game_Options so that you can turn off any parts of the new AI playing to win logic that you wish. The code already checks for whether the victories are enabled or blocked by other things like the always peace option, so this is really just for if you don't like how it plays for some reason.

CvUnitInfos.xml
- Returned UNITAI_CITY_DEFENSE to Roman Praetorians
- Returned work boats to original tags of military support (exploit) and military production (faster with drydock) (thanks Fuyu)

CIV4LeaderHeadInfos.xml
- Added new AI weights for five victory strategies
 
WOW, that's some list. I especially like the focus on war AI. The tactics, the strategy. It all sounds great.

Good job!
 
Are there any plans to add the most recent (v1.2) version of lead from behind? Does anyone have the earlier versions that would make that task a bit easier?
 
During the waiting time for 0.9 BBAI, can someone post me the correction to "Fixed bug (introduced) where giving pillage orders to a stack or multi-move unit would pillage multiple times" in order to patch 0.84?

Thanks in advance!
 
Not a very scientific evalutation of 0.9 test-version, but last night I played a quick game where I ended up with Ragnar, Isabella and me on one island. I had scaled down difficulty to "noble" to get a feeling for the new changes - Ragnar stomped all over me in a VERY short span of time, with Isabella joining the fray, catching me with my pants down after loosing two important cities to Ragnar, who was showing no sign of letting up, either. Guess the new strategies work :)

Jan
 
hmm.... developer 0.90r:

PHP:
		if( GC.getBBAI_DEFENSIVE_PACT_BEHAVIOR() > 0 )
		{
			cancelDefensivePacts();
		}

PHP:
		if( GC.getBBAI_DEFENSIVE_PACT_BEHAVIOR() > 0 )
		{
			GET_TEAM(eTeam).cancelDefensivePacts();
		}

should not this be "if( !GC.getBBAI_DEFENSIVE_PACT_BEHAVIOR() > 0 )" [if not] ?
 
Top Bottom