From what I see in the documentation, activation and scope of all effects are evaluated first, and then the effects are evaluated in the order determined by priorities and sources. So we only care about precedence of values evaluation.
A topology of effects based on their dependencies on other meters or effects could be
- Unordered Independent: depends on nothing, nothing depends on them, order does not matter because there are no concurrent effects or because order of application is irrelevant (e.g. SetEmpireCapital, as long a there can't be two Capital buildings finishing at the same time).
- Ordered Independent: depends on nothing, nothing depends on them, order matters for GUI or for overlapping effects (e.g. mine effects, where the strongest ones must activate first and disable the activation of the others).
- Ordered Population Dependent: depends on Population, nothing depends on them, order matters because there are additive effects before and after scaling effects (TargetResearch, TargetIndustry, TargetStockpile, MaxTroops...). All these could also depend on Happiness, but that is not a thing currently (Happiness is used only on activation/scope to gate effects but not to modify them as a factor or whatever).
All "current" meters are dependent on their corresponging Target/Max meters, that is not considered above.
Happiness and TargetHappiness currently are (Ordered) Independent, but we can't discard some dependence on Population and TargetPopulation (overpopulation could be a thing in the future). So (Target)Happiness effects should apply after Population effects and before any Dependent effect.
So we could have something like
- TargetPopulation (TARGET_POPULATION)
- Population (POPULATION)
- TargetHappiness (TARGET_HAPPINESS)
- Happiness (HAPPINESS)
- Rest of target meters (TARGET_OTHER)
- Rest of meters (OTHER)
That is, adding a dedicated tier of priorities for Happiness meters.
Within each stage, different levels for [EARLY|LATE]_BEFORE_[1ST|2ND]_SCALING , [1ST|2ND]_SCALING, [EARLY|LATE]_AFTER_[1ST|2ND]_SCALING and [1ST|2ND]_OVERRIDE could be used as needed.
Current default priority would correspond to OTHER_BEFORE_SCALING. Target meters using DEFAULT_PRIORITY chould use TARGET_DEFAULT_PRIORITY.
...
I'm working on a complete proposal.