The reason founding worked and transfer didn't probably is that when you capture/gift a city it creates a brand new one for the new leader, then copies data over from the old city to the new one for the new leader to have a "duplicate" so anything run during the founding process is run per player, and things which might be different from one player to another require modification of the transfer process.
Teaching the AI isn't actually that hard. Deciding what to teach it is the trick.
Everything you want to do for the AI will be done within:
Code:
TechTypes CvPlayerAI::AI_bestTech(int iMaxPathLength, bool bIgnoreCost, bool bAsync, TechTypes eIgnoreTech, AdvisorTypes eIgnoreAdvisor)
This function is where the AI decides precisely what it wants to research. Numbers tend to be fairly high on this function, so keep in mind that there is about a 2000 point gap between techs where the AI considers they are worth "about the same" as each other. So the defining "THIS IS ALWAYS THE BETTER CHOICE" value is in excess of 4,000.
You want to scroll down to the line reading:
Code:
iValue += kTeam.getResearchProgress((TechTypes)iI);
Everything up to this point you can consider to be "administration" and is required no matter which tech you attach these fields to. Just look at how each of the "chunks" of code look from here in on the function and I think you'll understand what to do REAL quickly.
Things which might be useful to know about though:
The AI has set values for each yield depending on personality and strategy. Incorporating those will be important, so look at this section of the code:
Code:
for (iJ = 0; iJ < GC.getNumImprovementInfos(); iJ++)
{
for (iK = 0; iK < NUM_YIELD_TYPES; iK++)
{
iTempValue = 0;
iTempValue += (GC.getImprovementInfo((ImprovementTypes)iJ).getTechYieldChanges(iI, iK) * getImprovementCount((ImprovementTypes)iJ) * 50);
iTempValue *= AI_yieldWeight((YieldTypes)iK);
iTempValue /= 100;
iValue += iTempValue;
}
}
And it shows you a good approach to using those weights.
Also from the section on deciding about gaining access to new improvements they teach the computer that food is vital, and that if your finances are shot, commerce rules.
Code:
// food bonuses are more valueble
if (iL == YIELD_FOOD)
{
iTempValue *= 2;
}
// otherwise, devalue the bonus slightly
else if (iL == YIELD_COMMERCE && bFinancialTrouble)
{
iTempValue *= 4;
iTempValue /= 3;
}
else
{
iTempValue *= 3;
iTempValue /= 4;
}
Really that is about all you need to know I think. Don't forget to multiply by the number of cities the player owns somewhere, since this bonus is applied per city. Someone with 20 cities will value such a tech FAR more than someone with a single city.