Plodding on with my research into Forts I've learned how it is the AI determines what resources to guard.
First, you need a unit to have the UNITAI_RESERVE...and then there is a chance
it will be given the mission GUARD_RESOURCE.
I'm working on how to determine when units will be "RESERVE"
But assuming you have some reserves...AND the AI doesn't think it needs more units to either: Guard a city or guard an airlift, then the units will go and stand on a resource.
What resource the choose to stand on is determined via a function in the SDK...I don't know yet if python modifies this value.
The formula is roughly something like this:
((100*Happy +100*Health)
+(40 per unit "AND" prereq + 30 per unit "OR" prereq + unit production modifier /10) * 1.5 for units it can build or divided by the difference in tech eras from where it is now
+(30 per unit "AND" prereq + 20 per unit "OR" prereq + building production modifier /10) * 1.5 for buildings it can build or divided by the difference in tech eras from where it is now.
+ 2 * project building modifier /10 * 1.5 for projects it can build or divided by the difference in tech eras from where it is now. )
/ 10
= PlotValue
If the value of ANY plot is greater than 10 and is greater than all other plots
AND
the function isVisibleEnemyUnit returns true for that plot
THEN
the RESERVE unit running the AI mission function will be assigned to guard the plot
MY CONCLUSIONS ARE...
The best way to get the AI to guard a plot is to pile on the health and happy bonuses. Absurdly high numbers for these values should result in high numbers of guards.
However, if the civ can also build non-obsolete units and buildings that require a resource, then it only takes a few of these to catch up to a single health or happiness bonus.
So, if for instance mages, archmages, and liches all required a tower resource, and the AI could build them all, then a tower resource would get 40*3*1.5/10 = 18 for a plot value, which is better than a single happiness, so the AI would be more inclined to guard that resource, and any fort that happened to be on it.
at least I think thats about how it works...
now on to find out how to encourage more "RESERVE" units from the AI...