Thread Tools
Old March 1, 2002, 21:56   #1
WesW
Apolytoners Hall of Fame
 
WesW's Avatar
 
Local Time: 15:14
Local Date: October 31, 2010
Join Date: Mar 2007
Location: Florence, Al., USA
Posts: 1,554
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.
__________________
For Civ IV: The Medmod V v1.0.
For Medieval: Total War- The Medieval Mod IV v4.0.
The entire Medmod series is available at my Apolyton-hosted webpage.
WesW is offline  
Old March 1, 2002, 23:00   #2
Leonidas
King
 
Leonidas's Avatar
 
Local Time: 21:14
Local Date: October 31, 2010
Join Date: May 2000
Posts: 1,003
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. . .
Leonidas is offline  
Old March 2, 2002, 10:35   #3
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 18:14
Local Date: October 31, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
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
Pedrunn is offline  
Old March 2, 2002, 15:13   #4
Martin Gühmann
staff
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Super Moderator
 
Martin Gühmann's Avatar
 
Local Time: 23:14
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Re: Questions about Frenzy code
Quote:
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!"
Martin Gühmann is offline  
Old March 9, 2002, 01:32   #5
WesW
Apolytoners Hall of Fame
 
WesW's Avatar
 
Local Time: 15:14
Local Date: October 31, 2010
Join Date: Mar 2007
Location: Florence, Al., USA
Posts: 1,554
Guys, any comments here?
__________________
For Civ IV: The Medmod V v1.0.
For Medieval: Total War- The Medieval Mod IV v4.0.
The entire Medmod series is available at my Apolyton-hosted webpage.
WesW is offline  
Old March 9, 2002, 07:48   #6
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 23:14
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
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...

Quote:
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).
Quote:
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).
Quote:
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.
Quote:
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.
Quote:
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...

Quote:
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.

Quote:
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
Locutus is offline  
Old March 9, 2002, 09:24   #7
hexagonian
The Courts of Candle'Bre
Emperor
 
hexagonian's Avatar
 
Local Time: 16:14
Local Date: October 31, 2010
Join Date: Jun 1999
Location: Smemperor
Posts: 3,405
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...
hexagonian is offline  
Old March 9, 2002, 19:13   #8
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 21:14
Local Date: October 31, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
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.
Peter Triggs is offline  
Old March 9, 2002, 23:27   #9
WesW
Apolytoners Hall of Fame
 
WesW's Avatar
 
Local Time: 15:14
Local Date: October 31, 2010
Join Date: Mar 2007
Location: Florence, Al., USA
Posts: 1,554
Great work, Peter. Perhaps all this can be fixed. It is certainly good to know about it.
__________________
For Civ IV: The Medmod V v1.0.
For Medieval: Total War- The Medieval Mod IV v4.0.
The entire Medmod series is available at my Apolyton-hosted webpage.
WesW is offline  
Old March 10, 2002, 21:40   #10
Dale
Emperor
 
Dale's Avatar
 
Local Time: 07:14
Local Date: November 1, 2010
Join Date: Dec 2000
Posts: 3,944
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!
Dale is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 17:14.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team