Each faction's AI has a debug button to force a strategy meeting
Each concern has a debug button to force-pick a concern

Things that should return getMarkets():

- Commodity competition: Markets which produce the good
- Pirate activity: Afflicted markets?
- Import dependency: Markets which produce the good

== General concept ==
Each faction is presented with a list of `concerns`, categorized into economic, military and diplomatic (e.g. 'we have an enemy colony in one of our systems')
Each concern has a 'menu' of `actions` to deal with it (e.g. if we have an economic competitor
    we could build our own industry further, raid them, or sabotage them with operatives)
Concept: Other factions may also have `responses` to our actions, e.g. respond to our provocations or our diplomatic overtures?

Which concerns a faction cares about more, and which actions it is more likely to take, depend on its personality

Strategic actions can have states: presented, ongoing, failed
each faction can do X actions of a given type (econ, mil, diplo) every N months?

On every strategic AI iteration:
	Review all existing concerns, check if still relevant
		If yes, gradually increase priority?
		If not, remove
	Add new concerns
	
	If we have actions available, take an action on the highest priority concern of that type
		Once we decide to action a concern, generate list of possible actions and pick the most favored one

Once strategic AI is implemented, disable most previous implementations like invasion fleet generation, etc.
Exception: Factions without strategic AI should continue auto-building this on market size growth, for one
    Pirates should not have strategic AI if pirate invasions are off?

== General todo ==
Disable current automatic/periodic systems for:
- Launching invasions/raids (except Templars?)
- Launching base strikes
- Deliberate diplomatic action
- Joining/merging/forming alliance
- Initiating war/making peace
    - War/peace events should now initiate an alliance vote _before_ triggering said event, and player should be allowed to start a vote
- Industry construction

== Desires ==
Several types
- Revanchism: Take planet stolen from us
- Expansion: Take new uninhabited or enemy-held planets
- Security: Take planets in same system, invest in defenses
- Friendship: Make peace with an enemy, get to a certain relationship with a faction, form alliances against enemies
- Wealth: Achieve a given market share in a commodity, gain industry of a type not already possessed, add value to our commodities?, undermine economic competitor

Periodically update desires

Some leaders are more likely to have desires of a certain type than another

Leaders have traits that affect the priority given to each strategic action (see below)

== Favors ==
Doing nice things for a faction will make them more likely to help you when you ask for it


== Priority modifiers ==
High militaristic alignment increases preference for military concerns/actions
High diplomatic alignment increases preference for diplomatic concerns/actions
Monopolist trait increases preference for economic concerns/actions
Devious trait increases preference for covert actions
Submissive trait increases preference for appeasing powerful factions, envious does opposite
Weak-willed trait reduces preference for military actions
Suspicious and predatory traits increase preference for military and hostile actions
Neutralist trait reduces preference for hostile actions

== Concerns ==
TODO: Hide concerns of too-low priority?

May need improvement:
- Import dependency: tends to linger around forever because it's not actually fixable
- Market has inadequate defenses: seems to rarely if ever trigger; I've tried increasing the threshold so let's see how it goes
	- Also needs to increase its priority if recently attacked
	- Write and run a debug command to benchmark markets

Not yet done:

- Border security (what's this?)
- [todo] Sabotage market we have an offensive fleet en route to
- Faction smaller than adversaries
- Fleet pool generation below adversaries
- Insufficient accessibility for full exports?
- [todo]Low stability/high unrest
- [todo]Losing war (how to determine?)
    - Maybe just high war weariness is sufficient


== Strategic action ==
Not yet done:

- Deploy defense fleets?
- Send relief fleet?
- Send colony expedition (maybe implement the lottery system for this)
- [todo] Build/upgrade ground defense
- [todo] Build/upgrade orbital station
- [todo] Build/upgrade military base
- Story point upgrade industry
- Purchase special item from salvagers

Actions have a 'get priority' method and a cooldown

== Strategy evaluator ==
Intel item
- In several categories (military, economic, etc.) assess our situation and print a report

Military threats
- I dunno if the below makes sense, fleets don't have limited striking range

- Each potential enemy system emits a threat radius based on its size and military presence
- Each of our systems emits a concern radius based on its size (and a measurement of economic value?)
- If the sum of the radii exceeds the physical distance between the systems, flag this as a concern
    - Difference needed to cause concern
- Iterate over all our systems, and all systems (with a reasonable population) belonging to factions that aren't at least favorable with us
    - Create a StrategicInfoHelper class to cache each system's power projection

- Markets in shared systems are always a threat

Diplomacy concerns
- Powerful would-be enemy factions: appease or coalition against
- Powerful enemy factions: find allies, or make peace if weariness high (also depends on whether we're vengeful to them)

Economy concerns
- Should look for undersupplied markets and supply them

== Writeup ==

### Strategy AI basics ###
Each relevant faction (usually excluding pirates, indies and such) has a strategy AI. The AI has four _modules_, designated: military, economic, diplomatic, and executive.

Every month or so, the faction holds a _strategy meeting_. The military, economic and diplomatic modules generate strategic _concerns_, which are things the AI is worried about or wants to do. For example, 'retake this market from another faction' or 'further develop positive relations with this faction'. Afterwards, the executive module goes through all current concerns and picks the two highest priority concerns (see below) to generate _actions_ for. An action can be things like 'build an industry', 'trigger a positive diplomatic action' or 'launch a raid'.

Each concern and action has a _priority_ value, generated based on how significant the concern is and how useful the action is considered. Priorities are modified by faction alignments and traits, e.g. a militaristic faction will focus more on military concerns and military solutions to its concerns.

Up to two concerns (but sometimes only one or none) can be acted on per strategy meeting. No new actions can be taken on a concern until the current one is completed, and for a brief period of time after. Factions will also prefer to not use the same action over and over.

### Concern definitions ###
New concerns can be found in data/config/exerelin/strategicAIConfig.json; comments on various items are in that file. New concerns and actions can be added to this file, directly or by a separate mod.

### Writing a new concern/action ###
TBD if enough demand