Page 1 of 1

ResourcesAI Module

Posted: Fri Jan 06, 2012 5:55 pm
by Gray Area
Attached is an incremental revision to the ResourcesAI module, its supporting PlanetUtilsAI module, and a minor revision to the PriorityAI module.

The revision to the ResourcesAI module allows the resource focus of all AI empire owned planets to be changed in accordance with the empire’s changing resource priorities. In addition, asteroid planets will now change their resource focus to minerals after Orbital Farming is researched, and gas giant planets will now change their resource focus to research after Orbital Farming is researched.

The attachment includes the following three (3) revised AI modules:

PlanetUtilsAI.py
PriorityAI.py
ResourcesAI.py

Module revisions include the following:

PlanetUtilsAI.py

__Added def getTypePlanetEmpireOwned(planetType):
__Deleted unneeded def getCapitalID():

PriorityAI.py

__Added def calculateResearchPriority():
__Tweaked def calculateFoodPriority():
__Rearranged some functions to correspond to their order in the EnumsAI module

ResourcesAI.py

__Added def topResourcePriority():
__Added def setCapitalIDResourceFocus():
____Removed existing method from def generateResourceOrders():
____Added elif topPriority == AIPriorityType.PRIORITY_RESOURCE_RESEARCH: condition.
__Added setGeneralPlanetResourceFocus():
__Added def setAsteroidsResourceFocus():
__Added def setGasGiantsResourceFocus():
__Added def printResourcesPriority():
__Revised def generateResourceOrders():

These revised modules have been run successfully on FO v0.3.17 [SVN 4570] MSVC 2010.

I release my contribution under the terms of the Creative Commons Attribution-ShareAlike 3.0 and GNU GPL 2.0 licenses.