God-Emperor
Deity
I am forced to agree with Strategist83's assessment of the FF game. I've come across the same problem in the B5 mod and until recently have not been able to do very much about it. I've added 1 food to the benefits of having a trade route between 2 cities/solar systems. This has helped but I've also made having access to one of the food resources provide a benefit in food growth to all cities/star systems connected to it. The only problem with doing this is the AI is still not growing enough as, as stated above, the AI prefers production and/or credits over food planets.
Is there anything that can be done to get the AI to use the food planets as a higher priority?
It is possible to shift the priorities. It is also possible to make them reevaluate their population distribution across the planets in star systems more often - in the late game it is done rather infrequently.
Currently, the target minimum food surplus is 3. In the early game this is plenty and in the late game they are usually producing over that simply because the planets usually produce more than that. You could bump it up to 4, but I probably wouldn't go over that, or possibly give it a +1 for every 5 population in the system (if under the happy cap, anyway).
Perhaps something like this, in CvAI.py in the doCityAIUpdate function...
current:
Code:
# Place population 1 by 1
for iPopLoop in range(iPopulationToAssign):
printd("\n iPopLoop = %d" % (iPopLoop))
#printd(iPopLoop)
# Determine what the new most important yield is
# Always need food to grow
if (iSurplusFood < 3):
iYieldNeededMost = 0
else:
iYieldNeededMost = 1
Code:
[B][COLOR="DarkRed"]iFoodMin = 3
if (pCity.getPopulation() < pSystem.getPopulationLimit() and pCity.angryPopulation(0) == 0):
iFoodMin += pCity.getPopulation()/5[/COLOR][/B]
# Place population 1 by 1
for iPopLoop in range(iPopulationToAssign):
printd("\n iPopLoop = %d" % (iPopLoop))
#printd(iPopLoop)
# Determine what the new most important yield is
# Always need food to grow
if (iSurplusFood < [B][COLOR="DarkRed"]iFoodMin[/COLOR][/B]):
iYieldNeededMost = 0
else:
iYieldNeededMost = 1
The AI could also stand to do a full population reassignment from time to time. At the moment it will do a full reassignment only if the unassigned population is negative (which ought to happen if it whips or drafts or starves except for starving away an unhappy population point) or if the surplus food is less than 0, which normally only happens if the population has grown but there is either not place to put it or the only available planets for it produce no food. It might be better to make it do a reassignment if the food is <= 0 instead of just <0 if under the happy cap. It might also be good to just force a reassignment ever X turns regardless of any other consideration. For this, changes would be in FinalFrontierEvents.py in the updateHumanCityTurn function, right at the end.
current:
Code:
elif (not pCity.isDisorder()): # post v1.81 - try to avoid starvation:
# If the city is not in disorder, check to see if the food produced is less than the food consumed.
# note: If the city has serious happiness or health issues it may do this every turn to no avail.
# Especially if it is The Forge with its -1 food per city. Oh well.
iSurplusFood = pCity.getYieldRate(0) - (pCity.getPopulation() * gc.getDefineINT("FOOD_CONSUMPTION_PER_POPULATION"))
if (iSurplusFood < 0):
printd("updateHumanCityTurn: detected starvation in %s, net food = %d" % (pCity.getName(), iSurplusFood))
AI.doCityAIUpdate(pCity)
Code:
elif (not pCity.isDisorder()): # post v1.81 - try to avoid starvation:
# If the city is not in disorder, check to see if the food produced is less than the food consumed.
# note: If the city has serious happiness or health issues it may do this every turn to no avail.
# Especially if it is The Forge with its -1 food per city. Oh well.
iSurplusFood = pCity.getYieldRate(0) - (pCity.getPopulation() * gc.getDefineINT("FOOD_CONSUMPTION_PER_POPULATION"))
if (iSurplusFood < 0):
printd("updateHumanCityTurn: detected starvation in %s, net food = %d" % (pCity.getName(), iSurplusFood))
AI.doCityAIUpdate(pCity)
[B][COLOR="DarkRed"]elif (iSurplusFood == 0 and pCity.getPopulation() < pSystem.getPopulationLimit() and pCity.angryPopulation(0) == 0):
printd("updateHumanCityTurn: no food surplus when not at pop limit")
AI.doCityAIUpdate(pCity)
elif (CyGame().getGameTurn() % 15 == pCity.getOwner()):
printd("updateHumanCityTurn: periodic population reassignment")
AI.doCityAIUpdate(pCity)[/COLOR][/B]
This might get the AI out of the "whipped and/or drafted my population way down and now the population is not growing" situation it gets itself into.
As pointed out, the current benefits from whipping are not fantastic and the AI still tends to do it more than it should even after I put some limits on it in the DLL, especially if the AI is also able to draft. It may be good to increase the production per population point from 30 to 40, or perhaps even 50, just to help the AI get more value from it. This involves bringing the CIV4HurryInfo.xml from plain Civ into the mod and editing it to change the iProductionPerPopulation value for the HURRY_POPULATION hurry type.
If anybody tries any of these changes, let me know if it helps any.