Announcement

Collapse
No announcement yet.

Questions about Frenzy code

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

  • Questions about Frenzy code

    From what I have read, the frenzy code gathers up the AIs units into armies, and moves them to the borders of your civ whenever war is declared. Is this correct, and is this all that it does?

    If this is all, then it would seem to hurt a weaker AI, who could not use those units for defense, and even with a stronger AI I think they would attack anyway if they are on the same continent as the human.
    If the frenzy code can get the AIs to launch credible amphibious invasions, though, then that indeed would be a big score in its favor.
    I have never played with the frenzy code, so general observations on it are also welcome.
    I am working on an update to Crusade, and I would like to know if this code is worth implementing and why.

    Btw, I was going thru the strategies.txt, lowering the time to fix pollution, and saw that the setting was missing from the diplomatic AI. This may account for why some civs don't clean up their pollution.

    Also, anyone who has played with the AI able to terraform, please give me evaluations on how they handled it. Usually, if an AI ability is coded into the game, but "turned off" like this one was, it means that the AIs could not intelligently handle the ability. I am thinking about putting this up as a beta after I get the update released.

  • #2
    If the AI can handle sea battles, carriers, etc, then it might be possible to design a great WWII Pacific War scenario.

    The inability of the AI in CivII to use carriers properly, really hindered this type of scenario. . .

    Comment


    • #3
      I do play with frenzy, but not in craddle (In my mod). So I have made some changes in the code to fit into my mod like add my special units and increase the AI hate increase over the time. And I do see some big AI Stacks walk around frequently. I just dont know how different from the Original Game it is.
      "Kill a man and you are a murder.
      Kill thousands and you are a conquer.
      Kill all and you are a God!"
      -Jean Rostand

      Comment


      • #4
        Re: Questions about Frenzy code

        Originally posted by WesW
        Also, anyone who has played with the AI able to terraform, please give me evaluations on how they handled it. Usually, if an AI ability is coded into the game, but "turned off" like this one was, it means that the AIs could not intelligently handle the ability. I am thinking about putting this up as a beta after I get the update released.
        Actual it is a question if they just disabled the possibility of terraforming for the AI or if they had just no time to finish it. So far the only problem is preventing the AI from terraforming goods but I already offered a slic sollution.

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

        Comment


        • #5
          Guys, any comments here?

          Comment


          • #6
            Re: Questions about Frenzy code

            From what I understand (without having studied the issue in detail), the Frenzy code from Cradle is a bit different from the one BlueO originally made, it's far less destructive to the AIs. Dave and some other people might know more about that than me though...

            Originally posted by WesW
            From what I have read, the frenzy code gathers up the AIs units into armies, and moves them to the borders of your civ whenever war is declared. Is this correct, and is this all that it does?
            What it appears to do, is to find for all AIs an army which is can be used for a Frenzy attack and the human city that is closest to this army (so the army can be sent to a tile right next to this city). Armies used for this are armies which fortify outside a city and which are of the right size (what size this is depends on the 'hatelevel' the AI has towards the human). While the armies are moving towards their target, they also group with other units along the way to form larger armies, but this only happens outside cities and with combat units (so no settlers or anything).
            If this is all, then it would seem to hurt a weaker AI, who could not use those units for defense, and even with a stronger AI I think they would attack anyway if they are on the same continent as the human.
            AFAICS, it only uses armies that fortify outside cities, armies who apparently don't have anything useful to do anyway. So the drain on defense is minimal, in most cases. And of course, don't forget that offense is often the best defense (this wasn't the case in the original Frenzy code but as I said, the Cradle version is a little more sophisticated).
            If the frenzy code can get the AIs to launch credible amphibious invasions, though, then that indeed would be a big score in its favor.
            This code is certainly equipped to make the AI use it's navy in an aggressive fashion but there's no code specifically designed for making AIs use transport ships or anything, so I don't know how much it really helps for amphibious invasions.
            I have never played with the frenzy code, so general observations on it are also welcome.
            Well, Cradle changes a lot more than just Frenzy of course, but Cradle's AI does a really good job both in offense and in defense, part of this no doubt because of Frenzy.
            I am working on an update to Crusade, and I would like to know if this code is worth implementing and why.
            Adapting the code for Crusade wouldn't be terribly much work so I say it's certainly worth a try...

            Btw, I was going thru the strategies.txt, lowering the time to fix pollution, and saw that the setting was missing from the diplomatic AI. This may account for why some civs don't clean up their pollution.
            That's cool.

            Also, anyone who has played with the AI able to terraform, please give me evaluations on how they handled it. Usually, if an AI ability is coded into the game, but "turned off" like this one was, it means that the AIs could not intelligently handle the ability. I am thinking about putting this up as a beta after I get the update released.
            I haven't yet (not much anyway), so I can't help you here.
            Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

            Comment


            • #7
              Wes,

              Locutus pretty much summed up the Frenzy setup in Cradle. BlueO had released a weakened version of Frenzy, which is the base that I used in Cradle. If you look at the in-code notes/readme, you will see what BlueO did. The most important thing, IMO, is he does have different levels of Frenzy that can be adjusted within the code - so Suicidal Frenzy can be pushed back to the late game.

              There are still some things I would like to have addressed - the most pressing one is that when an AI takes a city from a human, sometimes it will vacate that city as it continues to press on, but the Building Destruction SLIC code is a nice counterbalance - retake the city and it is gutted...

              However, in Cradle, the AI defenses do stay strong. And Frenzy does do one thing very nice - it brings multiple civ armies into your territory (almost like having a knife over your head) I don't know how many times I planned an assault in Cradle and had some other civ attack my cities when my forces were abroad...and this is good. You do have to have a high setting for SEIGE and ATTACK in strategy.txt so that those armies will be more of a threat too.

              One thing that I am glad to see that you did for your MedMod update is to boost the settings in DiffDb. I have been making that suggestion for a long time now.

              It seems that you already have Frenzy as an option in MedMod, but I would suggest making that option as an official ModSwapper entry (a nice feature of Modswapper) so that players can pick and choose easily.

              It is good to see you back here too.
              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


              • #8
                Although I've glanced at the Frenzy code before, I'd never actually gone over it line by line until today. Here's some of the things I found:

                1) It's no good for Multiplayer: In 'FAI_set_AttackTarget' the targets that the AI civs are aiming at are set at the end of a Human player's turn. If there's more than one Human player, these targets will be constantly changing and the AI's armies will mostly wander aimlessly.


                2) In 'FAI_Initialization' the following is supposed to happen before the game starts (pre the Barb's beginturn):

                Code:
                            i = 0;
                		while (i <= FAI_MAXPLAYERS) {	// try all possible players 
                			player[1] = i;
                			if (player[1].units > 0){ //true when i=1
                				GetArmyByIndex(player[1], 0, tmpArmy);
                				i = FAI_MAXPLAYERS; // break the loop
                			}
                			i = i + 1;
                		}
                            for (i = 0; i <= FAI_MAXPLAYERS; i = i + 1) {	
                			FAI_PlayerAge[i] = 1;	//these work
                			FAI_HateLevel[i] = 0;
                			FAI_FirstArmy[i] = tmpArmy;      //the Human's settler?
                			FAI_SecondArmy[i] = tmpArmy;     //the Human's settler?
                			FAI_AttackTarget[i] = tmpArmy.location;  //ditto
                		}
                But at this point in time, no-one's got any proper armies, just settlers. So as I see it tmpArmy is either going to be the invalid one or an army that contains a settler.

                3) In 'FAI_New_Age' there's a problem in the bits that go:

                Code:
                     for (i = 1; i <= FAI_MAXPLAYERS; i = i + 1) {
                          if(IsHumanPlayer(player[0]) && FAI_HateLevel[i] <= 25) {		
                	         FAI_HateLevel[i] = FAI_HateLevel[i] + 5;
                	    }
                     }
                It's necessary to check "IsPlayerAlive(i)" because FAI_MAXPLAYERS is set to 31. So presumably the FAI_HateLevels weren't being incremented properly, but this is fairly benign.

                4) The handler 'FAI_hate_level_city_capture' is set to run "post", after a city's been captured. But consider:

                Code:
                     if (IsHumanPlayer(tmpInvader) && !IsHumanPlayer(tmpCity.owner) && FAI_Init == 1000) {
                		FAI_HateLevel[tmpCity.owner] = FAI_HateLevel[tmpCity.owner] + 7;
                Since the city has been captured, tmpInvader==city[0].owner and the condition will never be fufilled.

                5) In 'FAI_hate_level_city_nuke', there's a similar condition involving player[0]. But there is no player[0] passed by this event.


                Those are are fairly minor, but now there's some bigger ones:

                7) The function 'FAI_AttackEvaluateLocation' is supposed to return the direction of a Human city or unit adjacent to tmpLoc (=evalLoc), the location being evaluated. But:

                Code:
                     for (i=0; i<=7 ; i=i+1) {		
                          GetNeighbor(tmpLoc, i, tmpLoc);
                should be

                Code:
                     for (i=0; i<=7 ; i=i+1) {		
                          GetNeighbor(tmpLoc, i, nextLoc);
                in order to 'look around' the tmpLoc tile. The former code does a sort of "ramdom walk".

                7) The function 'FAI_CheckGroupage' returns 0 if the location of the army being checked is either a city or also has various civilian units on it. This is fine for early warfare but doesn't allow for planes, which could be captured by the grouping and probably run out of fuel.

                8) The biggest problem is with the Handler 'FAI_set_AttackTarget'. This is supposed to find the nearest Human city to the AI's designated attacking army:

                Code:
                     for(j = 0; j < player[0].cities; j = j + 1) {
                	   GetCityByIndex(player[0], j, tmpCity);
                	   tmpDistance = Distance(tmpCity.location, FAI_FirstArmy[i].location);
                	   if (tmpDistance < minDistance && !IsUnderseaCity(tmpCity)) {
                	        if(IsContinentBiggerThan(tmpCity.location, tmpDistance) 
                              && IsContinentBiggerThan(FAI_FirstArmy[i].location, tmpDistance)) {
                		       GetRandomNeighbor(tmpCity.location, tmpLoc);
                			 FAI_AttackTarget[i] = tmpLoc;
                			 minDistance = tmpDistance;
                	        }
                	   }
                     }
                The second argument of "IsContinentBiggerThan" is supposed to be an area not a distance, but even if you were to put in
                tmpDistance*tmpDistance, it still wouldn't necessarily work. I think that what he was trying to get at is "Can we attack them by land?" but SLIC has very sparse geographical vocabulary and I don't know how to express this. The above code will have unpredictable results: sometimes it'll work, sometimes not.

                That's the point at which I realized that it would be hard work to fix this and so stopped looking. There's probably more problems to be found.


                So given that this program is ridden with bugs, how come nobody's noticed? I think that the changes Dave made to Strategies and Goals are probably just as, if not more, important in making Cradle's AI agressive than the Frenzy code.

                Comment


                • #9
                  Great work, Peter. Perhaps all this can be fixed. It is certainly good to know about it.

                  Comment


                  • #10
                    Frenzy & WAW

                    I used Cradle's frenzy and strat/goal/diffdb/const.txt's for a base in World At War. I did change a few things to suit the more specific era of the MOD, ie: frenzy only uses the third frenzy level (modern era of the original script).

                    I've found that the AI is very good at defending/attacking now. I believe it's more to do with the txt files than frenzy. I think frenzy is just "getting the ball rolling" for the AI.

                    In my latest game yesterday (with the progressing 1.02 WAW), it was up to about turn 150. The AI and I all had marines/early tanks/fighters/M2 artys as our top units. I'd conquored one Civ in a 100 turn war to secure my continent, and in the process of that had ended up in a sub/battleship skirmish war with an AI on the next continent. After mopping up the first civ I amassed 3 stacks of 4/4/4 marines/early tanks/M2 artys for an invasion of his continent. I proceeded over, invaded and took one city. In the AI's turn, he used his extensive rail network to move stacks of 11/12 units with a good mix of marines/infantry regts/M2 arty's/fighters to kill off my stacks and reclaim his city. In one turn, he sent 4 of these stacks at me, and I defended successfully but was reduced to one stack of about 8. In my turn I moved two more stacks into the beachhead area to help the attack. The AI responded with 5 more stacks of the same to pound me into the sea and retake his city. And then to rub salt into the wounds, my battleship escorts and transport ships got attacked by roving subs and destroyers!!!

                    So for the next 50 turns I made 3 more attempts at getting a secured beachhead. And 3 times the AI pounded me into the sea. I was not a happy chappy!

                    In the meantime, over the last 150 turns, other AI's had been in wars as well. I was friendly with two other civs, and all 3 of us were swapping maps frequently due to our peace treaties. In that time I watched two civs pincer a civ between them and WIPE THEM OUT!

                    So my point is, the AI knows how to attack and defend well. I don't think frenzy is doing THAT much to the AI. I think it's my combination of low amounts of improvements, higher movement rates and Martin's ComForAIs slic that allows the AI to pay for huge mobile armies.

                    But I will say, I got a hellova shock from the AI!

                    Hope this helps Wes. With a combination of all our individual manipulations you're sure to get something out of all this. Note: I've gone for an extremely war-like AI. There's none of this diplomacy, scientific ***** victory stuff in World At War!

                    Comment

                    Working...
                    X