45°38'N-13°47'E
Deity
Ok, I've uploaded my changes if you want to try or have a look, Afforess.
There's another part of the code that I haven't uploaded but IMO it should work better than yours and here I explain why:
This is your code (for research, for example):
Let's assume there's just 1 player and use real values. What happens if you use both Flexible difficulty and Flexible AI and both human and AI are on deity (or if human player is simply playing on Deity)?
Since human is on deity, AI research gets multiplied by 0.65, which makes AI tech faster (first step). Then it gets multiplied by std::max(50, 100 - (65-80)) / 100, which is 1.15. So in general it's multiplied by 0.74 which makes AI tech faster than humans. But in Handicapinfo while playing on deity, human player is already slower than AI due to iResearchPercent, set to 125 on deity. So while human is already teching slower than AI while they're on the same deity level, AI gets another bonus and techs even faster.
This is my code, same assumption:
you can clearly see that AIResearchPercent is reduced to 1 in the whole process when both AI and human player are on the same handicap level. Hence human handicap is only given by a slower ResearchPercent (125%), which is what it's meant to be from the beginning.
What do you think Afforess?
There's another part of the code that I haven't uploaded but IMO it should work better than yours and here I explain why:
This is your code (for research, for example):
Code:
// Arkatakor
if (!isHuman() && !isBarbarian())
{
// The handicap type will be based on the average handicap of all human players
iCost *= GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIResearchPercent();
}
else
{
iCost *= GC.getHandicapInfo(getHandicapType()).getResearchPercent();
}
//Afforess AI Flexible Difficulty Start
if (GC.getGameINLINE().isModderGameOption(MODDERGAMEOPTION_AI_USE_FLEXIBLE_DIFFICULTY))
{
HandicapTypes eStandardDifficulty = (HandicapTypes)GC.getDefineINT("STANDARD_HANDICAP");
iCost *= std::max(50, 100 - (GC.getHandicapInfo(getHandicapType()).getAIResearchPercent() - GC.getHandicapInfo(eStandardDifficulty).getAIResearchPercent()));
iCost /= 100;
}
//Afforess AI Flexible Difficulty End
iCost /= 100;
Let's assume there's just 1 player and use real values. What happens if you use both Flexible difficulty and Flexible AI and both human and AI are on deity (or if human player is simply playing on Deity)?
Since human is on deity, AI research gets multiplied by 0.65, which makes AI tech faster (first step). Then it gets multiplied by std::max(50, 100 - (65-80)) / 100, which is 1.15. So in general it's multiplied by 0.74 which makes AI tech faster than humans. But in Handicapinfo while playing on deity, human player is already slower than AI due to iResearchPercent, set to 125 on deity. So while human is already teching slower than AI while they're on the same deity level, AI gets another bonus and techs even faster.
This is my code, same assumption:
Code:
// Arkatakor
if (!isHuman() && !isBarbarian())
{
// The handicap type will be based on the average handicap of all human players
iCost *= GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIResearchPercent();
}
else
{
iCost *= GC.getHandicapInfo(getHandicapType()).getResearchPercent();
}
iCost /= 100;
if (!isHuman() && GC.getGame().isModderGameOption(MODDERGAMEOPTION_AI_USE_FLEXIBLE_DIFFICULTY))
{
iCost *= 100;
iCost /= GC.getHandicapInfo(getHandicapType()).getAIResearchPercent();
}
you can clearly see that AIResearchPercent is reduced to 1 in the whole process when both AI and human player are on the same handicap level. Hence human handicap is only given by a slower ResearchPercent (125%), which is what it's meant to be from the beginning.
What do you think Afforess?