45°38'N-13°47'E
Deity
I agree it is working (as in, I see it modifies my science output in games) but I agree with others that have had some strange experiences. Possibly you are right in that this is as designed. However I would like to take a look at the source code to verify this for myself... Where in the source exactly is tech diffusion?
Here's the code, in red the part I've modified, although it's still experimental
Spoiler :
Code:
int CvPlayer::calculateResearchModifier(TechTypes eTech) const
{
int iModifier = 100;
if (NO_TECH == eTech)
{
return iModifier;
}
int iKnownCount = 0;
int iPossibleKnownCount = 0;
/************************************************************************************************/
/* BETTER_BTS_AI_MOD 07/27/09 jdog5000 */
/* */
/* Tech Diffusion */
/************************************************************************************************/
if( !GC.getGameINLINE().isOption(GAMEOPTION_NO_TECH_DIFFUSION) )
{
double knownExp = 0.0;
// Tech flows better through open borders
for (int iI = 0; iI < MAX_CIV_TEAMS; iI++)
{
if (GET_TEAM((TeamTypes)iI).isAlive())
{
if (GET_TEAM((TeamTypes)iI).isHasTech(eTech))
{
if (GET_TEAM(getTeam()).isHasMet((TeamTypes)iI))
{
knownExp += 0.5;
if( GET_TEAM(getTeam()).isOpenBorders((TeamTypes)iI) || GET_TEAM((TeamTypes)iI).isVassal(getTeam()) )
{
knownExp += 1.5;
}
else if( GET_TEAM(getTeam()).isAtWar((TeamTypes)iI) || GET_TEAM(getTeam()).isVassal((TeamTypes)iI) )
{
knownExp += 0.5;
}
}
}
}
}
int techDiffMod = GC.getTECH_DIFFUSION_KNOWN_TEAM_MODIFIER();
if (knownExp > 0.0)
{
iModifier += techDiffMod - (int)(techDiffMod * pow(0.85, knownExp) + 0.5);
}
// Tech flows downhill to those who are far behind
int iTechScorePercent = GET_TEAM(getTeam()).getBestKnownTechScorePercent();
int iWelfareThreshold = GC.getTECH_DIFFUSION_WELFARE_THRESHOLD();
if( iTechScorePercent < iWelfareThreshold )
{
if( knownExp > 0.0 )
{
iModifier += (GC.getTECH_DIFFUSION_WELFARE_MODIFIER() * (iWelfareThreshold - iTechScorePercent));
[COLOR="Red"] if (iTechScorePercent < (iWelfareThreshold/8)) //45° attempt at making a better tech diffusion code; still to be modified probably from here
{
iModifier += (GC.getTECH_DIFFUSION_WELFARE_MODIFIER() * (iWelfareThreshold - iTechScorePercent))*10;
}
else if ((iTechScorePercent < (iWelfareThreshold/5)) && (iTechScorePercent >= (iWelfareThreshold/8)))
{
iModifier += (GC.getTECH_DIFFUSION_WELFARE_MODIFIER() * (iWelfareThreshold - iTechScorePercent))*6;
}
else if ((iTechScorePercent < (iWelfareThreshold/4)) && (iTechScorePercent >= (iWelfareThreshold/5)))
{
iModifier += (GC.getTECH_DIFFUSION_WELFARE_MODIFIER() * (iWelfareThreshold - iTechScorePercent))*4;
}
else if ((iTechScorePercent < (iWelfareThreshold/2)) && (iTechScorePercent >= (iWelfareThreshold/4)))
{
iModifier += (GC.getTECH_DIFFUSION_WELFARE_MODIFIER() * (iWelfareThreshold - iTechScorePercent))*2;
}
else if ((iTechScorePercent >= (iWelfareThreshold/4)) && (iTechScorePercent < iWelfareThreshold )) //to here
{
iModifier += (GC.getTECH_DIFFUSION_WELFARE_MODIFIER() * (iWelfareThreshold - iTechScorePercent));
}
}
// 45° attempt to make tech diffusion scalable with difficulty level for human players (empyrical attempt) from here
for (int iI = 0; iI < MAX_CIV_TEAMS; iI++)
{
if (GET_TEAM((TeamTypes)iI).isHuman())
{
iModifier *= 2;
iModifier /= (3+ getHandicapType());
}
}
//to here [/COLOR]
}
}
else
{
// Default BTS code
for (int iI = 0; iI < MAX_CIV_TEAMS; iI++)
{
if (GET_TEAM((TeamTypes)iI).isAlive())
{
if (GET_TEAM(getTeam()).isHasMet((TeamTypes)iI))
{
if (GET_TEAM((TeamTypes)iI).isHasTech(eTech))
{
iKnownCount++;
}
}
iPossibleKnownCount++;
}
}
if (iPossibleKnownCount > 0)
{
iModifier += (GC.getDefineINT("TECH_COST_TOTAL_KNOWN_TEAM_MODIFIER") * iKnownCount) / iPossibleKnownCount;
}
}
int iPossiblePaths = 0;
int iUnknownPaths = 0;
for (int iI = 0; iI < GC.getNUM_OR_TECH_PREREQS(); iI++)
{
if (GC.getTechInfo(eTech).getPrereqOrTechs(iI) != NO_TECH)
{
if (!(GET_TEAM(getTeam()).isHasTech((TechTypes)(GC.getTechInfo(eTech).getPrereqOrTechs(iI)))))
{
iUnknownPaths++;
}
iPossiblePaths++;
}
}
FAssertMsg(iPossiblePaths >= iUnknownPaths, "The number of possible paths is expected to match or exceed the number of unknown ones");
if( iPossiblePaths > iUnknownPaths )
{
iModifier += GC.getTECH_COST_FIRST_KNOWN_PREREQ_MODIFIER();
iPossiblePaths--;
iModifier += (iPossiblePaths - iUnknownPaths) * GC.getTECH_COST_KNOWN_PREREQ_MODIFIER();
}
// AIAndy: It causes a tech cost increase instead now
//iModifier -= GC.getEraInfo((EraTypes)GC.getTechInfo(eTech).getEra()).getTechCostModifier();
// AIAndy: Such hard coded changes should not be in the DLL like that. If such an adaption of tech rate to game option is desired, it should be in a global def at least.
/*if( GC.getGameINLINE().isOption(GAMEOPTION_START_AS_MINORS)
&& (GC.getGameINLINE().getStartEra() == 0) )
{
switch(GC.getTechInfo(eTech).getEra())
{
case 0:
iModifier += 5;
break;
case 1:
iModifier += 20;
break;
case 2:
iModifier += 10;
break;
}
if(GC.getGameINLINE().isOption(GAMEOPTION_NO_TECH_TRADING))
{
iModifier += 10;
} else if(GC.getGameINLINE().isOption(GAMEOPTION_NO_TECH_BROKERING))
{
iModifier += 5;
}
}*/
// AIAndy: It causes a tech cost increase instead now
//iModifier -= GC.getTECH_COST_MODIFIER();
return std::max(1,iModifier);
/************************************************************************************************/
/* BETTER_BTS_AI_MOD END */
/************************************************************************************************/
}
Edit:
Possibly a way to reduce confusion would be to split up the beakers shown on the top left of the HUD. Maybe show the base science beakers + tech diffusion beakers? Having the base beakers include tech diffusion makes it hard to tell if my science output is good or not, as I can't tell what my base numbers are. To be clear, this is just a visual change, not a mechanic change.
You're right, that could be a good idea, I'm working on it.