Custom maps the AI can function on

Wobbegong said:
City Created: If Fertility > 7 then Fertility = Fertility – 8, else Fertility = Fertility
City Destroyed: If Fertility < 8 then Fertility = Fertility + 8, else Fertility = Fertility

Wow... Is it really that simple... So then the only other factor is the initial assignment. I guess that could go something like this: grassland/plains get a value of 8 initially, the rest gets 0. Those values are then increased depending on how many of the surrounding squares are also fertile.

Axe has one, too (I'm using version 3.4.1), although creating structures is unchartered waters for me.

:hmm: I'm still using 2.1. I'll check it out...
Ah, it seems to be able to do the same.

Interesting, but it sounds like at least as much work as the method I'm using. :)

Well, it's not really a very good method for changing values or checking the values of a few squares, but it's much better if you want to see at a glance what the entire map looks like. With several savegames of one game you could quickly see how the entire map's fertility changes.

With the spreadsheet I can effortlessly switch between maps, too. (...)
Offset = 29910 + 14*T + 7*W*H*(Z+1) + (6*W*H+2)*Z + 6*(Y*W+ROUNDUP((X+1)/2,0))

Excellent... I don't have a spreadsheet though. I knew how to find the map etc. already, of course, since I had to use it in MapEdit.
 
Mercator said:
Wow... Is it really that simple...
It seems to be. I've yet to encounter anything that doesn't fit that model.
Mercator said:
So then the only other factor is the initial assignment.
Yep.
Mercator said:
I guess that could go something like this: grassland/plains get a value of 8 initially, the rest gets 0. Those values are then increased depending on how many of the surrounding squares are also fertile.
Something like that, yeah. Then throw in a couple of other factors like rivers and resource seeding.
Mercator said:
Well, it's not really a very good method for changing values or checking the values of a few squares, but it's much better if you want to see at a glance what the entire map looks like.
It's an excellent method for showing large-scale patterns. :goodjob: I just used it to create a graphic of a 40x50 all-plains map showing the effect of resource seeding on fertility. I changed the colours for readability: darkest = 8, lightest = 15.

Fertility_Plains_HexView2.gif


Mercator said:
Excellent... I don't have a spreadsheet though.
You don't have a spreadsheet of any kind? :eek: What kind of caveman are you? :D
 
Jeesh, my cable goes down for a few days, and fertility rites are in full swing! Nice work, and thanks, Catfish, for the spreadsheet tips! :goodjob:

The AI tends to build cities adjacent to specials, but never in squares that enable four special cities. Does a special affect fertility? Ever look at an all plains map?

If you edit the fertility values sufficiently, will the AI build cities adjacent to each other? Oops, I guess not since civ2 won't allow humans to do it.

Merc, what are you studying that doesn't use spreadsheets? You must either be in the humanities or a pure mathematician.
 
Wobbegong said:
It's an excellent method for showing large-scale patterns. :goodjob: I just used it to create a graphic of a 40x50 all-plains map showing the effect of resource seeding on fertility. I changed the colours for readability: darkest = 8, lightest = 15.

:hmm: The center of it seems pretty straightforward. It's 15 for all squares adjacent to a resource or having more than one resource in the city radius. It's 14 otherwise... I don't quite understand the pattern around the borders.

Oh, but what's at (11, 41)? That's the tile in the bottom-left resource pattern where the the resource square is 15, rather than 14 like every other resource square.

You don't have a spreadsheet of any kind? :eek: What kind of caveman are you? :D

:p I've never used one. Well, only once or twice, but for nothing serious.


Boco said:
The AI tends to build cities adjacent to specials, but never in squares that enable four special cities. Does a special affect fertility? Ever look at an all plains map?

* Glances 2 posts up *
:mischief:

If you edit the fertility values sufficiently, will the AI build cities adjacent to each other? Oops, I guess not since civ2 won't allow humans to do it.

I don't think so, but worth testing to be sure.

Merc, what are you studying that doesn't use spreadsheets? You must either be in the humanities or a pure mathematician.

:confused: Artificial Intelligence. I've never had to write (m)any essays though. But I don't think they're used much at all. The only spreadsheets I've seen being used are just simple tables, no formulas (e.g. exam results).

What exactly would I need it for? What do you use it for? What do you study that you do use spreadsheets? ;)
 
Mercator said:
Bugger it... If I e-mail Dusty and can get him to add my suggestions he could make it support ToT. Though that might only be the first map in a multi-map game.

Do you have any spare terrain types? If you're not using at least 2 terrain types, you can swap them for grassland/plains so there isn't any terrain the AI will naturally build cities on...

But you can only do that when you create a new scenario. You obviously can't do that with an existing one, because, well, you'd need MapCopy to do that.
If he has the time and it can be done then...of course! (Multi-map support would be a must for certain scens though.)

[I just saw your newer post on that: that's great.]

Spare terrain? Are you kidding? ;)

(I could swap Mountains terrain--impassable so hence no settling--but then I lose the chain effect. The other thing is Minefields but in the scen only Settler unit is Engineer Corps. and it's the only unit that CAN enter Minefields, so that's out too.)

No, that's not an option. If anything, I want more terrain types (in the same map).


Did that involve any terrain editing? If the mountain was grassland before and you edited it to become a mountain, the AI would still treat it as grassland.
No, this was using the default terrain set. (I may have changed the Settler's domain to air though...not sure.)


In one "experiment" I did a long time ago, it seemed fertility values across the map slowly increased. Perhaps the fertility values are used to implement the AI's expansion. I.e. fertility values increase so AI settlers are more likely to build cities.

The fertility values change during a game. It's not just fertile/not fertile, there are 16 different possible values (0-15).

I didn't know that. Yet one more thing to make editable once...well, you know the rest. ;)


I don't know, but that's exactly the thing that confuses the AI... In fact, that's the thing Mike started this thread for in the first place! Read the thread he referred to in the opening post to see what he meant.
:o ... Thanks.


Wobbegong said:
It can be done using MapCopy, but it requires some hex-editing.
I see. Yes, a bit messy. Anything to be done with multi-maps?

When a new city is founded, the fertility values of nearby tiles drop by 8 points. Supposedly the AI will not build on a tile with a value of less than 8.
I assume the logic behind this is to prevent the AI from settling too close.


I would be interested to know what effects Irrigation has on fertility because I've noticed that in the early game, Irrigation occasionally appears around AI cities without Settlers being present (i.e. automatically). Roads also appear on the same square with the Irrigation.
 
Boco said:
Nice work, and thanks, Catfish, for the spreadsheet tips! :goodjob:
Hell, I'll post the thing (attached). It's got the byte functions and values listed for convenience.
Boco said:
Does a special affect fertility? Ever look at an all plains map?
Maybe I should've coloured it brown. :rolleyes:;)
Mercator said:
I don't quite understand the pattern around the borders.
Along the borders you have the off-map areas (zero-fertility) and the resource seed pattern working in combination. Haven't examined it closely.
Mercator said:
Oh, but what's at (11, 41)? That's the tile in the bottom-left resource pattern where the the resource square is 15, rather than 14 like every other resource square.
You notice everything, don't you? There's a bloody settler standing there, that's what. :p With only 3 settlers on the map, I bypassed the Binary And with 0F step. As a result, the ownership bits kicked in. It should be 14 as well. I noticed it too - after posting it - but I wasn't expecting that level of scrutiny and was too lazy to bother with it. :D Fixed now.
yoshi said:
I see. Yes, a bit messy. Anything to be done with multi-maps?
Same routine as single map ToT scenarios.
yoshi said:
I assume the logic behind this is to prevent the AI from settling too close.
Yes, given normal conditions, ie, no overcrowding or advanced tribes (goodie huts), AI cities should be spaced at least 3 tiles apart (2 diagonally). If you use Dusty's ADJUST algorithm, they'll be 1 tile closer. BTW, the theory that AI settlers don't build cities on terrain with fertility values less than 8 wasn't mine. It seems they'll settle anything with a value > 0, but the likelihood decreases as fertility decreases – especially if there's something better on offer nearby.
yoshi said:
I would be interested to know what effects Irrigation has on fertility because I've noticed that in the early game, Irrigation occasionally appears around AI cities without Settlers being present (i.e. automatically). Roads also appear on the same square with the Irrigation.
You and Boco should both get your eyesight checked. ;) Irrigation doesn't affect fertility (see 9 posts up). The AI is a dirty cheat. ;)
 

Attachments

yoshi said:
If he has the time and it can be done then...of course! (Multi-map support would be a must for certain scens though.)

I've mailed Dusty... He's looking into it. I don't know if it will be implemented in time for your scenario though.

No, this was using the default terrain set. (I may have changed the Settler's domain to air though...not sure.)

No, I mean was that tile grassland/plains at first, but you changed it to a mountain through the cheat menu?

Wobbegong said:
Along the borders you have the off-map areas (zero-fertility) and the resource seed pattern working in combination. Haven't examined it closely.

Yes, quite. There is some regularity, but I couldn't figure it out so easily. The most puzzling thing are that there are only 2 squares with fertility 10. One on the right edge and one on the left edge...

You notice everything, don't you? There's a bloody settler standing there, that's what. :p With only 3 settlers on the map, I bypassed the Binary And with 0F step. As a result, the ownership bits kicked in. It should be 14 as well. I noticed it too - after posting it - but I wasn't expecting that level of scrutiny and was too lazy to bother with it. :D Fixed now.

:D

... Or was that where the other two settlers were standing?

BTW, the theory that AI settlers don't build cities on terrain with fertility values less than 8 wasn't mine. It seems they'll settle anything with a value > 0, but the likelihood decreases as fertility decreases – especially if there's something better on offer nearby.

:hmm: Yes, I think that must've been me, except I'm not sure how I came to that conclusion. Probably just because, well, the AI pretty much only builds cities on grassland and plains. Not to mention the map structure doc on my website says less than 7.

Boco said:
ToT and occasionally when I make drugs. You might be able to deduce from my notably meticulous thinking process that I analyze a lot of research data.

:D
 
Wobbegong said:
Irrigation doesn't affect fertility (see 9 posts up).
I thought something was said earlier about the presence of irrigated squares possibly having some effct on general fertility values (or values within city radius--or 44 square city radius). I guess I imagined it.

Mercator said:
I've mailed Dusty... He's looking into it. I don't know if it will be implemented in time for your scenario though.
Great. I'll work on the MGE version in the meantime...may take me a while. ;) (I can always try doing it manually using the method Wobbegong mentioned.)

No, I mean was that tile grassland/plains at first, but you changed it to a mountain through the cheat menu?
Oh sorry, I thought you meant that I swapped slots in Rules.txt. Possibly, yes. That would be the reason then. For some reason I thought that fertility changed to match terrain in the edited square when the .sav file was reloded--does this also apply to .scn files (i.e. .sav file saved as .scn file, then load .scn file and save)?
 
yoshi said:
I thought something was said earlier about the presence of irrigated squares possibly having some effct on general fertility values (or values within city radius--or 44 square city radius). I guess I imagined it.

Well, I said that, but I was just guessing. Wobbegong tested it and proved me wrong.

Oh sorry, I thought you meant that I swapped slots in Rules.txt. Possibly, yes. That would be the reason then. For some reason I thought that fertility changed to match terrain in the edited square when the .sav file was reloded--does this also apply to .scn files (i.e. .sav file saved as .scn file, then load .scn file and save)?

Not that I know of. Fertility values are only calculated during the "world building" phase. Anything after that are just changes based on those starting values. I'm not sure if it changes with ChangeTerrain events. Probably not either.

SAV and SCN files use the same format. Changes when (re-)saving are minimal.
 
Thanks. Thing is, I actually knew that AND it was said earlier in this thread anyway...I really have no idea why I posted that question...oh wait, I remember why: I'm ********.
 
Mercator said:
Yes, quite. There is some regularity, but I couldn't figure it out so easily. The most puzzling thing are that there are only 2 squares with fertility 10. One on the right edge and one on the left edge...
... Or was that where the other two settlers were standing?
No, the other settlers had no effect – otherwise I would've changed them too. :p

:hmm: There are 4 tiles along the east and west borders of the map that contain 2 resources within their city radii. Two, (0,8) and (79,25), have values of 9 (just like most of the other edge tiles – except for the corners) and two, (0,24) and (79,9), have values of 10. I believe tiles that lie in the inner ring (8 tiles) of the city radius are more heavily weighted than those from the outer ring (12 tiles). In the case of the two value-9 tiles, both of their resources lie on the outer ring. This may not be enough to push fertility up to the next level. Along the map's edge, one resource within the inner ring doesn't seem enough, either. The two value-10 tiles have one resource located on the inner ring and one on the outer. My guess is that this combination is enough to bump the fertility up to the next level. Near the centre of the map, two resources in the outer ring will push values up to the next level – hitting the max at 15.

BTW, are you reading from the all-plains graphic I posted or did you go and export that thing as a map file using MapEdit? If so, the resource seed is 56.

A couple of other observations:

Rivers do not add 2 to the fertility value of a tile (as I suggested earlier in the thread). They contribute to the values of the surrounding tiles when they are used to calculate fertility. So if you have a lot of rivers within the city radius, their effect will be marked. It's probably the same for resources.

When calculating the fertility of a particular tile, the fertility values of surrounding tiles are not factored in to the equation; neither is the calculation based on a simple fertile/non-fertile rule. Terrain slot is what determines a tile's contribution to fertility. If you surround a grassland/plains tile with a uniform terrain type, it will end up with values like these (resource seed constant):

Code:
Composition of City Radius   Tile Value
Grassland:                       15
Plains:                          13
Forest:                          13
Hills:                           12
Tundra:                          11
Ocean:                           11
Desert:                           8
Mountains:                        8
Glacier:                          8
Swamp:                            8
Jungle:                           8
Off-Map:                          8*
* You can't actually have a 1-tile map, but this seems pretty obvious.

It would appear then that each terrain type gets a rating of some sort.
yoshi said:
I really have no idea why I posted that question...oh wait, I remember why: I'm ********.
Welcome to the club. :D It seems it's everyone's duty to post at least one :o or :blush: in this thread. It'll be my turn next. ;)
 
Great... Keep it coming.

Wobbegong said:
BTW, are you reading from the all-plains graphic I posted or did you go and export that thing as a map file using MapEdit? If so, the resource seed is 56.

I was working with that graphic (with a changed palette).

I did a little bit of testing myself too, but I didn't have a lot of time so I didn't come up with much. I mostly just had time to catch up and refresh my memory. All I can say is that I did my testing in FW and it also had the 45-square "radius".

Welcome to the club. :D It seems it's everyone's duty to post at least one :o or :blush: in this thread. It'll be my turn next. ;)

:D
 
Mercator said:
Great... Keep it coming.
So long as I maintain interest and can be arsed. ;)

After viewing the table in my previous post, I decided to test a long-held assumption: that the rules.txt file has no effect on fertility. I can tell you, it does. The rating for each tile within the city radius is derived from the food, shield and trade values in the @TERRAIN section/s. The weightings are 3:2:1 in the same order. The rating is also affected by the ability to irrigate or mine. Terrain slots don't have hard-coded ratings.
 
Boco said:
So the often quoted idea that 'if you give glaciers good stats, then humans but not the AI will build cities' is a sacred cow about to be tipped?
No, fertility is only calculated for grasslands and plains; all other terrain types will be zero. Nothing's changed in that respect. The data from rules.txt are used to calculate the values of the tiles within the city radius of each grassland/plains tile. The fertility of a grassland/plains tile is essentially the combined value of these tiles. That means if you give glaciers really good stats, then the fertility value of any nearby grasslands and plains tiles will increase – to a maximum of 15, of course.

Nice udders. :D
 
Hi everyone. I'm Dusty, the author of MapCopy. Mercator pointed out this thread to me in an e-mail earlier, and it got me interested in trying to refine the fertility calculations in MapCopy.

From what has been posted, I tried to find a constant c so that a formula like:

fertility = (food potential * 3 + shield potential * 2 + trade production) / c

would correctly predict fertility. I used data gathered from an experiment in which I encircled a grass land square by desert and grassland squares and supressed all resources. I was careful only to use grassland squares without shields. The results were:

Code:
# Grassland  # desert fertility
10           10       11
 9           11       10
 8           12       10
 7           13       10
 6           14        9
 5           15        9
 4           16        8
 3           17        8
 2           18        8
 1           19        8
 0           20        8

But no matter how I tried, I couldn't quite get things to add up. So it looks like there's another factor or a more complex algorithm being used.
 
Dusty said:
Hi everyone. I'm Dusty, the author of MapCopy. Mercator pointed out this thread to me in an e-mail earlier, and it got me interested in trying to refine the fertility calculations in MapCopy.
Hi Dusty. Glad you could join the discussion.
Dusty said:
But no matter how I tried, I couldn't quite get things to add up. So it looks like there's another factor or a more complex algorithm being used.
One factor that you overlooked was the different weightings for tiles in the inner and outer rings of the city radius. I found that the weightings were as follows:

Centre tile: 4
Inner Ring (8 tiles): 2
Outer Ring (12 tiles): 1

That gave me values of 4, 8 and 16 for C, depending on the location of the tile/s. Using these values, the results I obtained were linear when I tested only the centre tile, but when I used tiles from the inner or outer rings, or multiple tiles, there appeared to be some kind of rounding present in one or more stages of the calculation. Further investigation is required.

I haven't looked at the effect of resource seed on this algorithm. From the all-plains map posted earlier, it can be seen that the resource tiles had slightly lower fertility values, but the values of tiles with resources in their inner and outer rings generally increased.
 
Wobbegong said:
That means if you give glaciers really good stats, then the fertility value of any nearby grasslands and plains tiles will increase – to a maximum of 15, of course.
In case it wasn't obvious, I should add that making changes to the stats in rules.txt after the 'build world' phase will not affect fertility values.

kobayashi said:
if we've reached a definitive understanding of how the fertility thing works, could someone (wobbegong?) come up with an article for the reference section?
But we haven't – and I haven't looked at it since my last post. In any event, I think a link to this thread when the issue of fertility is raised will suffice.
 
Back
Top Bottom