Results 1 to 28 of 28

Thread: The algorithm of least astonishment

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Village special needs person Member Kobal2fr's Avatar
    Join Date
    Nov 2006
    Location
    Paris, France
    Posts
    914

    Default Re: The algorithm of least astonishment

    Quote Originally Posted by ElectricEel
    I have read in the discussions about the AI files that the AI is apparently hardcoded to attack the player if the player is at peace for too long, without regard for the current in-game situation. The lenght of time depends on the campaign difficulty level - if I remember correctly, 4 turns at Very Hard, 20 turns at Easy.
    That's not true. The only thing there is is a comment (to non code savvy folk out there, that means a bit of code that is not processed, where the codewriter says what he wants his code to do or explains why it works) saying "special case exists here in code for forcing aggression on player if at peace with everyone for N turns", but that's it, there's no actual code for this. Just the comment to tell people "if you want to do this, here is where you'd put the relevant code".

    As to the rest...

    Dopp is (as always, it seems :) ) right in saying the apparently weak invasions are actually raids, disruption fodder sent because said faction is too weak to do anything else, but not wanting to bend over either. As katank points out, it's counterproductive through naval invasions most of the time, since ships are costly, but on land it works just fine. If it irritates you, the player, and cuts off one city for even one turn (or cuts trade between cities and forces you to sally to crush them) then mission accomplished .

    But naval invasions do bork the AI a lot, and the worst thing is that whatever CA did to enable them, it's hardcoded and we can't touch it, neither to make them go away or just to tweak them into working more sensibly :/
    Anything wrong ? Blame it on me. I'm the French.

  2. #2
    Confiscator of Swords Member dopp's Avatar
    Join Date
    Jun 2005
    Posts
    702

    Default Re: The algorithm of least astonishment

    Quote Originally Posted by Kobal2fr
    But naval invasions do bork the AI a lot, and the worst thing is that whatever CA did to enable them, it's hardcoded and we can't touch it, neither to make them go away or just to tweak them into working more sensibly :/
    You might try adding "force_invasion = false" to everything for your diplomacy mod, Kobal2fr. That may effectively neuter the naval invasions as they seem to be classified as "forced" (ie hardcoded) invasions.

  3. #3
    Village special needs person Member Kobal2fr's Avatar
    Join Date
    Nov 2006
    Location
    Paris, France
    Posts
    914

    Default Re: The algorithm of least astonishment

    @dopp : nah, that would stop the AI from invading, ever. cannot_force_invade is the "sit down, shut up, read a book or sumtink" AI function :)
    Right now I've merely disabled all raids except when the factions are already at war (I figure a weak faction wouldn't want to draw too much attention anyway), and removed the "don't care for factions we don't share a border with, want peace" factor since it is obvious now that they *do* care, even though I don't understand how and why :)
    But first the antitrait thingamajig, then X-mas derailed my tests, and now my comp itself is acting up (fan problems, overheating, BSOD's, the works...). Patience :)

    @Vladimir : sure, but Jinettes cost a mint to produce and upkeep, while x-bows are cheap.
    Anyway, I do agree with you, but that's not something I can mod directly, what the AI does with a given order is all hardcoded as far as I know, we can just fiddle with the orders themselves, and the descr_strat army preferences :/
    And in any case, unless you really know what you're doing, sending a weak force against a big stack will not result in a weaker big stack, but only a dead weak force. The more lopsided the odds, the less losses for the big guy, unless you're all about HAs. Thus, given that the AI cannot handle raids properly (I can't tell it to only use HAs or skirmishers for raids, it just uses troop cost from what I can see. The AI seems to assume a 300 florins unit will beat a 200 florins one, period), I think it's better to do away with them alltogether...
    Anything wrong ? Blame it on me. I'm the French.

  4. #4
    Guardian of the Fleet Senior Member Shahed's Avatar
    Join Date
    Oct 2002
    Location
    Leading the formation!
    Posts
    7,918

    Default Re: The algorithm of least astonishment

    It would be great to see faction specific raiding mechanics for the AI. For obvious example the Mongols raiding their borders incessantly. Akinci corps raiding enemy borders for Turks.
    If you remember me from M:TW days add me on Steam, do mention your org name.

    http://www.steamcommunity.com/id/__shak

  5. #5
    Village special needs person Member Kobal2fr's Avatar
    Join Date
    Nov 2006
    Location
    Paris, France
    Posts
    914

    Default Re: The algorithm of least astonishment

    Hmmm, while I can't tell them "use such and such units", I *can* let some factions raid and others not. This is a very good idea you have Sinan : Turks, Rus, Hungarians, Mongols, all have low-value HAs that they can build easy and en-masse and would probably use with a raid order. I'll keep this in mind.

    The other problem there would still be with raids of all kinds is that 1) against another AI, the battle will be autocalc'd : full HA army advantage is completely lost, and 2) against a human, the AI "forgets" the raiding intention on the battlefield : even with a small, all HA force, the AI will play to the death, not just empty quivers and run away.
    TBH, it can probably be coded to do so in the battle strat xml, but that file is hairy to say the least and I haven't tried to figure it out yet.

    I wonder, did the big mods like Europa Barbaorum, Rome Total Realism etc... feature improved AIs ? Because if that's the case, it might be simpler/faster to just borrow their ideas and work on an already improved basis.
    Anything wrong ? Blame it on me. I'm the French.

  6. #6
    Member Member ElectricEel's Avatar
    Join Date
    Dec 2005
    Location
    Finland
    Posts
    175

    Default Re: The algorithm of least astonishment

    I wonder, did the big mods like Europa Barbaorum, Rome Total Realism etc... feature improved AIs ? Because if that's the case, it might be simpler/faster to just borrow their ideas and work on an already improved basis.
    The AI logic itself was not modifiable in RTW, though some improvement was possible by modifying the formation files and changing the game enviroment to better suit the AI.

  7. #7
    Enlightened Despot Member Vladimir's Avatar
    Join Date
    Aug 2005
    Location
    In ur nun, causing a bloody schism!
    Posts
    7,906

    Default Re: The algorithm of least astonishment

    Quote Originally Posted by Kobal2fr
    Dopp is (as always, it seems :) ) right in saying the apparently weak invasions are actually raids, disruption fodder sent because said faction is too weak to do anything else, but not wanting to bend over either. As katank points out, it's counterproductive through naval invasions most of the time, since ships are costly, but on land it works just fine. If it irritates you, the player, and cuts off one city for even one turn (or cuts trade between cities and forces you to sally to crush them) then mission accomplished .
    I can't see any reason why someone would send a unit of pavaise crossbowmen on a raid. That's the absolute worst unit to send on a raid; especially since in that example the raider was Spain and they have Jinettes! Personally I’m all about the raid, I love sending a 5 unit raiding party of mounted X-bows (in M:TW) against someone if I’m just trying to soften them up. I just don’t understand why the (incredibly) AI would send a slow ranged unit on a raid. Raids require speed!
    Last edited by Vladimir; 12-26-2006 at 14:54.


    Reinvent the British and you get a global finance center, edible food and better service. Reinvent the French and you may just get more Germans.
    Quote Originally Posted by Evil_Maniac From Mars
    How do you motivate your employees? Waterboarding, of course.
    Ik hou van ferme grieten en dikke pinten
    Down with dried flowers!
    Spoiler Alert, click show to read: 



  8. #8
    Member Member ElectricEel's Avatar
    Join Date
    Dec 2005
    Location
    Finland
    Posts
    175

    Default Re: The algorithm of least astonishment

    That's not true. The only thing there is is a comment (to non code savvy folk out there, that means a bit of code that is not processed, where the codewriter says what he wants his code to do or explains why it works) saying "special case exists here in code for forcing aggression on player if at peace with everyone for N turns", but that's it, there's no actual code for this. Just the comment to tell people "if you want to do this, here is where you'd put the relevant code".
    Oh? I understood the comment to mean 'for the information of those modding this file, the code that handles AI logic does this', rather than how you interpret it. But you probably have followed the AI modding discussion more closely than I.

  9. #9
    Village special needs person Member Kobal2fr's Avatar
    Join Date
    Nov 2006
    Location
    Paris, France
    Posts
    914

    Default Re: The algorithm of least astonishment

    Could be either all other things being equal, but in the "mapping of old Rome params" at the end of the file, which is the template for the new AI, there are also a bunch of these "SPECIAL CASE EXISTS HERE IN CODE FOR SUCH AND SUCH" comments. There's one in the beginning in particular, saying "special case here for not allowing attack of trusted allies". In the code used by the game, the comment does not appear, and in it's place ... is a condition (not appearing in the old code) forcing the AI not to attack its trusted allies.

    Which is what leads me to believe that all those special cases comments are just that : a "blueprint" for what could/should be done and where to put it so that it works, and not an explanation of what happens elsewhere (after all, I'd assume CA people working on the files would already know, or would easily find out what happens elsewhere, even though my work on the traits left me with some doubts regarding this :) ).
    Anything wrong ? Blame it on me. I'm the French.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO