AI layout
Posted: Sun Mar 30, 2008 5:28 pm
As the AI is becoming more complex, we should give some thought to the layout and interaction of the individual AI modules. Below is the layout which I would suggest. Color-coded status of coding.
FreeOrionAI
- initialisation of AI
- holds AIstate class
- save/loads AIstate
- calls individual AI modules every turn
AIstate
- manages missions: hold [fleetID / (systemID or planetID or fleetID)] pairs
- manages shipRoles: associates design IDs with ship roles
- manages fleetRoles: associates fleet IDs with fleet roles
- stores colonisable planets
- stores empire priorities
The AIstate provides an interface by which the individual AI modules can share information.
- missions: the idea behind missions is that the AI will need to keep track of its fleets and their orders, so that it will not interrupt their orders and so that it can check if a fleet has fulfilled its orders.
The AI recognises different missionTypes that decide which information is actually stored within the mission. The key to access a mission is always a fleetID, the returned value depends on the missionType (exploration: systemID, colonisation: planetID, fleetMerging: fleetID).
- shipRoles: associate a ship design ID with the purpose for which it has been designed. Will enable the AI to create specific fleets. Will be assigned at start of a game as well as when a new ship is designed.
- fleetRoles: associate a fleet ID with the purpose for which it has been formed (which is a missionType). Helps the AI to specifically pick fleets for a certain mission. Will be assigned at start of a game as well as when a new fleet is formed.
FleetUtils
provides helper functions for fleet operations
- splitting fleets
- checking if a fleet has a ship with a certain role
- getting a ship of a certain role from a fleet (for colonisation)
- getting the fleets of an empire
- getting all fleets with a certain role
- extracting fleets without mission
- assessing the role of a ship (later identifying by parts)
- assessing the role of a fleet (currently by most prominent ship type; fleets with colony ships should always be colony fleets)
PrioritiesAI / DemandAI [The Silent One]
- calculates priorities of an empire
- should calculate priorities, eg. Food, Minerals, Production, Research, Money, Exploration, Colonyships, Military, Defense, Shipyards;
- different categories of priorities (resources, production, research)?
ExplorationAI
ColonisationAI
ResearchAI [m_k]
ProductionAI [The Silent One] (~50%)
ResourceManagementAI
WarfareAI
DiplomacyAI
DesignAI
AIEnumerators (currently in AIgamestate module)
- will hold AI enumerators
FreeOrionAI
- initialisation of AI
- holds AIstate class
- save/loads AIstate
- calls individual AI modules every turn
AIstate
- manages missions: hold [fleetID / (systemID or planetID or fleetID)] pairs
- manages shipRoles: associates design IDs with ship roles
- manages fleetRoles: associates fleet IDs with fleet roles
- stores colonisable planets
- stores empire priorities
The AIstate provides an interface by which the individual AI modules can share information.
- missions: the idea behind missions is that the AI will need to keep track of its fleets and their orders, so that it will not interrupt their orders and so that it can check if a fleet has fulfilled its orders.
The AI recognises different missionTypes that decide which information is actually stored within the mission. The key to access a mission is always a fleetID, the returned value depends on the missionType (exploration: systemID, colonisation: planetID, fleetMerging: fleetID).
- shipRoles: associate a ship design ID with the purpose for which it has been designed. Will enable the AI to create specific fleets. Will be assigned at start of a game as well as when a new ship is designed.
- fleetRoles: associate a fleet ID with the purpose for which it has been formed (which is a missionType). Helps the AI to specifically pick fleets for a certain mission. Will be assigned at start of a game as well as when a new fleet is formed.
FleetUtils
provides helper functions for fleet operations
- splitting fleets
- checking if a fleet has a ship with a certain role
- getting a ship of a certain role from a fleet (for colonisation)
- getting the fleets of an empire
- getting all fleets with a certain role
- extracting fleets without mission
- assessing the role of a ship (later identifying by parts)
- assessing the role of a fleet (currently by most prominent ship type; fleets with colony ships should always be colony fleets)
PrioritiesAI / DemandAI [The Silent One]
- calculates priorities of an empire
- should calculate priorities, eg. Food, Minerals, Production, Research, Money, Exploration, Colonyships, Military, Defense, Shipyards;
- different categories of priorities (resources, production, research)?
ExplorationAI
ColonisationAI
ResearchAI [m_k]
ProductionAI [The Silent One] (~50%)
ResourceManagementAI
WarfareAI
DiplomacyAI
DesignAI
AIEnumerators (currently in AIgamestate module)
- will hold AI enumerators