I think Mapcopy could be looked at for a solution. Apparently it also works with land mass numbers besides just fertility. From the readme:
Body Counter (+bc)
The Body Counter is an integer assigned to each continent. It may be used to determine if a trade route is between two continents or not. You can see this information by enabling cheat mode and positioning the cursor on a square. The number next to the square's location is its body counter.
Note that if you are copying from a .MP file to a .SAV file, I recommend validating the .MP file before saving it. This will cause the Map Editor to calculate Body Counters for continents. Failure to do so may cause trade routes to behave strangely. (For additional information for ToT saved games see the Multi-Map Copies section below).
The Body Counter is an integer assigned to each continent. It may be used to determine if a trade route is between two continents or not. You can see this information by enabling cheat mode and positioning the cursor on a square. The number next to the square's location is its body counter.
Note that if you are copying from a .MP file to a .SAV file, I recommend validating the .MP file before saving it. This will cause the Map Editor to calculate Body Counters for continents. Failure to do so may cause trade routes to behave strangely. (For additional information for ToT saved games see the Multi-Map Copies section below).
Fertility (+f)
This information determines how desirable a square is for building a city, this is used by the AI to pick city locations. Normally, only grasslands and plains are considered fertile, so the AI won't build cities on other terrain types. The fertility is usually considered low if a grassland or plains square is next to a city.
When copying from a .MP file to a .SAV file, there is no fertility information in the .MP file to copy. To handle this, MapCopy can calculate a value for fertility, similar to the values the game calculates. By default, when copying from a .MP file to a .SAV file, the +f:CALC option is on, which calculates fertility information. When copying from a .SAV to another .SAV file, the +f:ADJUST option is on. This copies fertility information, but adjusts it to be lower when a city is nearby.
Additionally, the +f:CALCALL option will cause MapCopy to calculate a fertility value for all terrain types. This should cause the AI to build cities on non grassland/plain squares. I don't know how this affects the AI's game playing ability. Note that CALC and CALCALL also adjust their fertility results based on the presence of a near by city.
I have attempted to come up with a formula for fertility that is as close to how Civ 2 works as I can. However, I did not have time to figure out how resources work. The following algorithm is what I came up with, and seems to work well for maps with all special resources suppressed. I'm somewhat skeptical of some of the hard coded constants in this algorithm (especially the 2/3rds
bonus for irrigation), and it may be that I'm one test case short of finding an exception to this algorithm.
begin func calc_fertility(x, y)
{
Set selfFood, selfShields, and selfTrade to be the food, shields, and trade production for the square x,y.
(See notes below on how production for a square is calculated).
Set innerFood, innerShields, and innerTrade to be the total food, shields, and trade production of the 8 adjacent to x,y.
Set outerFood, outerShields, and outerTrade to be the total food, shields, and trade production of the 12 squares in the outer ring of the city radius around x,y.
Let combinedFood = (selfFood * 4) + (innerFood * 2) + outerFood
Let combinedShields = (selfShields * 4) + (innerShields * 2) + outerShields
Let combinedTrade = (selfTrade * 4) + (innerTrade * 2) + outerTrade
Let fertility = (combinedFood * 3) + (combinedShields * 2) + (combinedTrade)
Let fertility = fertility / 16
Round fertility to the nearest integer.
If the square at x,y is a grassland square without a shield then reduce fertility by one.
If fertility < 8 then set fertility to 8.
If fertility > 15 then set fertility to 15.
return fertility
}
General Notes:
* All calculations are floating point up until the fertility is rounded to the nearest integer.
* After calculating fertility, mapcopy performs the "ADJUST" operation, which will subtract 8 from the fertility if it is >= 8 and nearby a city. "nearby" means within the nearest 45 square radius of the city. (Think the city radius with another ring added).
Notes on calculating production:
Civ 2 seems to start with the values of food, shield and trade production in RULES.TXT and then modify them as follows:
If a square can be irrigated it gets a (2/3) boost to its food production. (That's the full floating point value 2/3, 1.67 does not seem to work). Note the value of the irrigation bonus does not matter, it can be zero and the production gets a boost for the purposes of fertility.
If a square can be mined it gets a 0.5 boost to its shield production. Again, the value of the mining bonus does not matter. However, if a square can be both irrigated and mined, the mining bonus does NOT apply. (i.e. irrigation bonus overrides the mining bonus).
If a square is a grassland square without a shield, its shield production is 0 regardless of what's in RULES.TXT.
If a square is a grassland square with a shield, its shield production is 1 regardless of what's in RULES.TXT.
Note that MapCopy does not read any RULES.TXT files, but has the default values from the original Civ2 RULES.TXT hardcoded in.
This information determines how desirable a square is for building a city, this is used by the AI to pick city locations. Normally, only grasslands and plains are considered fertile, so the AI won't build cities on other terrain types. The fertility is usually considered low if a grassland or plains square is next to a city.
When copying from a .MP file to a .SAV file, there is no fertility information in the .MP file to copy. To handle this, MapCopy can calculate a value for fertility, similar to the values the game calculates. By default, when copying from a .MP file to a .SAV file, the +f:CALC option is on, which calculates fertility information. When copying from a .SAV to another .SAV file, the +f:ADJUST option is on. This copies fertility information, but adjusts it to be lower when a city is nearby.
Additionally, the +f:CALCALL option will cause MapCopy to calculate a fertility value for all terrain types. This should cause the AI to build cities on non grassland/plain squares. I don't know how this affects the AI's game playing ability. Note that CALC and CALCALL also adjust their fertility results based on the presence of a near by city.
I have attempted to come up with a formula for fertility that is as close to how Civ 2 works as I can. However, I did not have time to figure out how resources work. The following algorithm is what I came up with, and seems to work well for maps with all special resources suppressed. I'm somewhat skeptical of some of the hard coded constants in this algorithm (especially the 2/3rds
bonus for irrigation), and it may be that I'm one test case short of finding an exception to this algorithm.
begin func calc_fertility(x, y)
{
Set selfFood, selfShields, and selfTrade to be the food, shields, and trade production for the square x,y.
(See notes below on how production for a square is calculated).
Set innerFood, innerShields, and innerTrade to be the total food, shields, and trade production of the 8 adjacent to x,y.
Set outerFood, outerShields, and outerTrade to be the total food, shields, and trade production of the 12 squares in the outer ring of the city radius around x,y.
Let combinedFood = (selfFood * 4) + (innerFood * 2) + outerFood
Let combinedShields = (selfShields * 4) + (innerShields * 2) + outerShields
Let combinedTrade = (selfTrade * 4) + (innerTrade * 2) + outerTrade
Let fertility = (combinedFood * 3) + (combinedShields * 2) + (combinedTrade)
Let fertility = fertility / 16
Round fertility to the nearest integer.
If the square at x,y is a grassland square without a shield then reduce fertility by one.
If fertility < 8 then set fertility to 8.
If fertility > 15 then set fertility to 15.
return fertility
}
General Notes:
* All calculations are floating point up until the fertility is rounded to the nearest integer.
* After calculating fertility, mapcopy performs the "ADJUST" operation, which will subtract 8 from the fertility if it is >= 8 and nearby a city. "nearby" means within the nearest 45 square radius of the city. (Think the city radius with another ring added).
Notes on calculating production:
Civ 2 seems to start with the values of food, shield and trade production in RULES.TXT and then modify them as follows:
If a square can be irrigated it gets a (2/3) boost to its food production. (That's the full floating point value 2/3, 1.67 does not seem to work). Note the value of the irrigation bonus does not matter, it can be zero and the production gets a boost for the purposes of fertility.
If a square can be mined it gets a 0.5 boost to its shield production. Again, the value of the mining bonus does not matter. However, if a square can be both irrigated and mined, the mining bonus does NOT apply. (i.e. irrigation bonus overrides the mining bonus).
If a square is a grassland square without a shield, its shield production is 0 regardless of what's in RULES.TXT.
If a square is a grassland square with a shield, its shield production is 1 regardless of what's in RULES.TXT.
Note that MapCopy does not read any RULES.TXT files, but has the default values from the original Civ2 RULES.TXT hardcoded in.
Comment