Page 1 of 3 123 LastLast
Results 1 to 20 of 46

Thread: PiterAI Kingdoms (new Artificial intelligence)

  1. #1

    Default PiterAI Kingdoms (new Artificial intelligence)

    PiterAI- artificial intelligence






    Installation instructions:

    unzip in your \SEGA\Medieval II Total War folder


    Game enable file:


    D:\Program Files (x86)\SEGA\Medieval II Total War\mods\americas\medieval2.americas (For other campaigns the same way)

    Another start will not run the mod !

    C: \ Program Files (x86) \ Steam \ steamapps \ common \ Medieval II Total War

    Additional for the steam version:

    Copy "medieval2" and change the name to "kingdoms".


    Information

    Diplomacy is based on many factors but in short it works as follows:

    From the point of view of campaign difficulty level:

    VH level – AI considers player as its biggest threat so it tries to form alliances against the player and tends to go to war against the player. The AI factions easily form alliances if they consider the player their biggest threat.

    H level – AI considers the player as a threat and tries to form alliances against the player and tends to go to war against the player, but to a more limited extent than on VH level. If an AI faction neighbors a faction that is significantly stronger, it will try to find an alliance against such faction. In such situation AI may propose alliance to the player and be a loyal ally.

    N level – AI tries to form alliances against the strong empires (factions that are significantly stronger than AI) and tends to weaken them. If there are no such strong factions, AI will try to go to war against the player. If AI does not border the player, it tries to attack its weakest neighbor (if it tried to attack the weakest neighbor first, the campaign would be rather boring ).

    In general:

    If the AI’s invasion priorities (i.e. code command driving AI to invade a given target) do not exceed a minimum threshold, the AI will not attack other factions (except for rebel / neutral provinces).


    By using the „opportunistic invasion” command in the options of war and rebel provinces conquer, AI will sometimes ignore its diplomatic priorities. Besides, M2TW AI is bugged anyway.

    Alliances – if an alliance is not aimed against an enemy which is the AI priority target, it works as a „non-aggression pact”. The alliance code includes commands which drive AI to attack a common enemy but if it is not the AI perceived “priority enemy”, the chance that such attack will be executed is rather small (especially on VH difficulty).

    Preparations for war



    The tactics responsible for invasion is rather a slow and “lazy” procedure so the AI will usually gather its armies along the borders before it finally decides to invade. Also AI will train its best available units and agents – do not be surprised when an AI assassin kills your favourite general. For the human player this knowledge is not a big facilitation though, since the fact that AI is gathering its forces along the border does not mean that it is going to invade the player’s faction in the nearest future.


    In some circumstances (for instance when the player does not wage a war with its neighbors), a neutral AI faction will also keep its garrisons on the border, just as it waged a war against the (neutral) player. This AI behavior may change when the it is in war with other factions – in such case it may send all its forces to the endangered front.

    War


    The highest priority of AI is besieging settlements – AI uses almost all its military potential on a given front to besiege settlements. It is probably not the best solution but taking into account the limitations of the M2TW engine it seems to be pragmatic and sufficient – otherwise AI would wander its armies aimlessly over the map.
    Then, as a second priority, AI tries to attack the available targets in range, so sometimes when besieging a settlement, another AI army may come to support the siege or even attack a defending player’s army which stands near the besieged settlement (to help defend it in case of assault), while the first AI army still keeps the siege.
    Finally, AI tries to do an “opportunistic attack”, which in some circumstances may ignore other AI settings and priorities. But thanks to this “opportunistic” possibility, AI is more “intelligent” and able to use some unexpected situations to its benefit. Since AI tries to besiege settlements, sometimes it may happen that it will spare player’s army standing on the bridge / ford and will walk around to lay a siege to a settlement or spare the closest strongly garrisoned settlement to lay a siege to the weaker one.


    - AI trains the troops of good quality, generally better than in the majority of mods I’ve seen and I think even better than in the original EB2 (no offence to the original EB CAI coder) since the troops quality depends mainly on the tactics settings in file descr_campaign_ai_db – I don’t know whether the twc modders know that.


    - The additional advantage of such tactics is the AI ability of starving the besieged settlements – AI will not attack until it is certain that it will win (taking into account the result of the autocalc battle).


    - AI is able to hire the mercenaries, which I did not observe frequently using other M2TW CAIs,


    - Of course AI can spam agents in some circumstances (especially the pesky merchants but these are no longer in EB2),


    - When AI declares a war, it can – especially when the border is long – attack simultaneously with several armies in different places along the border, which can demolish a careless player (I hope you don’t use the unhistorical “reload”).


    - AI uses its agents better,


    - AI can successfully strike with a really good sea invasion. This part of the code is perhaps not perfect but in my view it is quite good in comparison to other M2TW CAIs - I would like to see a CAI code which does it better.


    Defence:


    - Here I coded the AI in such a way that it is not so easy to conquer the settlements by attacking an army standing near the settlement and wiping out the settlement garrison that joins the battle as reinforcements (AI tries to place its armies a bit farther from settlements).

    If the total strength ratio on a given front is unfavorable to AI, it will not attack openly but will rather sit in garrisons or try to defend based on bridges / fords and prepare ambushes in forests. On some occasions AI fooled me with the following scheme: I see a weak army near the forest, attack, the AI withdraws to the forest, I attack… and then I am ambushed by significantly stronger AI army. This is not very frequent but the AI in the old M2TW can show some tricks – it’s a pity that the original authors made so weak use of the AI potential in the vanilla game.

    Even on N difficulty if an AI faction concludes that it no longer have common interests with the player and at the same time the AI faction is not in war against any of its neighbours, it may break the alliance with the player. In such case only relations 10/10 or 9/10 can protect the player from breaking the alliance by the AI. If AI is in war with a non-neighbouring faction, it does not count as a war and AI may break the alliance as soon as its common interests with the player end.
    Thank you for the translation Polehammer.




    Thanks for Araven for help in testing.


    Battle AI: I reworked AI Germanicu
    Last edited by Piterx93; May 19, 2020 at 03:55 PM.

  2. #2

    Default Re: PiterAI Kingdoms (new CAI)

    Looks interesting. I will try to test it in my mod sometime.

    Sandy

  3. #3

    Default Re: PiterAI Kingdoms (new CAI)

    Opinions are welcome

  4. #4

    Default Re: PiterAI Kingdoms (new CAI)

    Piterx93, is your mod only for those 4 expansions?

  5. #5

    Default Re: PiterAI Kingdoms (new CAI)

    Quote Originally Posted by lekseus View Post
    Piterx93, is your mod only for those 4 expansions?
    We can customize them for every mod. And what?

    Bellum:

    http://www.twcenter.net/forums/showt...r-AI-(new-CAI)

    MOS:

    http://forum.totalwar.org.pl/showthr...-inteligencja)

    The Last Kingdom:

    http://forum.totalwar.org.pl/showthr...-pobrania-MODa

    The Last Kingdom 4.5, nieoficjalny patch:

    Pobieramy i instalujemy na niezmodyfikowaną wersję 3.06b: http://www.mediafire.com/file/wgwgb3coqhbi95h/The_Last_Kingdom_4.5_patch.exe

    Where West meets with East


    http://forum.totalwar.org.pl/showthr...3-0-Pobieranie

    Medieval XL (Possible )

    http://forum.totalwar.org.pl/showthr...lna-i-Download



    Medieval Ultra Balanced


    http://forum.totalwar.org.pl/showthr...Ultra-Balanced



    Orient_und_Okzident, kingdoms_grand_campaign_mod

    How fetching mod, it often installs its AI.


    Europa Barbarum

    http://www.twcenter.net/forums/showt...gence)-(eb2-1b)

    Outdated but you can read reviews.
    Last edited by Piterx93; October 19, 2017 at 12:36 PM.

  6. #6

    Default Re: PiterAI Kingdoms (new CAI)

    Can you customize your CAI for Bulat Steel 2.1.4?

  7. #7
    bitterhowl's Avatar Centenarius
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    818

    Default Re: PiterAI Kingdoms (new CAI)

    Thanks for the great stuff! I will definitely include your mod into my Westeros submod if you please.

    One issue - will your team add more ai_labels into campaign_ai_db besides 3 existing for more variable behavior? For horde factions for example?
    Last edited by bitterhowl; May 11, 2018 at 11:28 PM.

    My sister, do you still recall
    The blue Hasan and Khalkhin-Gol?

    Because AI is dumb and full of errors.

  8. #8
    bitterhowl's Avatar Centenarius
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    818

    Default Re: PiterAI Kingdoms (new CAI)

    Could you please explain this part -
    <friendly-to-enemy-strength-ratio>0.3</friendly-to-enemy-strength-ratio>
    It means that AI will consider itself 3.33 times stronger than player ( 30 AI own men will be considered as 100). So AI will make suicidal attacks. I understand purpose of such settings to force AI to activity. I think you somehow compensated this to make attack adequately - by which parameter?

    My sister, do you still recall
    The blue Hasan and Khalkhin-Gol?

    Because AI is dumb and full of errors.

  9. #9

    Default Re: PiterAI Kingdoms (new CAI)

    Quote Originally Posted by bitterhowl View Post
    Could you please explain this part -
    <friendly-to-enemy-strength-ratio>0.3</friendly-to-enemy-strength-ratio>
    It means that AI will consider itself 3.33 times stronger than player ( 30 AI own men will be considered as 100). So AI will make suicidal attacks. I understand purpose of such settings to force AI to activity. I think you somehow compensated this to make attack adequately - by which parameter?

    It is not necessary. Nothing replaces it. Artificial intelligence has to attack the city. Therefore, it does not shred the army into many small parts. Invade_raids attacks when he calculates that he wins the battle.

  10. #10
    bitterhowl's Avatar Centenarius
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    818

    Default Re: PiterAI Kingdoms (new CAI)

    Thanks for the answer! One more issue - I read that this parameter acts at strat and tactical levels both. So AI may decide to attack 30 to 100 on a battlefield?
    I want to be clear - I have no doubts in your work, I want to understand mechanics to better implementation into my submod - I am limited in testing so I want to know at start.

    And one more question - which parameter in descr_campaign_ai_db acts to recruiting as you mention in OP?

    And how did you achieve AI not shred armies? This is one of the main problems IMO.

    My sister, do you still recall
    The blue Hasan and Khalkhin-Gol?

    Because AI is dumb and full of errors.

  11. #11

    Default Re: PiterAI Kingdoms (new CAI)

    Quote Originally Posted by bitterhowl View Post
    Thanks for the answer! One more issue - I read that this parameter acts at strat and tactical levels both. So AI may decide to attack 30 to 100 on a battlefield?
    I want to be clear - I have no doubts in your work, I want to understand mechanics to better implementation into my submod - I am limited in testing so I want to know at start.

    And one more question - which parameter in descr_campaign_ai_db acts to recruiting as you mention in OP?

    And how did you achieve AI not shred armies? This is one of the main problems IMO.
    Any type of tactics, for example: "raids" "buildup" etc. They differentiate count the recruitment priorities from the export_descr_unit file. For example, invade_immediate always trains weak units. invade_buildup the best. invade_buildup can be stupid. If the unit can be trained once every 20 turns. It will not train any army. invade_immediate does not train agents. Tutorials on SI in this forum misleading.

    On the battlefield with my SI, the opponent can set himself in a good position, not just stupidly attack. <friendly-to-enemy-strength-ratio> is . I turned it off.


    I do not want to explain it. I do not know English well.




    It is an universal SI. They can be implemented in any mod. You do not have to modify it.

  12. #12
    bitterhowl's Avatar Centenarius
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    818

    Default Re: PiterAI Kingdoms (new CAI)

    Thanks again for conversation! Can you give me the link for your sources of coding knowledge? Your achievements in invade_priority mechanics is amazing!

    And what about separate horde strat AI? (my last question, truly)

    My sister, do you still recall
    The blue Hasan and Khalkhin-Gol?

    Because AI is dumb and full of errors.

  13. #13

    Default Re: PiterAI Kingdoms (new CAI)

    I learned alone.

  14. #14

    Default Re: PiterAI Kingdoms (new CAI)

    Quote Originally Posted by Piterx93 View Post
    Any type of tactics, for example: "raids" "buildup" etc. They differentiate count the recruitment priorities from the export_descr_unit file. For example, invade_immediate always trains weak units. invade_buildup the best. invade_buildup can be stupid. If the unit can be trained once every 20 turns. It will not train any army. invade_immediate does not train agents. Tutorials on SI in this forum misleading.

    On the battlefield with my SI, the opponent can set himself in a good position, not just stupidly attack. <friendly-to-enemy-strength-ratio> is . I turned it off.
    Quite interesting, I was seeing some variations in ai recruitment depending on invade types but I wasn't sure how to explain it with my ai. Thanks. And I am gonna turn off <friendly-to-enemy-strength-ratio> like you then, to test the difference.
    I am adding your infos to my 'need to remember' tutorials collection then. Ai tutorials are based on tests, especially when it is misleading and this one make no mystery that some parameters don't match their descriptions or are tough to use with efficiency:
    http://medieval2.heavengames.com/m2t...ay/index.shtml

  15. #15

    Default Re: PiterAI Kingdoms (new CAI)

    <!--
    ////////////////////////////////////
    // Wojna //
    ////////////////////////////////////
    -->

    <decision_entry>
    <min_entry stance="AtWar" is_neighbour="false"/>
    <faction_attitude invade="invade_raids" invade_priority="10000" at_war="true" continue="true"/>
    </decision_entry>

    <decision_entry>
    <min_entry stance="AtWar" is_neighbour="true"/>
    <faction_attitude invade="invade_raids" invade_priority="8000" at_war="true" continue="true"/>
    </decision_entry>




    The most important is: is_neighbour = "false". Thanks to the fact that this command has the highest priority the opponent does not give birth to troops in many parts. is_neighbour = "false" means attack on the city because it can not be attacked in one turn. If he is to attack the city, he collects the army together and sends it to the siege. At is_neighbour = "true" SI breaks down.

    Modifications in which only is_neighbour = "true" have been entered have very silly artificial intelligence. Most have this entry.
    Kingdoms Grand Campaign does not have this. Therefore SI works well there. I think it's a coincidence, not a deliberate act. Someone has overlooked it and it has not spoiled SI.
    Last edited by Piterx93; May 15, 2018 at 03:01 PM.

  16. #16
    bitterhowl's Avatar Centenarius
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    818

    Default Re: PiterAI Kingdoms (new CAI)

    Yes, you're right - I tryed to find
    is_neighbour="false"
    in other mods and find only in Beermugcarl AI. My vote in 2017 avards is for you!

    My sister, do you still recall
    The blue Hasan and Khalkhin-Gol?

    Because AI is dumb and full of errors.

  17. #17
    bitterhowl's Avatar Centenarius
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    818

    Default Re: PiterAI Kingdoms (new CAI)

    <invade_priority_gs_modifier float="-250.0f"/>
    -250.0f - "f" here is necessary or misspelling?

    My sister, do you still recall
    The blue Hasan and Khalkhin-Gol?

    Because AI is dumb and full of errors.

  18. #18

    Default Re: PiterAI Kingdoms (new CAI)

    Quote Originally Posted by bitterhowl View Post
    -250.0f - "f" here is necessary or misspelling?
    In many CAI it is. I do not remember what it is. I set up this diplomacy from 5 years ago.

  19. #19

    Default Re: PiterAI Kingdoms (new Artificial intelligence)

    I added a new link.

  20. #20
    Razor's Avatar Licenced to insult
    Join Date
    Apr 2004
    Location
    Deventer, The Netherlands
    Posts
    3,922

    Default Re: PiterAI Kingdoms (new CAI)

    Quote Originally Posted by Piterx93 View Post
    <!--
    ////////////////////////////////////
    // Wojna //
    ////////////////////////////////////
    -->

    <decision_entry>
    <min_entry stance="AtWar" is_neighbour="false"/>
    <faction_attitude invade="invade_raids" invade_priority="10000" at_war="true" continue="true"/>
    </decision_entry>

    <decision_entry>
    <min_entry stance="AtWar" is_neighbour="true"/>
    <faction_attitude invade="invade_raids" invade_priority="8000" at_war="true" continue="true"/>
    </decision_entry>




    The most important is: is_neighbour = "false". Thanks to the fact that this command has the highest priority the opponent does not give birth to troops in many parts. is_neighbour = "false" means attack on the city because it can not be attacked in one turn. If he is to attack the city, he collects the army together and sends it to the siege. At is_neighbour = "true" SI breaks down.

    Modifications in which only is_neighbour = "true" have been entered have very silly artificial intelligence. Most have this entry.
    Kingdoms Grand Campaign does not have this. Therefore SI works well there. I think it's a coincidence, not a deliberate act. Someone has overlooked it and it has not spoiled SI.
    I'm sorry, but I'm reading your posts and my brain at times really hurts trying to understand what you're actually saying.

    So:

    What is exactly the difference between is_neighbour = "false" and is_neighbour ="true" according to your findings?
    What is SI?

    It's so frustrating, because potentially you are onto something, but you not knowing English that well renders that knowledge almost moot. That includes actually using your AI, because the descriptions of AI decision entries in your file are all in Polish.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •