Hotfix and a New Beta Version (4-5)

Status
Not open for further replies.
That's counterproductive. Tourism bonus are not "constantly increasing".

You will have a bonus from Trade Route every ~25 turns, and some additional other bonuses (great musicians,...) in an irregular way.

So putting more weight to the last few turns would lead to even more variation, by overestimating (even more) the per-turn just after a tourism bonus, and underestimating (even more) just before.
You forget that here's making a mean between the cumulated (accumulated?) value and the last instant value, so it's not as you described.
 
Maybe just the mean in the last 10 turns is not a good mesure. You could try this:

Trend_turn(x) = (however_you_mesure_trend_in_this_turn + k * Trend_turn(x-1)) / 2
where k is a value between 0 and 1. k is a muffler, the higher the value, the less older values are mitigated.

Instead of just adding values and finding a mean, it's putting a higher weight on the values that are added last. Works well for constantly increasing values.

It may bit be volatile, but it’s also the real value.

G
 
It may bit be volatile, but it’s also the real value.

G

Sorry, I didn't understand that sentence.

First, I had an error in my formula. Actually it's:
Trend_turn(x) = (however_you_mesure_trend_in_this_turn + k * Trend_turn(x-1)) / (k+1)

Second, apologies to Moi Magnus. He's right, it's better to weight higher the old values (So, k>1).

Written with words, my proposal is showing every turn the weighted mean between the current value and the accumulated means of older turns. An example.

Real values: 50; -10; -10; -10; 200; -5; -5; -10; -5; -10 (for ten turns) We want to know if the trend is positive or negative no matter when we look at it. Right now, 8 out of 10 times we see it negative.

Mean for the last ten turns (here it works because there are only 10 samples): 50; 20; 10; 5; 44; 35.83; 30; 25; 21.66; 18.50

Result (k=1): 50: 20; 5; -2.5; 98.75; 46.87; 20.93; 5.46; 0.23; -4.88
*Values are better than real instant values, but not better than the mean for 10 turns

Result (k=9): 50; 44; 38.6; 33.7; 50.33; 44.80; 39.82; 34.84; 30.86; 26.77
*These values are giving 90% more importance to the history than current values. I like them more.
 
Sorry, I didn't understand that sentence.

First, I had an error in my formula. Actually it's:
Trend_turn(x) = (however_you_mesure_trend_in_this_turn + k * Trend_turn(x-1)) / (k+1)

Second, apologies to Moi Magnus. He's right, it's better to weight higher the old values (So, k>1).

Written with words, my proposal is showing every turn the weighted mean between the current value and the accumulated means of older turns. An example.

Real values: 50; -10; -10; -10; 200; -5; -5; -10; -5; -10 (for ten turns) We want to know if the trend is positive or negative no matter when we look at it. Right now, 8 out of 10 times we see it negative.

Mean for the last ten turns (here it works because there are only 10 samples): 50; 20; 10; 5; 44; 35.83; 30; 25; 21.66; 18.50

Result (k=1): 50: 20; 5; -2.5; 98.75; 46.87; 20.93; 5.46; 0.23; -4.88
*Values are better than real instant values, but not better than the mean for 10 turns

Result (k=9): 50; 44; 38.6; 33.7; 50.33; 44.80; 39.82; 34.84; 30.86; 26.77
*These values are giving 90% more importance to the history than current values. I like them more.

Sorry, I wasn't clear - what I'm saying is that the 'real' values are the values the game uses to process instant yields for tourism - i'd have to do this calculation on the fly every time the value is called (and it is called often).

G
 
Sorry, I wasn't clear - what I'm saying is that the 'real' values are the values the game uses to process instant yields for tourism - i'd have to do this calculation on the fly every time the value is called (and it is called often).

G
So, how do you manage to make a ten turns mean?

Can't you store the last turn trend value?
 
So, how do you manage to make a ten turns mean?

Can't you store the last turn trend value?

Sorry I'm trying to type on the go. Here's the actual code:

Code:
/// Current influence trend on this player
InfluenceLevelTrend CvPlayerCulture::GetInfluenceTrend(PlayerTypes ePlayer) const
{
    InfluenceLevelTrend eRtnValue = INFLUENCE_TREND_STATIC;

    CvPlayer &kOtherPlayer = GET_PLAYER(ePlayer);

    // PctTurn1 = InfluenceT1 / LifetimeCultureT1
    // PctTurn2 = InfluenceT2 / LifetimeCultureT2
    
    // So if looking at is PctT2 > PctT1, can see if  (InfluenceT2 * LifetimeCultureT1) > (InfluenceT1 * LifetimeCultureT2)
    int iLHS = GetInfluenceOn(ePlayer) * kOtherPlayer.GetCulture()->GetLastTurnLifetimeCulture();
    int iRHS = GetLastTurnInfluenceOn(ePlayer) * kOtherPlayer.GetJONSCultureEverGenerated();

    if (kOtherPlayer.GetCulture()->GetLastTurnLifetimeCulture() > 0 && kOtherPlayer.GetJONSCultureEverGenerated() > 0)
    {
        if (iLHS > iRHS && m_pPlayer->GetCulture()->GetOtherPlayerCulturePerTurnIncludingInstant(ePlayer) < m_pPlayer->GetCulture()->GetTourismPerTurnIncludingInstant(ePlayer))
        {
            eRtnValue = INFLUENCE_TREND_RISING;
        }
        else if (iLHS < iRHS)
        {
            eRtnValue = INFLUENCE_TREND_FALLING;
        }
    }
        
    return eRtnValue;
}

The values grabbed in GetOtherPlayerCulturePerTurnIncludingInstant && GetTourismPerTurnIncludingInstant are simply the total amounts of yields (Culture/Tourism) over the past 10 turns, no averages needed.

G
 
Hello, can somebody post the latest versión of the vp with eui as a modpack? It's the 3/31b i think.
Don't tell me to do it by myself because i tried and i can't. PLS HELP
 
Perhaps the larger issue here is not 10 turns vs 1 turn vs weighted running average but the binary "Rising" versus "Falling" output.

How about "Rapidly rising / Slowly rising / Steady / Slowly falling / Rapidly falling"? Or even something numerical: e.g.,
  • # of turns required left until 100%, assuming trend over past 10 turns continues indefinitely
  • % of target Tourism, where target = Tourism level required to reach 100% in 50 turns
  • just report offensive Tourism accumulated over past 10 Turns / accumulated Culture defense over past 10 Turns (as a %)
 
Last edited:
Sorry I'm trying to type on the go. Here's the actual code:

Code:
/// Current influence trend on this player
InfluenceLevelTrend CvPlayerCulture::GetInfluenceTrend(PlayerTypes ePlayer) const
{
    InfluenceLevelTrend eRtnValue = INFLUENCE_TREND_STATIC;

    CvPlayer &kOtherPlayer = GET_PLAYER(ePlayer);

    // PctTurn1 = InfluenceT1 / LifetimeCultureT1
    // PctTurn2 = InfluenceT2 / LifetimeCultureT2
 
    // So if looking at is PctT2 > PctT1, can see if  (InfluenceT2 * LifetimeCultureT1) > (InfluenceT1 * LifetimeCultureT2)
    int iLHS = GetInfluenceOn(ePlayer) * kOtherPlayer.GetCulture()->GetLastTurnLifetimeCulture();
    int iRHS = GetLastTurnInfluenceOn(ePlayer) * kOtherPlayer.GetJONSCultureEverGenerated();

    if (kOtherPlayer.GetCulture()->GetLastTurnLifetimeCulture() > 0 && kOtherPlayer.GetJONSCultureEverGenerated() > 0)
    {
        if (iLHS > iRHS && m_pPlayer->GetCulture()->GetOtherPlayerCulturePerTurnIncludingInstant(ePlayer) < m_pPlayer->GetCulture()->GetTourismPerTurnIncludingInstant(ePlayer))
        {
            eRtnValue = INFLUENCE_TREND_RISING;
        }
        else if (iLHS < iRHS)
        {
            eRtnValue = INFLUENCE_TREND_FALLING;
        }
    }
    
    return eRtnValue;
}

The values grabbed in GetOtherPlayerCulturePerTurnIncludingInstant && GetTourismPerTurnIncludingInstant are simply the total amounts of yields (Culture/Tourism) over the past 10 turns, no averages needed.

G
A bit confusing.

Let's see.
GetInfluenceOn(ePlayer): Our total influence over ePlayer.
GetLastTurnInfluenceOn(ePlayer): Our influence gained over ePlayer in the last turn.
kOtherPlayer.GetJONSCultureEverGenerated(): Total culture generated by other civ.
kOtherPlayer.GetCulture()->GetLastTurnLifetimeCulture(): Culture generated by the other civ in the last turn.

So far, I understand that you compare (Total_inf * cult_last_turn) to (inf_last_turn * total_cult).

I don't see why you need to make sure that
if (kOtherPlayer.GetCulture()->GetLastTurnLifetimeCulture() > 0 && kOtherPlayer.GetJONSCultureEverGenerated() > 0)
Can it really go into the negatives? Is it only to avoid turn 0 issues? That makes no sense, since you are not dividing in any moment.

Then.
There are two conditions: iLHS > iRHS, and the other one regarding the last 10 turns. Why wasn't it enough with the first condition? Because 'GetInfluenceOn(ePlayer)' doesn't take instant values into account?
If this is the case, then I'm a bit lost, because the second condition after the && is not going to change the result. It only does something when iLHS=iRHS. If first condition was not giving proper results, it is still not giving proper results. EDIT (Oh. It returns STATIC by default. So even if the TPT/CPT values says that the trend is rising, it can be countered by the last ten turns, if not meeting this requirement it won't say that the trend is rising).

EDIT. So there's a bug here. In my games it's usually showing FALLING, when it is not the case. I see that you have not placed a second condition for the FALLING case, so it's ignoring what happened in the last ten turns when the static values say that the trend is FALLING.

I understand now that storing values for the last turn for N civs might be daunting. I'll try to think on something with the variables you are showing here.
 
Last edited:
I am too lazy to post it on github, but the "firaxite minerals" corporation doesnt give the "trade units cant be pillaged" benefit as it is described.
Is the description outdated or is this a bug?
 
Hello, can somebody post the latest versión of the vp with eui as a modpack? It's the 3/31b i think.
Don't tell me to do it by myself because i tried and i can't. PLS HELP
Haven't extensively tested it, but seems to be working fine: VP 04/05 + EUI (link valid for 30 days).

The only changes were on the default game options: Events off, and Transparent Diplomacy on.
 
A bit confusing.

Let's see.
GetInfluenceOn(ePlayer): Our total influence over ePlayer.
GetLastTurnInfluenceOn(ePlayer): Our influence gained over ePlayer in the last turn.
kOtherPlayer.GetJONSCultureEverGenerated(): Total culture generated by other civ.
kOtherPlayer.GetCulture()->GetLastTurnLifetimeCulture(): Culture generated by the other civ in the last turn.

So far, I understand that you compare (Total_inf * cult_last_turn) to (inf_last_turn * total_cult).

I don't see why you need to make sure that
if (kOtherPlayer.GetCulture()->GetLastTurnLifetimeCulture() > 0 && kOtherPlayer.GetJONSCultureEverGenerated() > 0)
Can it really go into the negatives? Is it only to avoid turn 0 issues? That makes no sense, since you are not dividing in any moment.

Then.
There are two conditions: iLHS > iRHS, and the other one regarding the last 10 turns. Why wasn't it enough with the first condition? Because 'GetInfluenceOn(ePlayer)' doesn't take instant values into account?
If this is the case, then I'm a bit lost, because the second condition after the && is not going to change the result. It only does something when iLHS=iRHS. If first condition was not giving proper results, it is still not giving proper results. EDIT (Oh. It returns STATIC by default. So even if the TPT/CPT values says that the trend is rising, it can be countered by the last ten turns, if not meeting this requirement it won't say that the trend is rising).

EDIT. So there's a bug here. In my games it's usually showing FALLING, when it is not the case. I see that you have not placed a second condition for the FALLING case, so it's ignoring what happened in the last ten turns when the static values say that the trend is FALLING.

I understand now that storing values for the last turn for N civs might be daunting. I'll try to think on something with the variables you are showing here.

It is bad code (not mine! don't blame me! :) ). Yes, so, you're correct. I just need to refactor it. This is what happens when I put band-aid's on gaping wounds.

G
 
I'm warmongering. Basically fighting everyone else. They sanctioned me.

Now, peace treaties do not allow me to get more than peace. No gold, resources or capitulation.
Is this intended?
 
I'm warmongering. Basically fighting everyone else. They sanctioned me.

Now, peace treaties do not allow me to get more than peace. No gold, resources or capitulation.
Is this intended?
No. However, the feature "sanction prevent deals" is new and is bugged in this version. The newest version 04/11 is savegame compatible, so try with it. If the bug is still there, make a bug report on GitHub.
 
I have continued to play that same Spain Terran type game to see if I can recreate the happiness spiral. In my current game, I got close but was able to pull out of it. But Mongolia got down to -44 at one point.

However, now that I actually kept my logs this time! I wanted to see if my notes about how "swingy" happiness is had some empirical truth to it.

Checking the logs, it tracked turns 268 to 302. On average, my happiness shifted 5.5 every turn. In terms of really big swings, in one turn my happiness jumped 25! I also had an 18 and an 11 jump.

I compared it to Mongolia who had an average change of 6 happiness / per turn. He has a few 14 swings, some 11s, and 1 big 24 swing.


So its clear to me that there definitely can be some very large swings with happiness, which is part of the reason its so off putting at times.

Log is attached G if you want to review it.
 

Attachments

I have continued to play that same Spain Terran type game to see if I can recreate the happiness spiral. In my current game, I got close but was able to pull out of it. But Mongolia got down to -44 at one point.

However, now that I actually kept my logs this time! I wanted to see if my notes about how "swingy" happiness is had some empirical truth to it.

Checking the logs, it tracked turns 268 to 302. On average, my happiness shifted 5.5 every turn. In terms of really big swings, in one turn my happiness jumped 25! I also had an 18 and an 11 jump.

I compared it to Mongolia who had an average change of 6 happiness / per turn. He has a few 14 swings, some 11s, and 1 big 24 swing.


So its clear to me that there definitely can be some very large swings with happiness, which is part of the reason its so off putting at times.

Log is attached G if you want to review it.

Looks like it is mainly war weariness causing it. We could probably tighten the slope on that some. Otherwise I don't see any major swings in yield based happiness.

G
 
Status
Not open for further replies.
Back
Top Bottom