# Trying to find the average tribute

**URL:** <https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299>\
**Category:** Gameplay Chat (PC/Mobile)\
**Created:** [June 21, 2020, 10:43pm UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299 "2020-06-21T22:43:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElDuderino](https://avatars.discourse-cdn.com/v4/letter/e/dc4da7/32.png) [@ElDuderino](https://community.gemsofwar.com/u/ElDuderino)\
**Post date:** [June 21, 2020, 10:43pm UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299/1 "2020-06-21T22:43:28Z")

</div>

I’ve been trying to add an **average tribute calculation** to the Task Analyzer tool since I have the data on the user’s kingdom power from GowDB. And I can’t make it match my empirical data.

What I basically do is find out the tribute chance and multiplier, multiply them with each kingdom’s base tribute values and add everything up. The trouble is, if I compare the results with actual values (so far about 70 data points total which seems lime it should be sufficient to confirm this), there is a clear discrepancy: I get significantly more resources than expected. It’s about 60% more for gold (although most of this is due to the “income” being added in, so gold is problematic anyway) and 10-20% more for glory/souls/gems, which I can’t explain.

I’m stumped since I can verify the individual kingdom tribute amounts and chances being correct and the summing/averaging code is very strightforward. I include the guild statue bonuses for levels 100+. I do ignore the home kingdom setting for the moment, but I know it has a very small effect (and can only affect glory with Whitehelm). So basically it looks like there might be some non-obvious logical/statistical thing that I’m missing.

I know it has been confirmed (see this thread: [Tribute statistics - #27 by akots](https://community.gemsofwar.com/t/tribute-statistics/38333/27)) that the game doesn’t cheat on tribute chances. So it looks like it’s either my (quadruple-checked) code or my data (another contributing player sees the same differences) but the differences seem way too big to be explained by having too few samples.

Has any one been successful in calculating the correct averages?

---

<div class="post-metadata">

**Author:** ![UKresistance](https://sea1.discourse-cdn.com/flex019/user_avatar/community.gemsofwar.com/ukresistance/32/7558_2.png) [@UKresistance](https://community.gemsofwar.com/u/UKresistance)\
**Post date:** [June 22, 2020, 1:43am UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299/2 "2020-06-22T01:43:14Z")

</div>

It’s possible the tribute calculations are wrong. For years we were getting way more glory than we should have, and it wasn’t fixed until someone noted they got more glory than possible from tribute.

---

<div class="post-metadata">

**Author:** ![Grundulum](https://avatars.discourse-cdn.com/v4/letter/g/82dd89/32.png) [@Grundulum](https://community.gemsofwar.com/u/Grundulum)\
**Post date:** [June 22, 2020, 3:33am UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299/3 "2020-06-22T03:33:26Z")

</div>

I’ll start paying attention after the weekly reset. I don’t understand how kingdoms could be firing off at the correct rates but gems are coming in 10-20% high.

---

<div class="post-metadata">

**Author:** ![ElDuderino](https://avatars.discourse-cdn.com/v4/letter/e/dc4da7/32.png) [@ElDuderino](https://community.gemsofwar.com/u/ElDuderino)\
**Post date:** [June 22, 2020, 9:57am UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299/4 "2020-06-22T09:57:47Z")

</div>

FWIW, I just reimplemented the calculation as a Monte Carlo simulation and the results are the same. Here is the JavaScript code in case anyone is interested:

```
function getTributeChance(powerLevel) {
      const GUILD_TRIBUTE_CHANCE_BONUS = .06;
      const tributeChance = powerLevel < 4 ? .1 : powerLevel < 9 ? .2 : powerLevel < 12 ? .3
        : powerLevel < 14 ? .325 : powerLevel < 17 ? .35 : powerLevel < 19 ? .375 : .4;
      return tributeChance + GUILD_TRIBUTE_CHANCE_BONUS;
    }

function getTributeMultiplier(powerLevel) {
  const GUILD_TRIBUTE_AMOUNT_BONUS = 1.1;
  const tributeMultiplier = powerLevel < 2 ? 1 : powerLevel < 7 ? 2 : powerLevel < 11 ? 3
    : powerLevel < 13 ? 3.25 : powerLevel < 16 ? 3.5 : powerLevel < 18 ? 3.75 : 4;
  return tributeMultiplier * GUILD_TRIBUTE_AMOUNT_BONUS;
}

function simulateTributes() {
  const iterations = 100000;
  let goldTribute = 0;
  let soulsTribute = 0;
  let gloryTribute = 0;
  let gemsTribute = 0;
  for (i = 0; i < iterations; i++) {
    for (let kingdom of kingdoms) {
      const tributeChance = getTributeChance(kingdom.powerLevel);
      const tributeMultiplier = getTributeMultiplier(kingdom.powerLevel);
      const roll = Math.random();
      if (roll < tributeChance) {
        goldTribute += KINGDOM_INFO[kingdom.id][1] * tributeMultiplier;
        gloryTribute += KINGDOM_INFO[kingdom.id][2] * tributeMultiplier;
        soulsTribute += KINGDOM_INFO[kingdom.id][3] * tributeMultiplier;
        gemsTribute++;
      }
    }
    if (gemsTribute > 0) gemsTribute--; // You get (tributes -1) gems
  }
  return "Gold: " + Math.round(goldTribute / iterations) + ", Souls: " + Math.round(soulsTribute / iterations)
    + ", Glory: " + Math.round(gloryTribute / iterations) + ", Gems: " + Math.round(gemsTribute / iterations * 100) / 100;
}

```

The only inputs are the power levels and the base tribute values (in KINGDOM\_INFO), which I can provide if needed. Again, I verified every individual kingdom’s tribute chance and values to be correct.

I’m really at a loss how this does not produce the averages I see in-game.

---

<div class="post-metadata">

**Author:** ![Fleg](https://avatars.discourse-cdn.com/v4/letter/f/5e9695/32.png) [@Fleg](https://community.gemsofwar.com/u/Fleg)\
**Post date:** [June 22, 2020, 10:13am UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299/5 "2020-06-22T10:13:35Z")

</div>

> [@ElDuderino](#):
>
> the differences seem way too big to be explained by having too few samples.

10-20% is not much from only 70 data points. 34 kingdoms all with different payouts and roughly only 1/3 triggering each tribute leaves a lot of room for the average to fluctuate.

---

<div class="post-metadata">

**Author:** ![ElDuderino](https://avatars.discourse-cdn.com/v4/letter/e/dc4da7/32.png) [@ElDuderino](https://community.gemsofwar.com/u/ElDuderino)\
**Post date:** [June 22, 2020, 10:22am UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299/6 "2020-06-22T10:22:33Z")

</div>

Sure, it’s by no means certain yet and I don’t have the statistics skill to estimate if the deviation is significant at this point. Although my intuition is that since we’re just looking to verify the averages, the origin of the numbers is irrelevant. The average should stabilize after some number of iterations no matter the source.  
I sure hope it’s just about collecting more data, but I still suspect that there’s someting else.

---

<div class="post-metadata">

**Author:** ![Grundulum](https://avatars.discourse-cdn.com/v4/letter/g/82dd89/32.png) [@Grundulum](https://community.gemsofwar.com/u/Grundulum)\
**Post date:** [June 22, 2020, 10:36am UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299/7 "2020-06-22T10:36:17Z")

</div>

Are individual kingdoms triggering at the right rates? When they do trigger, does the payout match what you see in the kingdom info screen? Does the kingdom screen match what you expect based on the base values?

---

<div class="post-metadata">

**Author:** ![ElDuderino](https://avatars.discourse-cdn.com/v4/letter/e/dc4da7/32.png) [@ElDuderino](https://community.gemsofwar.com/u/ElDuderino)\
**Post date:** [June 22, 2020, 10:55am UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299/8 "2020-06-22T10:55:24Z")

</div>

> [@Grundulum](#):
>
> Are individual kingdoms triggering at the right rates?

This is difficult to prove and requires a lot of data that I don’t have yet. The thread I mentioned in the OP seems to confirm that at least the total number of triggered kingdoms is correct.

> [@](#):
>
> Does the kingdom screen match what you expect based on the base values?

The values match, yes.

> [@](#):
>
> When they do trigger, does the payout match what you see in the kingdom info screen?

This appears to be the case, too.

---

<div class="post-metadata">

**Author:** ![Grundulum](https://avatars.discourse-cdn.com/v4/letter/g/82dd89/32.png) [@Grundulum](https://community.gemsofwar.com/u/Grundulum)\
**Post date:** [June 22, 2020, 11:02am UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299/9 "2020-06-22T11:02:17Z")

</div>

With 70 tributes and a record of which kingdoms triggered in each tribute, you can start examining the actual rates compared against expectations. Theoretically, half the kingdoms should be below the claimed rate in the kingdom info screen. If the split is very different from that, then you have a case that the kingdoms are triggering too often.

---

<div class="post-metadata">

**Author:** ![ElDuderino](https://avatars.discourse-cdn.com/v4/letter/e/dc4da7/32.png) [@ElDuderino](https://community.gemsofwar.com/u/ElDuderino)\
**Post date:** [June 22, 2020, 11:07am UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299/10 "2020-06-22T11:07:32Z")

</div>

I only have per-kingdom data from about 10 tributes since it’s significantly more cumbersome to collect. But yeah, with a few more samples one could start to make first observations of the individual rates and draw conclusions. I’ll keep collecting data.

---

<div class="post-metadata">

**Author:** ![Grundulum](https://avatars.discourse-cdn.com/v4/letter/g/82dd89/32.png) [@Grundulum](https://community.gemsofwar.com/u/Grundulum)\
**Post date:** [June 22, 2020, 11:09am UTC](https://community.gemsofwar.com/t/trying-to-find-the-average-tribute/64299/11 "2020-06-22T11:09:53Z")

</div>

I’ve recorded three collections since reset. You’re right that it’s cumbersome. I’ll keep doing it and post here when I have a semi-decent sample.
