Help with Yield Discount Rate (Math)

Stalker0

Baller Magnus
Joined
Dec 31, 2005
Messages
10,825
@bonniepbilly, seems right up your ally if your interested.

So for a long time I've wanted to create a "yield discount rate". We all know that yields now > yields later in Civ 5 due to the snowball nature of the game. +1 science on Turn 1 is worth more than +10 science on Turn 400, etc.

The question is, how to apply that mathematically, as it effects lots of our arguments regarding the effectiveness of buildings, policies, etc.

So I ran 3 AI only games to try and collect data and see what can be done. I tried Chieftain and King games (turning the AI to maximum intelligence) but the AI was so bad at yields I got to turn 500 without a win condition, which is just not my normal game experience (hehe for all of the brilliance of the AI....it still needs a LOT of yield help to be competitive). However, on Emperor (with max intelligence) I got games ending around Turn 390, which is a very reasonable endgame in my experience.

So I ran the 3 games and collected the data from their logs (Pangea maps as a note, no tech trades, no research agreements, no ruins). Attached is the science rate per turn. I removed civs that were eliminated from the game as their yields tanked and would skew the data.....we care about discounts assuming a full game, so civs that didn't make it all the way were cut. I have also created an average, removing statistical outliers from the data (I wouldn't expect outliers from such a small dataset but I gave it a go).

So the question is....what is the best way to turn this data into a discount rate?


Note: So here's the big elephant in the room....instant yields. They aren't collected in any log, anywhere I can find. One of the modders was very kind and created a log for getting them, but it only works for the player, not AIs. So currently I have no way of collecting them for the AI. I am going to try and collect them in my games, but the issue is every time the game stops (whether by me or a crash) the logs reset, so I have to be very careful and remember to save them each time. I will attempt to do that, but it will take more time.

So this data is per turn science only. I have estimated in previous work that instant yields can account for as much as 50% of the civs total in the last half of the game, so clearly this is a major gap.

So any rate from this data is probably going to be much lower than the actual rate is, as the yields balloon late game due to instant yields. But a rate is better than no rate, even if its lower than actual.
 

Attachments

  • Data Collection.xlsx
    99.2 KB · Views: 46
Oh well when I made that log I just made it for the player. Just remove the line that says something like "if pPlayer:isHuman() then return end" and it should do it for all players. I can post it later today.

I tried a flavor of that but couldn't get it to work. If you could make that for me I will definately put it to use!
 
What do you mean by yield discount rate?

So as an example. Lets we used a linear discount of 1/400 per turn (this means that a yield has maximum value on Turn 1, and no value by Turn 400....just a very simple formula for this example).

Lets say you made a thing that gave you +20 SPT on Turn 100. On Turn 200, you would need to get 26.7 SPT to get the same value, or 30 SPT on Turn 300. The yields later are worth less, so you need more of them to get the same impact as yields you received earlier. The discount rate determines how "fast" yields lose value. And of course keep in mind this doesn't have to be linear, maybe yields hold almost all of their value for the first 100 turns, and then you see a big drop....or it could be a steady decline....just depends on what the data suggests.
 
This is quite a big idea philosophically for the mod.

I'll do culture (and just culture) just from experience, and thus no true science behind it:
  • Turns 0 to 50: Quadruple the value relative to other yields
  • Turns 51 to 100: Triple:
  • Turns 101 to 150: DoubleX
  • Turns 151 to 200: 1.5X (around here science is a lot stronger)
  • Turns 201 to 250: just 1,25X, science is notably higher
  • Turns 250 to end of game: 1,0

The point here is that social policy scales to a huge degree, so early culture is worth so much more than late.
 
This is quite a big idea philosophically for the mod.

I'll do culture (and just culture) just from experience, and thus no true science behind it:
  • Turns 0 to 50: Quadruple the value relative to other yields
  • Turns 51 to 100: Triple:
  • Turns 101 to 150: DoubleX
  • Turns 151 to 200: 1.5X (around here science is a lot stronger)
  • Turns 201 to 250: just 1,25X, science is notably higher
  • Turns 250 to end of game: 1,0

The point here is that social policy scales to a huge degree, so early culture is worth so much more than late.

So to put this in yield discount context, to see if we are talking about the same thing. Technically this is not about comparing yields to other yields per say, but comparing them to themself.

0-50: No yield discount for culture.
51-100: 25% discount (4X -> 3X, loss of 25% value)
101-150: 50% discount (4X -> 2X)
151-200: 62.5% discount (4X -> 1.5X)
201-250: 68.75% discount (4X -> 1.25X)
250-~375: 75% discount.

So if these values are "accurate":
  • You would rather get +3 culture on Turn 101 than +1 culture on Turn 1 (for the rest of the game)
  • You would rather get +15 culture on Turn 300 than +10 culture on Turn 1 (for the rest of the game).
My gut says that you might take the first one (but maybe not), but would also certainly not take the second one. Discounts likely accelerate with turns, not only because of the snowball but also the simple fact that there is just less and less time for those yields to pay off.
 
I tried a flavor of that but couldn't get it to work. If you could make that for me I will definately put it to use!
Oh I've remembered how it works and yeah you need to do more than that.
This ended up being harder than expected, but I've got a working one that should get the yields after they finish their turn.
Also, if you only want to log yields for the player you can change the false to true at the beginning of the file.
 

Attachments

  • Yield Logs (v 1).zip
    2.1 KB · Views: 32
Oh I've remembered how it works and yeah you need to do more than that.
This ended up being harder than expected, but I've got a working one that should get the yields after they finish their turn.
Also, if you only want to log yields for the player you can change the false to true at the beginning of the file.

Tried it out and it looks like its working great, I just had to add the turn time back in, but i had it from the original code so no issue there.
 
So if these values are "accurate":
  • You would rather get +3 culture on Turn 101 than +1 culture on Turn 1 (for the rest of the game)
  • You would rather get +15 culture on Turn 300 than +10 culture on Turn 1 (for the rest of the game).
My gut says that you might take the first one (but maybe not), but would also certainly not take the second one. Discounts likely accelerate with turns, not only because of the snowball but also the simple fact that there is just less and less time for those yields to pay off.
When you put it that way, my first idea was way off.
 
So to put this in yield discount context, to see if we are talking about the same thing. Technically this is not about comparing yields to other yields per say, but comparing them to themself.
Alright here is another shot at this:

Let's say this is a situation where my civ does not have unusually high culture from his bonuses or pantheon. The base is 1:c5culture: on turn 0. I would call this about even to:
3:c5culture: on 50.
10:c5culture: on 100.
30:c5culture: on 150.
150:c5culture: on 200.
500:c5culture: on 250.
1000:c5culture: on 300.
???:c5culture: on 350 (my games end around here)

My gut tells me that I would seriously consider between this different values.
 
Alright so with @InkAxis new script I was able to run another AI only game and get some real numbers. It looks like these numbers do not include the AIs ABC bonuses, just "regular" instant yields, so that gives us a better picture. Again, the AI is not as fast as the human when you consider its bonuses so I would consider this low estimates for a discount, but again a good baseline.

The excel is attached for those who want to peer at it. So what I did was a simple comparison to the baseline over time. So the assumption here is, if on Turn 1 you make 1 SPT, and on Turn 100 you make 10, then 1 science is worth 1/10th of what it was on Turn 1 (aka you need 10 times more science to get the same impact). I'm not sure if that's the best way to generate a discount, could use some statistical thoughts there. So looking at this data for science, here's what I'm seeing.

1 Science (Turn 1) = 2.2 Science (Turn 50) = 6.5 Science (Turn 100) = 17.6 Science (Turn 150) = 34.37 (Turn 200) = 67.9 Science (Turn 250) = 92.5 (Turn 300) = 125.4 Turn (350)

How does that "feel"?

Also just as another point of comparison, since this model ran through 385 turns, another quick way to assess is to see how much raw science I would get from each of these points in time. Now in theory the later points should deliver more science overall, because the earlier points get some "implicit science bonuses" due to being earlier and starting snowballs.

Turn 1: 385 science (1*385)
Turn 50: 737 (2.2 * [385-50])
Turn 100: 1851
Turn 150: 4139
Turn 200: 6358
Turn 250: 9160
Turn 300: 7862

So this suggests there is a flaw in the model at least for the later years. The fact that the number goes down starting around Turn 264 suggests that the discount is not strong enough in the later turns, as the number should be higher than previous numbers to even be a reasonable option. If you had a choice between $100 now and $50 later, you would of course take the $100 now. So the model would need a compensator in the later turns for this to be accurate.
 

Attachments

  • Data Set1.xlsx
    232.5 KB · Views: 33
Last edited:
The way I was thinking about it, at each phase of the game you compare the return on investment on your various buildings (their Internal Rate of Return), and you prioritize the highest first.
I expect the return to decrease over time (if say the increase of output from a library to a lab does not scale as fast as the cost), but I might be wrong.

And as discussed separately, this implies agreeing first on conversion rates between the yields: eg 1 science = 1 culture = 2 prod = 4 gold for example (not sure about faith?).
 
The way I was thinking about it, at each phase of the game you compare the return on investment on your various buildings (their Internal Rate of Return), and you prioritize the highest first.
I expect the return to decrease over time (if say the increase of output from a library to a lab does not scale as fast as the cost), but I might be wrong.

And as discussed separately, this implies agreeing first on conversion rates between the yields: eg 1 science = 1 culture = 2 prod = 4 gold for example (not sure about faith?).

That could serve for a discussion on building balance, but it doesn't serve as more generic criteria. For example, pushing for an early GS vs waiting on more growth, or deciding whether pushing a process may be worth waiting on a building. Having a more generic discount rate per yield would make that a lot easier to have all of those discussions.
 
If it's pretty stable around 2% that's a good candidate for your discount rate though.

So your saying use 2% as the discount per turn?

Aka Yield (Discount) = Yield * (1-.02*Turn)?

That's too steep, that would mean any yield after turn 50 is practically worthless....which is not my experience.
 
More like yield (Turn T) = yield (Turn 1) / (1.02^T)
So turn 50 you divided by 2.7 approximately.
 
Oh I've remembered how it works and yeah you need to do more than that.
This ended up being harder than expected, but I've got a working one that should get the yields after they finish their turn.
Also, if you only want to log yields for the player you can change the false to true at the beginning of the file.

Alright so with @InkAxis new script I was able to run another AI only game and get some real numbers. It looks like these numbers do not include the AIs ABC bonuses, just "regular" instant yields, so that gives us a better picture. Again, the AI is not as fast as the human when you consider its bonuses so I would consider this low estimates for a discount, but again a good baseline.

The excel is attached for those who want to peer at it. So what I did was a simple comparison to the baseline over time. So the assumption here is, if on Turn 1 you make 1 SPT, and on Turn 100 you make 10, then 1 science is worth 1/10th of what it was on Turn 1 (aka you need 10 times more science to get the same impact). I'm not sure if that's the best way to generate a discount, could use some statistical thoughts there. So looking at this data for science, here's what I'm seeing.
I'm poking around with this data. Would it be possible to adjust this so that it attached a label for which civ the data point is connected to? That would help a lot. Stalker is using averages but it would be better to track each civ individually.

Going by the data, it appears that a civ dies at turn (there are only 7 entries instead of 8), but is revived, and then in the very late game there is a ton of dieing and reviving.
 
So as a quick and easy lower bound, it we consider science "useful" for 375, than
I'm poking around with this data. Would it be possible to adjust this so that it attached a label for which civ the data point is connected to? That would help a lot. Stalker is using averages but it would be better to track each civ individually.

Yes I have that data it will just take a little time to format it
 
Top Bottom