AI - Improve Neutral Categorization


  • Admin

    Look to expand neutral categorization from just the regular NULL player neutrals to include other types on maps such as Iron War, Caribbean Trade War, etc. Based on Iron War discussion here: https://forums.triplea-game.org/topic/73/iron-war-official-thread/350

    Passive Neutrals

    • No combat move phase (includes existing NULL player neutrals)

    Active Neutrals

    • Has combat move phase
    • defaultType="AI" or "DoesNothing"
    • isHidden="true"
    • All players that are part of said alliance must be 'Neutrals' as well

    Use These For

    • Don't trade TUV for Passive and Active neutrals (only attack if territory worth capturing)
    • Don't calculate defenses against Passive neutrals

  • Admin



  • @redrum
    What effect will this have with 'releationship' settings? Will they be enhanced to help the AI?
    Just asking.
    Thanks for all you efforts!

    Cheers...


  • Admin

    @wc_sumpton This particular change has no direct effect on relationship settings. Mostly its just to classify different types of enemies as either the main enemy or 'neutrals' so that the AI doesn't waste resources attacking neutrals for TUV trades. If you have certain 'relationship' setting improvements or examples you'd like to examine then I'd encourage you to create a thread 🙂



  • @redrum
    No problem, thank you for your response.
    I was thinking along the lines of a 'archType' like 'AI Neutral' could be added to help. There are the other 'relationshipTypeAttachment' options that can be used for fine tuning.

    Just some thoughts

    Cheers...


  • Admin

    This can now be tested in this pre-release: https://github.com/triplea-game/triplea/releases/tag/1.9.0.0.10171


  • Moderators

    @redrum Sadly, not a good testing on Feudal Japan. I think this killed Feudal Japan, rather than making it better, as most AI players now sit on their starting territories and never attack, at least for the first 4 rounds, looks like.
    So, practically, the AI went from one extreme to the other, from being almost suicidal to being almost passive.
    You can test it yourself by giving all players to AI and starting the game (no need to upload a savegame here, I think).


  • Admin

    @cernel I just loaded up Feudal Japan with the latest code and let the first 2 nations play their turn and they both attacked minor clan territories... so not sure what you mean: 0_1524447532663_save_Feudal_Japan.tsvg


  • Moderators

    @redrum said in AI - Improve Neutral Categorization:

    Active Neutrals

    • Has combat move phase
    • defaultType="AI" or "DoesNothing"
    • isHidden="true"
    • All players that are part of said alliance must be 'Neutrals' as well

    As I said in the other topic, and I'm reproposing it in here for reference, rather than having all of a series of "AND" type conditions to try to guess and catch the mapmaker's intent for what is a so-called "active neutral" (really, we should find a better name for it), I would have the "active neutral" players identified by them not having any victory conditions assigned, while at least two players part of two different alliances having any.
    This, of course, would not cover games without victory conditions and may go the wrong direction in case of AI challenge games in which the AI is lacking a victory condition or games with "active neutral" kind of players that have a victory condition assigned just in case, but I think the right way of making a game is assigning victory conditions to the competitive players only; so I'm thinking this would be more consistent.
    Then, a further step may be, instead of just considering having or not victory conditions to achieve, discounting the assigned importance for a player the more the player is unlikely to achieve its victory conditions (thus, practically, treating players that are in bad shape akin to the "active neutral" ones, mostly with reference to FFA).
    The main objection is that a lot of games lack victory conditions, but I believe a game without victory condition is unfinished; so I don't think it has to be supported (plus, as I said, if nobody has any victory conditions, then nothing will be considered "active neutral").


  • Moderators

    @redrum Also, all players currently (not necessarily default) assigned to "Does Nothing" or unused (meaning the "use" ticked off) should be Passive (since they are).


  • Moderators

    @redrum The suggestion was to letting it run for a couple of rounds, but I guess I should have uploaded the savegame. Also, I should have told you to assign Easy AI to MinorClans.

    So, I've let a new game run with your settings, except no human active player, for 50 rounds, and here is the savegame:

    0_1524610654685_20180423_Feudal Japan_AI(Fast)_01.tsvg

    In this savegame, we can see that:

    • On round 1 only the 4 most southern players and the 1 most northern player attacked, while all the other 12 players remained still, except Uesugi, that counterattacked the recently taken territory (by Date).
      Hence, we cannot consider Uesugi in the matter, as having an enemy to attack on its turn. This implies that 5 players attacked the passive player and 11 players did nothing.
      It's really strange that only the players at the extreme of the map attacked. I wonder why so. A guess might be that the AI placing all castles about in the centre of the map may have played a role, tho I wonder, then, why some players having at least 1 good territory without castles to attack didn't do so.
    • On round 3, Chosokabe attacked the passive player too. 10 players out of 17 are still in their starting territories.
    • On round 20 Mori finally opens up a frontline with one of the players just sitting for the whole game (namely, Urakami).
    • On round 21 at least Oda finally takes one of the passive territories nearby.
      The reason why Oda behaved differently from the other standing-still players may be its units composition. Of any of those, I see that Oda is the only one with an army composition I would call decent. The others, with the partial exception of Satomi, purchased way too many teppo and way too few ashigaru. Here you have a very good example in which the AI failed with the purchase, buying too many units able to give support and too few units able to receive support (as I said, the ability to give and receive support should really be valued the same way, by the same relative amount, because what it really matters is the total power, not who is the one giving the +1 or whatever; this may be a good test map to properly value supportable units, especially when having a lot of unused support ability (meaning the AI should understand to buy supportable ashigaru at least when having unassigned support, if not on perspective) (I'm also making a map in which the fodder and common units are able to give support, and there is only 1 non-fodder unit able to receive it)). Another item is that I believe the AI doesn't understand the importance and the impact of Daimyo, with their ability to give +1 att/def to virtually infinite numbers of any other units, cumulable with any other support (this is representing generalship). This is another reason why supportable units should get a bonus value for being able to receive support, like supporting units do for giving it, as all units are more valuable because of the Daimyo support, but the ashigaru are relatively more so, since their base is 1/1, can be bought in greater numbers, and the Daimyo supports virtually infinite units anyways.
    • On round 28 Oda opens up a frontline with Takeda, that, until then, just stayed still in its starting territory. So, from now on, Oda and Takeda will be busy fighting each other only.
    • On round 28 Uesugi kills Date (as said, Date opened a frontier with Uesugi on round 1).
    • From this point onwards, the game is mainly just Satomi progressively conquering more and more of the map, but being unable to win, as only human players are able to. Most other players remain turtled, waiting for their doom.

    The settings you used are not totally right, as you can read in Notes:

    Choose Easy AI for MinorClans.

    The reason for this is to assure a more random (or totally random?) placement for Minor Clans.

    This is a round 10 savegame with all players assigned to "Fast (AI)" and Minor Clans assigned to "Easy (AI)":

    0_1524610676039_20180423_Feudal Japan_AI(Fast)_02.tsvg

    With the better balanced (meaning totally or mostly random) placement of Easy AI for the Minor Clans, the game appears obviously broken (it was broken anyways, since most players were doing nothing).

    As you can see, at round 10 only Ryuzoji, Chosokabe and Date are out of their starting territory, while the other 14 players are not moving. Also, these 3 players went out on round 1, taking 1 territory, and no other neutral territories at all are taken after round 1.
    The only actual player vs player gameplay to be seen, in the whole 10 rounds, is a round 2 and round 3 trading of South Mutsu, between Date and Uesugi.

    With Hard AI, instead of Fast AI, the matter doesn't get better.

    Now to the matter.

    The fact that Feudal Japan is broken by these new AI behaviours (aside from the fact that there is still the option to assign everything to Easy AI, which is not anywhere good an option, actually) doesn't mean much for the quality of the setting themselves.
    Feudal Japan is a very borderline game, in which the MinorClan tend to really get stacked a lot with defensive units, and players are really discouraged from burning their TUV on them. The reason you have to attack some passive is, mainly, that the game is not going anywhere if everybody just stays in their capitals, and the humans players should be spread out enough to first having to deal with some relatively easy AI opponents.
    A general dynamic is that in a FFA the game tends to be slower, so production is relatively more important than TUV, with respect to a 1v1 game. Hence, you are much more encouraged to go for taking Neutrals, if the game is a FFA, or any 3+ sides one, rather than a game with only two alliances pitted against each other.
    So, chances are that if you make the AI so interested in taking over territories that Feudal Japan will play as envisioned, other games may result in the AI just attacking passive players too much (that was the reason of these changes, in the first player).
    Some possible suggestions, one more general and the other more specific:

    • In FFA, production is more important, so you want to take neutrals / passive more than you would do in 1v1; so value production more (like a value 3 territory in a game with 3+ sides is valued as much as a value 6 territory in a game with 2 sides).
    • In FFA, you often prefer to take neutral territories not in the direction of your enemy; so for 3+ sides games assign maximum value to the direction taken, no matter where you are going.
    • In Feudal Japan, you start in a territory surrounded by passive players; so, if you have no other land ways to go but to take neutrals / passive, do it in all cases you can win the combat in averagely 2 rounds or less, no matter how costly (a behaviour to just avoid players not moving at all for many rounds or forever).

  • Admin

    @cernel There were a few checks that were still treating passive player neutrals as actual players that could attack causing the AI to be overly cautious. Here is the PR: https://github.com/triplea-game/triplea/pull/3399

    I tested a round of Feudal Japan after the change and most of the nations attack a territory now.


  • Moderators

    @redrum Looks fairly decent now, but it looks like there is still a bias towards the player in the centre being too shy and the strange dynamic that either you attack round 1 or you don't attack (tho now we start to see a few exceptions to this), that is going against the common sense, as you rather would be more propense to attack on round 2 or 3 if you didn't attack on round 1, not the other way round.

    Savegame:
    0_1524644923844_20180425_Feudal Japan_AI(Fast)_01.tsvg

    For example, at start of round 3 we can see that Yamana, Miyoshi, Asakura, Asai, Atakeiama are all the most central players, and all didn't attack, and still won't attack on round 3, either.

    Obvious moves they should have done, not later than round 3:
    Yamana should have taken Tango.
    Asakura should have taken Kaga.
    Hatakeyama should have taken Izumi.

    For Asai and Miyoshi, the matter is less clear, and doing nothing may be justified (tho very unlikely to win taking no risks).

    Another related example is that Satomi has been very late in getting around taking the safe Kazusa, waiting till round 7 to do it.

    I'm wondering if it would be better to maybe add the concept of "demi-passive" players, that would have TUV destruction valued at 50% (instead of either 0% or 100%).
    A demi-passive player would be a player lacking a combat move phase but having a placement phase.
    This is on the account that, in case like Satomi taking Kazusa, the delay may be that the AI was delaying to have better chances the next round, but since the MinorClan player keeps placing new unit, you have incentive to waiting less than if the target would be a pure neutral, meaning an incentive to kill passive TUV before it gets too big (if the passive player can keep placing new units, as we can assume when having a placement phase).


  • Moderators

    Also, how about a subsection of Feature Requests called "AI Enhancements" where to have all AI focused topics?


  • Admin

    @cernel In most cases, the reason those AIs don't attack is because they determine a can opener could potentially take their capital if they do. So taking the example of Hatakeyama, they determine that to make the attack on Izumi worth it they need to use pretty much all of their units. Then they calculate defense of their capital after doing that and believe that Settsu could clear Kawachi and then Yamashiro could attack through with its 2 move units to capture the capital. I'm not sure if that is actually possible in Feudal Japan but the AI's current can opener logic treats it that way. The same is true for Yamana which sees can opener potential through Tamba. I think Asakura worries about amphibious invasion from Tajima.

    Honestly, without writing a pretty specific AI for Feudal Japan, I don't think the AI will ever play it well. IMO, the map is pretty flawed from a design perspective because all of the nations are so close together that there are so few moves nations can make that aren't risking them getting eliminated. If you played this map with all human players, it would probably be a giant stalemate as well with them all taking 1-2 minor clan territories then sitting around waiting for your neighbors to hopefully attack someone else so you can then capture them.


  • Moderators

    Ooooooooooooh it because they fear to lose the capital!

    Well, actually, in Feudal Japan you cannot directly go from war to allied, and practically I've never seen players coordinate for canopeners, nor I think it is really something you worry about.

    @redrum I agree that Feudal Japan has several issues and it is kind of silly, also tendentially very hard to balance, due to the linear island shape, but, compared with what we have, it is surely one of the best FFA of TripleA.

    Of course, it is playable only if the humans are in the minority, if only for balancing reasons.

    I think this problem would be fixed by adding 2 castles in each capital (for a total of 3), which I actually believe would be good anyways, giving some anti-stomping margin. If I would do this change (only), would you merge it?

    This is a 20 rounds savegame with the 3 castles setup; it looks fine enough:
    0_1524681495796_20180425_Feudal Japan_AI(Fast)_02.tsvg


 

Looks like your connection to TripleA Forum was lost, please wait while we try to reconnect.