Announcement

Collapse
No announcement yet.

Frenzy AI revisited (v 2.1)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Frenzy AI revisited (v 2.1)

    A long time ago Pedrunn posted a revised version of "Frenzy AI". It contains the major improvement of determining the AI's 'worst enemy' by diplomatic regard rather than minimal distance to the target . As this version has been posted rather humbly in a thread dealing with something different (IIRC) it seems not having been noticed too well. However - I did what I consider some additional tweaking (or messing up ) the code and added another function: 'TaskOne: Recapture'.

    here it is for testing

    It doesn't require anything but being #include(d) at the bottom of script.slc (or ***_script.slc for most of the Mods around except for the Super Apolyton Pack: there it needs to be #include(d) in APOL_main.slc to replace APOL_frenzy.slc). One additional note that can also be found in the comments: As a bunch of "terrain and unit checking functions" is taken from BetterAI/GoodMod you need to be careful not to interfere with existing functions if you wish to use Frenzy 2.1 together with BetterAI/GoodMod.

    The script throws SLIC-errors with DebucSlic=Yes caused by IsUnderseaCity(), so you need to change DebugSlic to 'No' in userprofile.txt. The error message does not indicate inappropriate use of the function, but buggyness of the debugger .
    Last edited by BureauBert; June 30, 2004, 14:27.
    The modding knowledgebase: CTP2 Bureau (with CTP2 AE Modding Wiki). Modern Times Mod (work in progress): MoT-Mod for CTP2.

  • #2
    This is not a reply to self but a reply to Solver's question in the other thread :
    Bert, how safe do you imagine is that Frenzy code? That is, does it provide a real improvement to AI (as intended and, to a degree, it worked), but without the problem of never going to peace once it attacks?
    In terms of stacking and moving armies towards a selected enemy's cities it does basically the same as Frenzy 1.x, Pedrunn also added a similar navy code. The major improvement Pedrunn introduced is that the AI will select it's 'worst enemy' by diplomatic regard and it will not simply move its 'frenzy armies' towards the nearest HUMAN's cities. More detailed: Basically the player with the lowest effective regard will be an AI's worst enemy, if the regard towards all 'regular' civs is greater than 500 (this could probably be tweaked - 'hot war' level is 100) good old barbs will be the AI's worst enemy. The AI will then stack and move their frenzy armies (navies) towards their worst enemy's MostAtRiskCity. The AI will re-select their worst enemy and re-task their armies each turn. Therefore they will stop throwing their armies against another player's targets if this player could manage to increase his regard by diplomatic means, they will attack their new 'worst enemy's' targets instead (the barbs if all other players are above 500 in regard).
    Another thing I'm pondering is city attack focus, sometimes maybe the AI hesitates a bit in attacking cities...
    Another improvement (also by Pedrunn, he really merits the main credit for this script - I am more or less just republishing it): The AI's 'frenzy armies' will not only attack cities but also other armies/units they encounter on their way.
    An additional experiment added by myself: TaskOne: Recapture. If a city is taken (and is not an undersea city, that's what throws those unnecessary SLIC-errors) the AI will do it's best to recapture that city, specially if the city has been the capital.

    When I had nearly all SLIC working for my over-SLIC'ed modding project I had the impression that this script works pretty well. At least I could see AI's armies consequently attacking not only myself but other AI's, too. And I am pretty sure they did it with their 'frenzy armies' since they threw one, two, three armies against one of their 'worst enemy's' cities and these armies continued moving towards another of their 'worst enemy's' cities once they had conquered a city.

    One problem is that a frenzy army stays 'frenzy' as long as it stays valid (alive) and continues moving towards the next target selected. Therefore the conquering frenzy army will not garrison the conquered city and it will transform from a 'frenzy' to a 'harakiri'-army by the time. This is an aspect I should eventually take care of.

    But actually in my project it is somtimes difficult to tell which AI-AID-script does exactly what since I am aiming to collect, modify and integrate into a consistent framework most of the well-known scripts around (apart from adding some own stuff eventually ). As for AI tactics I am among others also using Martin Gühmann's BetterAI code and Locutus' ClearOrders script experimenting with applying different tactical concepts during different stages of the game resp. in different situations. I have listed all scripts I am trying to integrate so far here .

    Concerning the 'frenzy'-part: My idea is using this tactics in later stages of the game when more units are around and the AI already manages to stack them thanks to BetterAI. In this situation the 'frenzy' armies should really just form the most efficient conquering forces to maintain major campaigns against selected targets. With more armies around as 'backup forces' e.g. the problem of 'frenzy' armies not caring for keeping the conquered cities should become somewhat less important (but this aspect should be covered in a 2.3-version nonetheless).

    For the moment I'd like to get the present version out of beta-stage and therefore I'd be glad if more people would like to test this script since I believe that it has its merits and can still be improved and used in some context with other AI-tactics.
    The modding knowledgebase: CTP2 Bureau (with CTP2 AE Modding Wiki). Modern Times Mod (work in progress): MoT-Mod for CTP2.

    Comment


    • #3
      Originally posted by BureauBert
      One problem is that a frenzy army stays 'frenzy' as long as it stays valid (alive) and continues moving towards the next target selected. Therefore the conquering frenzy army will not garrison the conquered city and it will transform from a 'frenzy' to a 'harakiri'-army by the time. This is an aspect I should eventually take care of.
      And this is the greatest flaw of Frenzy as it stands now.

      I'll be interested in seeing how this code plays once this issue is fixed. I tend to like the aspect of AI forces generally focused on the human player, because it is a challange. From what I have seen in Cradle games (using the old Frenzy) the AI will often engage in AI/AI battles and cities will trade hands even when there are no human cities in the area.

      Still this looks promising, especially in regards to getting the AI to have a more focused military expansion program.
      Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
      ...aisdhieort...dticcok...

      Comment


      • #4
        I'm going to test that, sounds very good. I have had a situation last night when I took two English cities, but they had far larger military. OK, they eliminated my attack force, put 40 Tanks outside Liverpool, and only attacked it with its two defensive units several turns later...

        Anyway, an AI that retakes cities is always better. And while I agree with Hex that focusing on human player gives the challenge, but I really dislike it when the AI does so. It doesn't give the same feeling when AIs gang up on you - it's so Civ2, when you play a game against n AI civs. I want to play a game where the AIs actually fight among themsleves as well, so I certainly will love increased AI focus on any enemy.

        While waiting for 2.3... this will be a welcome addition to my playtesting games .
        Solver, WePlayCiv Co-Administrator
        Contact: solver-at-weplayciv-dot-com
        I can kill you whenever I please... but not today. - The Cigarette Smoking Man

        Comment


        • #5
          Something I need to post, my two desires for an AI script. Just wishes, but can't resist posting .

          1. Air unit stacking. Sometimes the AI will attack your air units with his air units, or your ships with planes, but it doesn't seem to stack Bombers with other Bombers or other planes. This shouldn' be *too* hard to implement.
          2. Hard to implement, but a definite wish - invasions overseas. AI does build and send transport ships, that's good. Sometimes it sends empty ships - what for? And sometimes it won't load em with proper units, like sending just 1 cavalry in a troop ship. Another time he will do it fine and send 5 Tanks. Anyway, a desire for a script that would let AI coordinate assaults overseas would be great. Note that it has some of that funcionality with Martin's AI files, but he never published another of the AI scripts he was working for.
          Solver, WePlayCiv Co-Administrator
          Contact: solver-at-weplayciv-dot-com
          I can kill you whenever I please... but not today. - The Cigarette Smoking Man

          Comment


          • #6
            Originally posted by Solver
            Anyway, a desire for a script that would let AI coordinate assaults overseas would be great. Note that it has some of that funcionality with Martin's AI files, but he never published another of the AI scripts he was working for.
            So should I post it? The script work very well if the AI should just conquer its continent, of course it prevents the AI of conquering more cities then its government can support. It makes the AI to take undefended cities. Well for the air units I took Peter's air units script.

            The only problem is that the cross water invasion stuff doesn't work as supposed, I get the units into the ships but my way to figure out the cargo size doesn't work and at that time the source code was released and I had and still have to do other things as well.

            -Martin
            Civ2 military advisor: "No complaints, Sir!"

            Comment


            • #7
              I definitely thing you should post it. In my spare time, I am playtesting the game with the latest build, and I always want a good AI . Besides, modern age is my favorite part of the game, and that's where the ability to stack air units or launch a surprise attack with even one troop ship is crucial.

              Currently, if no AI is on my landmass, I know I'm safe in modren even with one Infantryman in each city - the AI just won't drop many forces.

              What's your problem exactly with cargo size? You get the units in ships and what? You can't determine if it's full, or? Hmm, maybe we need a CargoSize() SLIC function added .

              Anyway, I'd be glad if you posted the script so I could add it to my playtest config.
              Solver, WePlayCiv Co-Administrator
              Contact: solver-at-weplayciv-dot-com
              I can kill you whenever I please... but not today. - The Cigarette Smoking Man

              Comment


              • #8
                And something I need to say on what just happened.

                I nuked an AI city, and got three nukes in return, through MAD. That was great. And I was just wondering why some of AI nukes are sitting in cities doing nothing... either a good nuke script somewhere, or a built-in function...
                Solver, WePlayCiv Co-Administrator
                Contact: solver-at-weplayciv-dot-com
                I can kill you whenever I please... but not today. - The Cigarette Smoking Man

                Comment


                • #9
                  Originally posted by Solver
                  And something I need to say on what just happened.

                  I nuked an AI city, and got three nukes in return, through MAD. That was great. And I was just wondering why some of AI nukes are sitting in cities doing nothing... either a good nuke script somewhere, or a built-in function...
                  This should answer it:

                  strategies.txt
                  NuclearFirstStrike: Disabled
                  NuclearTargeting: Enabled
                  Originally posted by Solver
                  What's your problem exactly with cargo size? You get the units in ships and what? You can't determine if it's full, or? Hmm, maybe we need a CargoSize() SLIC function added.
                  My current hack function doesn't work therefore the ships are considered as empty and in that case the script tries to keep the AI's ships at its coast to fill them with units.

                  -Martin
                  Civ2 military advisor: "No complaints, Sir!"

                  Comment


                  • #10
                    I think you should post the script nonetheless. Then, someone like BureauBert might be able to improve on it - an amphibious invasion script would be a fantastic thing.
                    Solver, WePlayCiv Co-Administrator
                    Contact: solver-at-weplayciv-dot-com
                    I can kill you whenever I please... but not today. - The Cigarette Smoking Man

                    Comment


                    • #11
                      Oh there, I went to the source and wanted to add functions to figure out how many units a transport is carrying, and noticed that you already have implemented those .

                      That definitely means that you got to release the script, and with some editing it will do what it's supposed to. Especially if it's ready in everything except being able to tell how many units are carried.
                      Solver, WePlayCiv Co-Administrator
                      Contact: solver-at-weplayciv-dot-com
                      I can kill you whenever I please... but not today. - The Cigarette Smoking Man

                      Comment


                      • #12
                        Well after the part sending the ships to the target I don't know whether the ships can reach teh target and I don't know either if the ships are at their target the units inside the ship are placed at the land. So far in the script testing I had to test every peice of code to make sure that it does what I want it should do.

                        Well I also added some other things to the game to reduce the complexity of the script for instance a GetContinentID function and I also added the government array by Peter to make it a little bit easier to figure out the current government of the player, and also a cargo capacity function for the ships and another cargo left function, and also some globals to know how many players in the game are.

                        -Martin
                        Civ2 military advisor: "No complaints, Sir!"

                        Comment


                        • #13
                          Now, bear in mind that I haven't modded CtP2... but are the parts you describe there necessary at all? I mean, the current CtP2 AI (at least with other mods) certainly does have troop ships that will reach your continent, and they will unload as well. The problem is that most ships are empty or loaded with 1-2 units - a problem that your script seems to address among other things.

                          So to summarize - once ships are loaded and sent (your script), shouldn't the already existing AI take over anyway to get to wherever it's going and unload?

                          Just post the script . Someone will certainly improve it at some point, and I'll add it to my CtP installation for testing anyway.
                          Solver, WePlayCiv Co-Administrator
                          Contact: solver-at-weplayciv-dot-com
                          I can kill you whenever I please... but not today. - The Cigarette Smoking Man

                          Comment


                          • #14
                            Originally posted by Solver
                            Now, bear in mind that I haven't modded CtP2... but are the parts you describe there necessary at all? I mean, the current CtP2 AI (at least with other mods) certainly does have troop ships that will reach your continent, and they will unload as well. The problem is that most ships are empty or loaded with 1-2 units - a problem that your script seems to address among other things.

                            So to summarize - once ships are loaded and sent (your script), shouldn't the already existing AI take over anyway to get to wherever it's going and unload?
                            The problem is that the script should send the ships when they are full, and I cannot determine this yet. The result is that the ships are not send but are kept at the coastline of the attacking civilization, so you can go to that coast with your battle ships and make that the enemy transports sink before they can reach your coast. Another feature of this script is to move the ships to the enemy's coast in a group and unload them at the same time, so that you have the AI has the full power on the other continent.

                            -Martin
                            Civ2 military advisor: "No complaints, Sir!"

                            Comment


                            • #15
                              OK, that all sounds good. Determening when the ships are full is easy with the new SLIC functions, so I can't see why wouldn't you post the script so someone could improve it and get it it completed, like Bert, as said!

                              Come on, do so .
                              Solver, WePlayCiv Co-Administrator
                              Contact: solver-at-weplayciv-dot-com
                              I can kill you whenever I please... but not today. - The Cigarette Smoking Man

                              Comment

                              Working...
                              X