In the interest of improving AI play for other M2TW mods, here's a synopsis of the "Best Friends Forever" AI code and why it's a problem:
Most of the playtesters were reporting a rapid increase in positive relationships among all the AI factions, and even toward the human player. So I ran a series of fixed tests using Pontos as the baseline human faction, and establishing relationships with two of the largest factions (Ptolemaioi & Seleukids) and one of the smallest (Pergamon). Extensive testing pointed to the descr_faction_standing.txt file, and specifically three pieces of code within it. The last test looked just at those (everything else was pulled out):
- Difficulty setting is at "Medium":
- Using XAI (descr_campaign_ai_db.xml)
- Using a "partial code" descr_faction_standing.txt file (Code sections 89, 90, & 91)
- Ran the same 10 turn Pontos test.
Result? All three factions progressed to Outstanding in only six turns:
Attachment 12153
Here is the offending code:
Code:
; Make factions try and band up with smaller factions
;------------------------------------------
Trigger 0089_Update_Band_Together1
WhenToTest FactionTurnStart
Condition FactionHasRank
and FactionScorePercent overall < 30
and FactionScoreRank overall > 3
FactionStanding exclude_factions { } normalise 1.0 40
;------------------------------------------
Trigger 0090_Update_Band_Together2
WhenToTest FactionTurnStart
Condition FactionHasRank
and FactionScorePercent overall < 20
and FactionScoreRank overall > 4
FactionStanding exclude_factions { } normalise 1.0 25
;------------------------------------------
Trigger 0091_Update_BandTogether3
WhenToTest FactionTurnStart
Condition FactionHasRank
and FactionScorePercent overall < 10
and FactionScoreRank overall > 5
FactionStanding exclude_factions { } normalise 1.0 10
So clearly the code is broken. In addition to the ridiculous pace of improvement, if the idea is for small factions to "band together", then why would relations improve between Pontos and the Seleukids/Ptolemaioi? They are the biggest factions out there. Doing some research, this code is shared (as-is) by both the Savage AI and Lusted AI. The code used by XAI is different, but not significantly so:
Code:
;------------------------------------------
Trigger 0089_Update_Band_Together1
WhenToTest FactionTurnStart
Condition FactionHasRank
and FactionScorePercent overall < 40
and FactionScoreRank overall > 8
FactionStanding exclude_factions { } normalise 1.0 60
;------------------------------------------
Trigger 0090_Update_Band_Together2
WhenToTest FactionTurnStart
Condition FactionHasRank
and FactionScorePercent overall < 30
and FactionScoreRank overall > 10
FactionStanding exclude_factions { } normalise 1.0 45
;------------------------------------------
Trigger 0091_Update_BandTogether3
WhenToTest FactionTurnStart
Condition FactionHasRank
and FactionScorePercent overall < 20
and FactionScoreRank overall > 12
FactionStanding exclude_factions { } normalise 1.0 30
Overall, the effect of this code is extremely powerful. Consider the parameters below:
Code:
; faction standing parameters
; ===========================
; initialisation parameters
min_faction_standing -1.0
max_faction_standing 1.0
relations_improved_thresholds
{
0.25
0.4
0.6
}
At game start, Pontos has a relationship of "0" with Pergamon, Seleukids & Ptolemaioi. Strip out all the other code so we are only testing the "Band Together" code, and by turn 3, Pontos was at "Good" relations with all. That means the relationship had improved to:
>.25 but <.4
By turn 4 it was "Very Good":
>.4 but <.6
By turn 6 it was "Outstanding":
>.6
Which is basically +.1 EVERY turn. Even with the most abysmal relationships (-1.0), it will only take 20 turns to make them BFFs. That rate of improvement could be reduced by altering the formulas in several ways (as we saw with the XAI code - it took 13 turns to reach "Outstanding"), but that's not the real issue. The idea of small factions banding together is not a bad one, but these formulas are not correct for that purpose, so we pulled it completely out of EB2.
Bookmarks