ResourcesAI Module

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
Gray Area
Space Floater
Posts: 44
Joined: Sat Sep 24, 2011 4:39 pm

ResourcesAI Module

#1 Post by Gray Area » Fri Jan 06, 2012 5:55 pm

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.
Attachments
GA_Contribution_05.zip
(4.56 KiB) Downloaded 35 times

Post Reply