Page 1 of 9 123456789 LastLast
Results 1 to 20 of 163

Thread: Better CAI "PiterAI" (smarter opponents) EB 2.4a

  1. #1

    Default Better CAI "PiterAI" (smarter opponents) EB 2.4a

    PiterAI- artificial intelligence

    To mod to work properly, please install it always as the last. If you are installing something new is good to repeat the installation.











    Installation instructions:
    unzip in your mods\EBII folder
    delete the map.rwm file within the mods\EBII\data\world\maps\base directory


    Need new campaign


    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.
    Last edited by Piterx93; February 12, 2024 at 04:21 PM.

  2. #2
    Antiokhos Euergetes's Avatar Protector Domesticus
    Join Date
    Sep 2011
    Location
    Antiokheia
    Posts
    4,273

    Default Re: New CAI/PiterAI1.0

    Thank you, I have downloaded on the recommendation of 'Mr mojo rising'

  3. #3

    Default Re: New CAI/PiterAI1.0

    Quote Originally Posted by Piterx93 View Post
    Need new campaign
    You don't need a new campaign, but you need to generate a new game in order for the changes to take effect (and generate a new map.rwm).

  4. #4

    Default Re: New CAI/PiterAI1.0

    Quote Originally Posted by QuintusSertorius View Post
    You don't need a new campaign, but you need to generate a new game in order for the changes to take effect (and generate a new map.rwm).
    True, but not for all modes so it works.

  5. #5

    Default Re: New CAI/PiterAI1.0

    Quote Originally Posted by Piterx93 View Post
    Need new campaign
    Could you please tell us Piterx93 what changes does your CAI introduce (compared to the regular one or the version 2.0)?

    If it is supposed to be more aggressive and more challenging, than those two, and the AI will really try to hold my expansion I will gladly give a try.

  6. #6

    Default Re: New CAI/PiterAI1.0

    Quote Originally Posted by AntigonosDoson View Post
    Could you please tell us Piterx93 what changes does your CAI introduce (compared to the regular one or the version 2.0)?

    If it is supposed to be more aggressive and more challenging, than those two, and the AI will really try to hold my expansion I will gladly give a try.
    Piter is not great with English..here are some of his translations from ORG...

    - A new way to move troops on the map, more effective attacks,
    - The computer can do a strong landings,
    - Better use of agents, more of their training,
    - Effectively puts the army to defend (using bridges, beards and other favorable conditions of the area),
    - Diplomacy based on a commitment to balance the factions "computer", factions are trying to forge alliances against stronger enemies,
    - Computer in certain circumstances he will ask for a room
    - Innovative preparation of war by the computer, which normally collects some time forces on the border before deciding to strike,
    - An innovative computer diplomacy based on dozens of factors,
    - New vassals system

    it may offer more challenge for some players..it gives us campaign variation which is a good thing as well.

  7. #7

    Default Re: New CAI/PiterAI1.0

    Interesting! i'm trying it!

  8. #8

    Default Re: New CAI/PiterAI1.0

    Quote Originally Posted by Dom Pedro II View Post
    Interesting! i'm trying it!
    its good ,

  9. #9

    Default Re: New CAI/PiterAI1.0

    Will give it a try too! Would you recommend H or VH campaign difficulty?

  10. #10

    Default Re: New CAI/PiterAI1.0

    Quote Originally Posted by QKuhlmann View Post
    Will give it a try too! Would you recommend H or VH campaign difficulty?

    I think that normal also will not get bored. On a very hard diplomacy will be very aggressive.

  11. #11
    The Unknown General's Avatar Centenarius
    Join Date
    May 2011
    Location
    The Killing Fields
    Posts
    832

    Default Re: New CAI/PiterAI1.0

    Is this compatible with the new BAI released by the team?





  12. #12

    Default Re: New CAI/PiterAI1.0

    Quote Originally Posted by The Unknown General View Post
    Is this compatible with the new BAI released by the team?
    Yes, but I would prefer to file config_ai_battle

    <friendly-to-enemy-strength-ratio>1.0</friendly-to-enemy-strength-ratio>

    changed to:

    <friendly-to-enemy-strength-ratio>0.5</friendly-to-enemy-strength-ratio>

    Conquering the rebellion will be much better. Generally AI will work better.

  13. #13

    Default Re: New CAI/PiterAI1.0

    Why can not I edit posts?

  14. #14

    Default Re: New CAI/PiterAI1.0

    Ver 1.1

    http://ge.tt/7ldXszt1/v/0

    With a modified file: config_ai_battle

  15. #15

    Default Re: New CAI/PiterAI1.0

    Ver 1.1

    http://ge.tt/13Ah2ku1/v/0

    With a modified file: config_ai_battle

    bad Link

  16. #16
    Antiokhos Euergetes's Avatar Protector Domesticus
    Join Date
    Sep 2011
    Location
    Antiokheia
    Posts
    4,273

    Default Re: New CAI/PiterAI1.0

    Thank you very much, if I ever get to test for more than a few minutes I will report

  17. #17

    Default Re: New CAI/PiterAI1.0

    Thank you for the information! Will retry with (H/N) and your latest version. By the way: You can't edit, because you have posted less the 25 posts. General TWC rule. Same with me.

  18. #18

    Default Re: New CAI/PiterAI1.0

    Ok, I am now 50 Turns in an Areaukai Campain on H/M with the latest version of your CAI. Generally there is much action on the map with alliances and serveral new wars. Only the far east is quite peaceful. Worldmap looks like this:


    gratis bilder hochladen

    Fo myself I can say that you were right with the agressiveness of the KI: I was backstabbed by the Lusotannians, who were my allies, in round 25, and am in a fight for pure survival since then. Though this is very challenging I don't like the thought, that you can not trust your allies. (On the other hand, with the other Versions of the CAI it was to easy to get a trustworthy Alliance even with poor relations.

    Also examined, that Karthago ws betrayed too by the Massylians. When I went from turn 50 to 62 this morning (just pressing the button) this happend:
    Im Round 50, Karthago and the Massylians were Allies. In Round 62 you have this Situation:


    Bilder hochladen

    So, I think, with hard difficulty tis CAI is to agressive for my taste and Alliances seem to be not trustworthy at all. So, I will stop this now and retry with medium difficulty, as you recommended. Looking forward to that!!

  19. #19

    Default Re: New CAI/PiterAI1.0

    I do not understand what you expect after alliances. This is medieval2, no europe universalis.Alliances includes up against common enemies, and not for fun. Each faction wants to conquer new territories. If there is no common foes alliance reduces the chance of invasion. But does not eliminate it.

  20. #20

    Default Re: New CAI/PiterAI1.0

    Now tried your CAI whith M/M and the same thing happened again. Lusotannians as an allie attacked in Round 25. Before that, no other war was declared by any faction in the whole game. I think, it's just a matter of personal taste (amd also a common issue in TW modding) . It is ok for me, that alliances are broken from time to time, but they have to mean something. I would like them to be harder to gain (for example only with good relationships) and then to be quite stable. In my two games, Lusotannians could have chosen to conquer more Rebel territories or to attack Karthago, to whom they were not allied. Instead of that, they decided to attack me at an early time of the game. For me, such AI-behavior makes the alliance system quite pointless.
    In EB, other than in vanilla MTW, it is very time consuming and expensive to build up a decent infrastructure. So I think, a more peaceful early game like in V2, that gives you time to build up before going to war, fits better in this kind of mod. Of course, other players may prefer more action right from the start. But this is just not my style of playing. So I think I'll switch to V2 CAI again. This of course means no offence! I think it's good to have some alternatives in CAI style, so that everybody can have a suitible gaming expierience.

Page 1 of 9 123456789 LastLast

Tags for this Thread

Posting Permissions

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