Thread Tools
Old November 4, 2003, 08:40   #1
Sore Loser
Warlord
 
Local Time: 12:50
Local Date: November 2, 2010
Join Date: Sep 2003
Location: Aarhus, Denmark
Posts: 164
What factors affect AI behaviour?
I'm having a problem with the AI building too many units and not expanding enough in my games. Does anyone know what factors can be changed to make the AI behave differently? Non-arable land seems to confuse it a lot, for one thing. The "Expansionist" trait helps, of course, but it is rarely enough.

On a similar note, has anybody discerned the rules of the AI's terrain usage? It seems that it knows that food is more important when the food surplus is low or non-existent, but other than that I've been unable to figure out much.
Sore Loser is offline  
Old November 4, 2003, 08:58   #2
DarthVeda
Emperor
 
DarthVeda's Avatar
 
Local Time: 07:50
Local Date: November 2, 2010
Join Date: Dec 1969
Location: Baltimore, MD
Posts: 4,325
I think if you give it a lot of 'grassland' (whatever you have decided to call it), it will expand to no end if the settlers are cheap enough.
DarthVeda is offline  
Old November 4, 2003, 10:15   #3
Thoddy
Warlord
 
Local Time: 12:50
Local Date: November 2, 2010
Join Date: Jan 2001
Location: Hannover, Germany
Posts: 227
cheap domain 3 settlers
Thoddy is offline  
Old November 4, 2003, 10:19   #4
Brundlefly
Prince
 
Brundlefly's Avatar
 
Local Time: 07:50
Local Date: November 2, 2010
Join Date: Nov 2001
Location: Picksburgh
Posts: 837
The Ai is a dummy. If you want an opponent to truly challenge you. Play MP.
Brundlefly is offline  
Old November 5, 2003, 05:08   #5
Sore Loser
Warlord
 
Local Time: 12:50
Local Date: November 2, 2010
Join Date: Sep 2003
Location: Aarhus, Denmark
Posts: 164
The AI is indeed a dummy, but SP does have the crucial advantage over MP that it doesn't put as large demands on your spare time as SP. Furthermore, with certain self-imposed rules I believe it is possible to make the AI challenging. I'd prefer MP, but that's just not doable for me.
Sore Loser is offline  
Old November 5, 2003, 07:02   #6
Case
Civilization II PBEMCivilization II Democracy Game: Red FrontScenario League / Civ2-Creation
Emperor
 
Case's Avatar
 
Local Time: 21:50
Local Date: November 2, 2010
Join Date: Feb 2000
Posts: 3,057
It seems that microprose hardcoded the AI to have a preference for smallish, but well developed empires over the sprawling and generally lightly developed empires most experianced players prefer (think of how many times you've watched the AI obsessively build fortresses and RRs while you've concentrated on founding new cities).

The solution: there is no truely satisfying solution I suspect. A combination of dirt cheat engineers and occasional tweaks to the AI civs via cheat mode can work wonders though - in my experiance, if you give the AI cities through cheat mode it tends to use them fairly well.
__________________
'Arguing with anonymous strangers on the internet is a sucker's game because they almost always turn out to be - or to be indistinguishable from - self-righteous sixteen year olds possessing infinite amounts of free time.'
- Neal Stephenson, Cryptonomicon
Case is offline  
Old November 5, 2003, 10:33   #7
Sore Loser
Warlord
 
Local Time: 12:50
Local Date: November 2, 2010
Join Date: Sep 2003
Location: Aarhus, Denmark
Posts: 164
That's my experience too Case. Sometimes the AI is really good at developing the infrastructure of their cities. If terrain improvement is made more important, I think this would aid the AI slightly.

One of the main problems is all the units they produce who run around doing nothing except eat shields. I can make them all civilized, but then I they're that much easier to romp in battle.

Does anyone know how the AI assigns workers to terrain squares?
Sore Loser is offline  
Old November 5, 2003, 11:08   #8
Elok
Scenario League / Civ2-Creation
Emperor
 
Elok's Avatar
 
Local Time: 07:50
Local Date: November 2, 2010
Join Date: Mar 2003
Location: Having tea with the Third Man...
Posts: 6,169
Well, as to overimprovement, can't you just deny them the ability to make fortresses/RRs, and limit development in other ways, so they have to use settlers for actual cities? How about settlers that eat zero food per turn and have combat abilities? The AI might behave more sensibly if ALL of its units are settlers. It'll be forced to build less to avoid disbanding its cities, right? I have little scenario experience, of course...
__________________
"May I be forgiven for the ills that I have done/Friends I have forsaken and strangers I have shunned/Sins I have committed, for which others had to pay/And I haven't met the whiskey that can wash those stains away."
-Brady's Leap, "Wash."
Elok is offline  
Old November 5, 2003, 11:14   #9
Henrik
Civilization II PBEMScenario League / Civ2-CreationNationStatesMacCivilization II Democracy Game: Red FrontSpanish CiversCivilization IV Creators
Emperor
 
Henrik's Avatar
 
Local Time: 12:50
Local Date: November 2, 2010
Join Date: Dec 2000
Location: The European Union, Sweden, Lund
Posts: 3,682
The AI does remarkably well with combined combat and settler units.
I once set catapults to the settler role by misstake and had an AI that expanded rapidly...
Not sure if the stats of that combat unit affects the AI's use of it though.
__________________
No Fighting here, this is the war room!
Henrik is offline  
Old November 5, 2003, 18:18   #10
Case
Civilization II PBEMCivilization II Democracy Game: Red FrontScenario League / Civ2-Creation
Emperor
 
Case's Avatar
 
Local Time: 21:50
Local Date: November 2, 2010
Join Date: Feb 2000
Posts: 3,057
Quote:
Originally posted by Henrik
The AI does remarkably well with combined combat and settler units.
The AI loves combined settler units. In the beta version of Raging Dragon I gave Sappers a settler flag. The result: the AI built nothing but sappers!
__________________
'Arguing with anonymous strangers on the internet is a sucker's game because they almost always turn out to be - or to be indistinguishable from - self-righteous sixteen year olds possessing infinite amounts of free time.'
- Neal Stephenson, Cryptonomicon
Case is offline  
Old November 5, 2003, 21:41   #11
Catfish
Prince
 
Local Time: 21:50
Local Date: November 2, 2010
Join Date: Aug 2000
Location: Wollongong, Australia
Posts: 367
Curt Sibling had a similar problem with his Bitterfrost scenario where the AI settlers wouldn’t touch any terrain with a low fertility index (see Allard Höfelt’s excellent hex editing compilation). The AI will not build on any terrain except for those that use the grassland or plains slots (unless their fertility index is raised above 6). As a result you have a large number of “wasted” terrain slots - if that's your goal.

From the findings in the hex editing article, the fertility values appear to be dynamic as the game progresses – terrain improvements, cities and available land all seem to be influential. I'm guessing that ongoing modifications to this index are based on its initial value and are not later recalculated from the terrain slot value (byte 1 for each tile). Does anyone have any idea? If that is the case, there’s nothing to stop you changing the fertility values at the start of the game. Now, you could hex hack all the map tile entries in the .sav or .scn files, but I wouldn’t wish that on my worst enemy. Alternatively, some kind soul could, erm, produce a utility that allows you to modify the fertility values for each terrain slot. A certain somebody, cough, comes to mind.

Just out of curiosity, I started a few random maps to see what sort of fertility values came up. These are values for the last 4 bits of the 6th byte for each tile in the main map block on the 1st turn:

Code:
Terrain              Hex Values    Decimal Values
Plains                  8-F            8-15
Plains + River          C-F            12-15
Grassland	        8-F            8-15
Grassland + River       C-F            12-15
All Other Terrains      0              0
Values for plains and grassland below 10 were very rare. The distribution of values for each terrain type seemed to present a bell-shaped curve, skewed to the right - of course this is just at a glance. More data might reveal wider ranges, but, hell, I got sick of looking.
Catfish is offline  
Old November 6, 2003, 00:25   #12
Catfish
Prince
 
Local Time: 21:50
Local Date: November 2, 2010
Join Date: Aug 2000
Location: Wollongong, Australia
Posts: 367
OK, I’ve done some experimenting. I started a new game and hex edited the fertility values of some hills, mountains and jungle to 15. After 40 turns the value remained the same. I then reloaded the 1st turn and placed an AI settler on one of the edited hills. He promptly built a city. All the tiles within the city radius that had a previously hacked value of 15 immediately dropped to 7, not 0. This answers my question. When the game recalculates the revised fertility value, the current terrain type byte is not considered.

Furthermore, changing the terrain type from within the cheat menu (Shift+F8) also does not modify the fertility value – something to be aware of if you’re thinking of adding more grassland and plains tiles to a saved game at a later date. Edit: Similarly, one way to get the AI to colonise other terrains would be to create them as grassland or plains in the map editor and then later change them to something else in the cheat menu.

Edit (again): Hmm, pulling the MapCopy utility out of the cobwebs I find that there already exists a utility that can modify these values in the save game. Unfortunately (for me and about 3 other people on the planet), it doesn't work with ToT. It also doesn't differentiate between non-grassland/plains terrains. Apologies for my public gibberings.

Last edited by Catfish; November 6, 2003 at 06:48.
Catfish is offline  
Old November 6, 2003, 08:23   #13
Sore Loser
Warlord
 
Local Time: 12:50
Local Date: November 2, 2010
Join Date: Sep 2003
Location: Aarhus, Denmark
Posts: 164
Very interesting, thank you for all the replies. Let me see if I get this right: Each tile on the map has a fertility value that seems to depend primarily on the moisture level of the tile and secondly on the surrounding terrain. Any non-arable tile is set to zero, regardless of the surrounding terrain.

I'm not very fond of the idea of giving the settler flag to all units, but I'll try it out and see if the results can be put to good use somehow. Thanks again!

One more thing, the AI never suffers from starvation. I have very high food upkeep costs for settlers in my patch, and starvation is simply eliminated for the AI. The cities still don't grow, but any negative amount of food is ignored. So another way of improving the AI is to make settlers eat more, if only I could make sure that they expand with those settlers.
Sore Loser is offline  
Old November 6, 2003, 10:43   #14
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 05:50
Local Date: November 2, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
Quote:
Originally posted by Sore Loser

One more thing, the AI never suffers from starvation. I have very high food upkeep costs for settlers in my patch, and starvation is simply eliminated for the AI. The cities still don't grow, but any negative amount of food is ignored. So another way of improving the AI is to make settlers eat more, if only I could make sure that they expand with those settlers.
My experience is otherwise. AI controlled cities will shrink if not enought food is available. I've noticed this many times. The effect is most pronounced when you forget to explore the tiles around a city when making a scenario. These 'dark' cities melt away very quickly.
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old November 6, 2003, 10:46   #15
Sore Loser
Warlord
 
Local Time: 12:50
Local Date: November 2, 2010
Join Date: Sep 2003
Location: Aarhus, Denmark
Posts: 164
What version are you using? I'm using 2.42, it may simply be a bug that's been corrected in later versions.
Sore Loser is offline  
Old November 6, 2003, 12:29   #16
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 05:50
Local Date: November 2, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
I've seen this in all versions. I've always considered it just part of the game.
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old November 6, 2003, 12:43   #17
Sore Loser
Warlord
 
Local Time: 12:50
Local Date: November 2, 2010
Join Date: Sep 2003
Location: Aarhus, Denmark
Posts: 164
Does it also apply when the deficit is caused by settlers? It doesn't happen to me.
Sore Loser is offline  
Old November 6, 2003, 15:58   #18
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 05:50
Local Date: November 2, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
Not sure, 'cause I've never studied it. In a scenario situation, I have seen a city under AI control keep producing settlers until it's only 3 or 4 in size, but that was caused by setller creation, not starvation.
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old November 6, 2003, 17:53   #19
Case
Civilization II PBEMCivilization II Democracy Game: Red FrontScenario League / Civ2-Creation
Emperor
 
Case's Avatar
 
Local Time: 21:50
Local Date: November 2, 2010
Join Date: Feb 2000
Posts: 3,057
I've seen it as well - starving cities is a useful siege tactic in the game. As the city shrinks, the number of units it can support shrinks and an attack becomes a lot easier.
__________________
'Arguing with anonymous strangers on the internet is a sucker's game because they almost always turn out to be - or to be indistinguishable from - self-righteous sixteen year olds possessing infinite amounts of free time.'
- Neal Stephenson, Cryptonomicon
Case is offline  
Old November 6, 2003, 18:28   #20
Mercator
Scenario League / Civ2-Creation
Emperor
 
Mercator's Avatar
 
Local Time: 13:50
Local Date: November 2, 2010
Join Date: Dec 1969
Posts: 3,079
@Catfish... I've done some testing on that myself too. See here:
http://www.civgaming.net/mercator/re.../mapstruct.htm
http://apolyton.net/forums/showthrea...threadid=92070
http://apolyton.net/forums/showthrea...ight=fertility

For the AI, 0-7 is infertile (only grassland and plains ever have values higher than this), 8-15 is fertile (the AI only builds cities on those).

By the way, I think MapCopy could sort of be made to work with ToT in combination with some hex-editing. And if you also have another civ2 version. Start your scenario in both FW/MGE and ToT, "MapCopy" the FW/MGE savegame, and then copy-paste the map (just the 6-byte section) to the ToT savegame.
__________________
Civilization II: maps, guides, links, scenarios, patches and utilities (+ Civ2Tech and CivEngineer)
Mercator is offline  
Old November 6, 2003, 23:24   #21
:) Smiley
Scenario League / Civ2-Creation
Emperor
 
:) Smiley's Avatar
 
Local Time: 04:50
Local Date: November 2, 2010
Join Date: Feb 2001
Location: hippieland, CA
Posts: 3,781
Why the need for such a large range though if the only criteria is whether or not its grass or plains?
__________________
Visit First Cultural Industries
There are reasons why I believe mankind should live in cities and let nature reclaim all the villages with the exception of a few we keep on display as horrific reminders of rural life.-Starchild
Meat eating and the dominance and force projected over animals that is acompanies it is a gateway or parallel to other prejudiced beliefs such as classism, misogyny, and even racism. -General Ludd
:) Smiley is offline  
Old November 7, 2003, 01:39   #22
Catfish
Prince
 
Local Time: 21:50
Local Date: November 2, 2010
Join Date: Aug 2000
Location: Wollongong, Australia
Posts: 367
@Mercator
Thanks, Mercator, I'll have a look at those links.

MapCopy lumps plains/grasslands in one group and the remaining terrains in another group. I was thinking about a utility that could alter each terrain slot separately. I'm thinking in terms of Curt's Bitterfrost scenario where I'm guessing he wanted at least 3 of his terrains to be arable - Thawland (Plains), Hearthland (Grassland) and Richland (Swamp). Of course Richland misses out.

Quote:
Originally posted by Smiley
Why the need for such a large range though if the only criteria is whether or not its grass or plains?
The criterion for settlement is actually fertility, not terrain type. Even though grassland/plains are the only slots that receive a fertility value at the beginning of the game, theoretically, fertility values for non-grassland/plains terrains may be able to be increased beyond 7 with terrain improvements and possibly other factors (see my first post and the document on hex editing). Similarly, fertility values for grassland/plains can be decreased below 8. Example: the AI is more likely to build a city on grassland with a river and other improvements, even though it lies within another city’s radius, than basic grassland (almost no chance).

Why is there a range at the beginning of the game? Variety is the spice of life. A degree of randomness gets built into the AI via initial fertility values. As I said, many values will be modified down to the settlement threshold as the game progresses. Why is the range as large as it is? I guess it was probably tweaked to compliment the AI’s behaviour.

Last edited by Catfish; November 7, 2003 at 01:57.
Catfish is offline  
Old November 7, 2003, 08:05   #23
Mercator
Scenario League / Civ2-Creation
Emperor
 
Mercator's Avatar
 
Local Time: 13:50
Local Date: November 2, 2010
Join Date: Dec 1969
Posts: 3,079
Quote:
Originally posted by Catfish
I'm thinking in terms of Curt's Bitterfrost scenario where I'm guessing he wanted at least 3 of his terrains to be arable - Thawland (Plains), Hearthland (Grassland) and Richland (Swamp). Of course Richland misses out.
Not necessarily. MapCopy can also copy fertility data from one map to another. Curt could make a copy of his map, turn all Thawland, Heartland and Richland into Grassland, and turn the rest into Desert (also make sure to use the "Analyze map" option in the map editor to set the fertility values). You can then simply copy that map's fertility data into the scenario.

That still has its limitations, of course, but it's more versatile than you thought it was.
__________________
Civilization II: maps, guides, links, scenarios, patches and utilities (+ Civ2Tech and CivEngineer)
Mercator is offline  
Old November 7, 2003, 09:45   #24
Catfish
Prince
 
Local Time: 21:50
Local Date: November 2, 2010
Join Date: Aug 2000
Location: Wollongong, Australia
Posts: 367
Quote:
Originally posted by Mercator
That still has its limitations, of course, but it's more versatile than you thought it was.
Sorry, I’ve never used MapCopy and being a dumb arse, overlooked this possibility in the Readme. That piece of knowledge could save a lot of people’s scenarios.

Wouldn't Curt just need to change swamp (Richland) into grassland/plains? The other values are already correct.

BTW, earlier you said, "0-7 is infertile (only grassland and plains ever have values higher than this)". The hex editing article (you wrote the map section?) states: "Fertility values of terrains other than Grassland or Plains can, however, increase because of tile improvements". Are these increases always < 8 or have you since found out that there are none at all?

Also, the article states that the AI’s fertility threshold (can build) is 7. You now say it’s 8. Which is it? I’m guessing the article is incorrect.

Edit: Clarified a point. Must... go... to... bed...

Last edited by Catfish; November 7, 2003 at 11:56.
Catfish is offline  
Old November 7, 2003, 15:22   #25
Mercator
Scenario League / Civ2-Creation
Emperor
 
Mercator's Avatar
 
Local Time: 13:50
Local Date: November 2, 2010
Join Date: Dec 1969
Posts: 3,079
Oh, damn... I'm not sure anymore now... But I guess the article is incorrect (your findings also confirm that, since city radius squares drop to 7).

I can't do any testing (not to mention making utilities )at the moment because my computer died last Friday.
__________________
Civilization II: maps, guides, links, scenarios, patches and utilities (+ Civ2Tech and CivEngineer)
Mercator is offline  
Old November 7, 2003, 17:10   #26
Varwnos
Scenario League / Civ2-Creation
Prince
 
Varwnos's Avatar
 
Local Time: 14:50
Local Date: November 2, 2010
Join Date: Oct 2003
Location: of Thessalonike
Posts: 983
hi :)
Does anyone know how you can prevent the AI from founding new cities? Empirically i know that if the tech level is already high the AI just doesnt bother to found any more cities even if it has huge lands between it and the other nations. But even if that is so i dont know at what level the tech starts to be preventing that.

ps i need this for my own scenario
Varwnos is offline  
Old November 7, 2003, 21:49   #27
Catfish
Prince
 
Local Time: 21:50
Local Date: November 2, 2010
Join Date: Aug 2000
Location: Wollongong, Australia
Posts: 367
Quote:
Originally posted by Mercator
(your findings also confirm that, since city radius squares drop to 7)
That's one of the reasons I was asking. Bad luck about the computer. I've just finished rebuilding my OS after ditching a dodgy HD.

Quote:
Originally posted by varwnos
Does anyone know how you can prevent the AI from founding new cities?
I’m going to make the assumption that you still want the civs to have settlers (for land improvement purposes). Am I right? Otherwise, make the settler prerequisite tech unavailable (via tree or trading) using "no, no". Just give it to the appropriate civs at the start or via events. See, if you had ToT, cough, you could just ban settlers from specific civs using the Advanced Units section without the need for stuffing around with your tech tree. Now, just hope they don’t get bribed. Wait a minute… you can also make units unbribable in ToT.

If my assumption is correct, Mercator’s just shown you the way. Export your map from the scenario. Fire up the Civ2 Map Editor. Change all the plains and grasslands tiles to something else. Run the Analyze Map option in the Map menu to reset the fertility values. Import the new fertility values (only) back into the scenario, using the MapCopy utility. MapCopy can be found here. The AI will now be faced with a sea of infertility (all zeros).
Catfish is offline  
Old November 7, 2003, 22:27   #28
Varwnos
Scenario League / Civ2-Creation
Prince
 
Varwnos's Avatar
 
Local Time: 14:50
Local Date: November 2, 2010
Join Date: Oct 2003
Location: of Thessalonike
Posts: 983
hm :)
yes, but this way i should have to edit all of the tiles everywhere apart from those in the existant cities, (map and city placement is complete already) which would have to be different ones. So i think that this isnt very practical, although doable. The AI doesnt create cities very near the already existant friendly ones, but can create ones only 2 squares next to the enemy ones. In some scenarios however it doesnt do anything, as in DAROE and i guess that that had to do with the tech. I plan to have settlers, since it is boring not to have them, so as the player has some goal to achieve other than conquest, and the illusion that developing his cities will make things better

i can make them advanced units in my civ2fw, or obsolete units, so that isnt a problem, but then that would only work if only one nation was playable, the one with the settlers.

i think that the easiest way to solve this problem is to have advanced techs for everyone, and a very slow rate of research.

thank you for the quick reply!

(not sure if what you meant about your version of civ2 isnt unique, but i think that in civfw you can easily create units that are independant of the techtree, i just havent yet done that since its my first scenario)
Varwnos is offline  
Old November 7, 2003, 23:29   #29
Catfish
Prince
 
Local Time: 21:50
Local Date: November 2, 2010
Join Date: Aug 2000
Location: Wollongong, Australia
Posts: 367
Re: hm :)
Quote:
Originally posted by varwnos
yes, but this way i should have to edit all of the tiles everywhere apart from those in the existant cities, (map and city placement is complete already) which would have to be different ones. So i think that this isnt very practical, although doable.
Actually, forget what I said about the Map Editor (which wouldn't take as long as you think, anyway). Use the ZERO option in MapCopy (apologies for my Alzheimer's) to change the fertility values to 0 for the entire map. The fertility values only affect the AI, so the human player can happily build away until the cows come home.

Quote:
Originally posted by varwnos
(not sure if what you meant about your version of civ2 isnt unique, but i think that in civfw you can easily create units that are independant of the techtree, i just havent yet done that since its my first scenario)
?
Catfish is offline  
Old November 8, 2003, 09:05   #30
Mercator
Scenario League / Civ2-Creation
Emperor
 
Mercator's Avatar
 
Local Time: 13:50
Local Date: November 2, 2010
Join Date: Dec 1969
Posts: 3,079
Re: hm :)
Quote:
Originally posted by varwnos
yes, but this way i should have to edit all of the tiles everywhere apart from those in the existant cities, (map and city placement is complete already) which would have to be different ones.
No you don't. Making the entire map "infertile" prevents the AI from building cities, nothing more and nothing less. It won't affect existing cities.

Fertility values have absolutely nothing to do with the terrain properties in the rules.txt.

So as Catfish has just pointed out, using MapCopy's ZERO option is the thing you need.
__________________
Civilization II: maps, guides, links, scenarios, patches and utilities (+ Civ2Tech and CivEngineer)
Mercator 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 07:50.


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