Tribal Wars scavenge calculator

Enter the amount of troops you have.
Check the raids available. (FF, BB, SS or RR. FF is sometimes also known as LR)
Click submit.
The table will show what troop distribution should be used to achieve either the max amount of resources per hour, or the max amount of resources per run.
It’s possible that some troops are left unused, due to rounding. Use those however you like.

Max time away: :



unitavailableFF BB SS RR
spear0000
sword0000
axe0000
archer0000
light0000
marcher0000
heavy0000
ideal cap0000
res. per run00000
res/hour00000
hour/run0000

Integration (approved under T13915666)

Select what troops you want to send with the checkboxes, then hit “Open calculator” to automatically have your troops filled in. Copy the JSON generated below into “Calculator output” and hit “Plaats calculator output in templates.” to place the troops from this calculator into the templates.

JSON representation of result:

Iterations to achieve result:

This calculator was approved on tribalwars.nl under ticket number T13900636.

If your world(speed) is not here:

Please leave a comment below. In order for me to add a world, I need the following information:
– The name of the world (start of the URL).
– The game speed of the given world.

How this works

In the game javascript the following formula can be found for how much a scavenge brings in:

iCap * iRatio

where iCap is the total capacity of all units, and iRatio is 10% for the first hunt, 25% for the second, 50% for the third and 75% for the fourth.

The following equation is found for the duration of a scavenge:

((Math.pow(Math.pow(iCap, 2) * 100 * Math.pow(iRatio, 2), 0.45) + 1800) * df)

In this formula, df stands for the duration factor. This seems to be loosely based on the world speed. On NL73 it’s 0.9045869428, on NLP9 it’s exactly 1. By throwing the data of the duration_factor and game_speed into google sheets and letting sheets calculate a power trendline, I found that the formula is game_speed^(-0.55).

Worldduration_factorgame_speedunit_speed
zz10.88450337191.250.8
nlp9111
nl710.683020128420.5
nl72111
nl730.90458694281.20.8
World information for duration_factor used to figure out the formula.

This gives the following formula for resources per hour:

iCap * iRatio / ((Math.pow(Math.pow(iCap, 2) * 100 * Math.pow(iRatio, 2), 0.45) + 1800) * df)

This function can be summed four times, with a spread of the iCap (or capacity) for all different ratios. Let’s assume “a” to be an array representing the spread of carry capacity over the four scavenges, where the sum of the 4 elements <= 1. This gives the following:

iCap * a[0] * 0.10 / ((Math.pow(Math.pow(iCap * a[0], 2) * 100 * Math.pow(a[0], 2), 0.45) + 1800) * df) +
iCap * a[1] * 0.25 / ((Math.pow(Math.pow(iCap * a[1], 2) * 100 * Math.pow(a[1], 2), 0.45) + 1800) * df) +
iCap * a[2] * 0.50 / ((Math.pow(Math.pow(iCap * a[2], 2) * 100 * Math.pow(a[2], 2), 0.45) + 1800) * df) +
iCap * a[3] * 0.75 / ((Math.pow(Math.pow(iCap * a[3], 2) * 100 * Math.pow(a[3], 2), 0.45) + 1800) * df)

Now this is a formula that we could start brute-forcing to find the ideal “a”. Once we find that one, we can simply multiply the total capacity by the individual elements of “a” in order to find how much capacity we should send on a given scavenge hunt.

With this initial “a” we calculate how much we’d get per hour, and save this in a variable. After that, we move half of a[0] to a[1]. We also do the opposite. Of those three options, we check which gives the highest revenue and keep that one.

Given that all scavenges are enabled, we'd start with [0.25,0.25,0.25,0.25]. Our second attempt would be [0.125,0.375,0.25,0.25], and our third attempt would be [0.375,0.125,0.25,0.25].

Next up, we do the same, but then with a[1] and a[2]. After that, we do it with a[2] and a[3]. And then we start over.

We keep doing this, until our total revenue does not increase any more. At that point “a” is distributed so that it gives us the ratio of carry capacity required to get the maximum amount of resources per hour. We then calculate that back to how many troops are required to get as close to that required carry capacity, and show this as an output.

34 thoughts on “Tribal Wars scavenge calculator

  1. Goedemiddag Daniel,

    Je rooftochten script ziet er goed uit, de calculatietool heeft me al veel vooruit geholpen. Nu is het echter zo dat wanneer ik het script probeer te installeren door de ‘Download Integration’ button te gebruiken, ik een foutmelding krijg;

    ”Deze site is niet bereikbaar
    https://gitweb.dmvandenberg.nl/Scavenge%20calculator%20integration.user.js?p=tribalwarsscripts.git;a=blob_plain;f=Scavenge%20calculator%20integration.user.js;hb=master#bypass=true werkt even niet, of de pagina kan verhuisd zijn naar een nieuw webadres.”

    Ben nog een beetje nieuw met zo’n soort scripts, maar weet jij of dit verholpen kan worden?

    Alvast bedankt!

    Met vriendelijke groet,
    Rob

    1. Goedemorgen Rob,

      Dank je voor je bericht. Ik had toevallig gisterochtend wat serveronderhoud uitgevoerd, en blijkbaar waren mijn scripts daarmee even tijdelijk niet bereikbaar. Ik heb dit zojuist opgelost, je kan het script nu weer downloaden!

  2. Wow Great calculator thank you!
    When I install the script however, I click “Open Calculator” And nothing happens. What am I doing wrong?
    Thank you so much!

    1. Hi Gavin,

      On what server are you playing? I’m guessing it’s a bug with specific troops being enabled/disabled.

      Edit:
      I have just placed an update that should make the script more robust. Can you try updating it, and then try again?

  3. Thanks for keeping this tool up to date Daniël helps us alot out there with scavenging <3

    I have seen in the scripts section other scripts is there a way to get an english description for it or is it only in netherland?

    Thanks in advance!

    1. Hi Christian,

      I have not provided English translations for any scripts, as I’ve been told that no servers but the .nl servers allow the use of userscripts. If you could provide me with information that proves otherwise, I’d definitely be interested to start working on translated versions!

  4. Hi, I managed to confuse it by setting a maximum away time which was too short for the number of troops I was using. It reported in the table the time I specified, but used troops that took far longer.

    Is it worth setting this up so that it’s aware and holds troops back to meet the max time restriction?

  5. Hi, I love your tool but I think there is something wrong with the code (or I am using it wrong).
    If you use the option most resources per hour on a large army the run times don’t come close to the one in game (even when you would have selected a wrong world speed) and the gathered resources are to low as well.
    In addition under “Make all scavenges take equally long” the shown run time isn’t close to etch other.

    Hope you are having a nice weekend and have a nice day

  6. Hello,

    when I download script, to using him I must have premium account od tribal wars?
    I am asking because I dont see any choice to calculate.

    Thanks

    1. Hi Martin,

      On what world (what URL) do you play? Can you verify that the script is active on the scavenge screen? The script is currently only active on any domain containing “.tribalwars.”. If it is, please let me know, I’ll mail you with some more questions (with screenshots).

  7. Hallo Daniël,

    Wat ziet het er mooi uit!
    Heb het al handmatig al gebruikt maar wil heel graag het script downloaden voor w75 en w76
    Heb je die ook kan en klaar zeg maar?
    Ik ben niet handig in zelf dingen veranderen in scripts namelijk 😀

    Hoor graag van je…

    Lizz

  8. Hallo,

    Echt een top script man ! Bedankt!
    Alleen gebruik hem nu dan op de nieuwe wereld en ging paar dagen goed en hij werkt nog wel hoor alleen wat er nu gebeurt is vreemd

    Open calculator en Templates ding moet ik een heel stuk naar rechts gaan op de pagina.
    en je kan ook toch de troepen selecteren met die vinkjes. er staat een hele rij met vinkjes die er niet hoeven staan enz..

    Weet jij hoe dit komt? want het maakt het namelijk beetje onoverzichtelijk plus is irritant haha.

    Groetjes Stefan

    1. Hoi Stefan,

      Nee, geen idee eigenlijk. Kan je eens al je andere scripts uitschakelen en kijken of het dan nog steeds gebeurt? Bij mij werkt het namelijk nog steeds gewoon goed, dus dit klinkt voor mij alsof er een ander script in de weg zit.

  9. Also spotted another slight bug, it’s allowing <10 troop scavs to be suggested with low numbers of troops (example 76sp, 65sw on first three levels)

    1. I’ve added UK52. I know about the <10 troops scavenging "bug", but to be honest, it's not worth fixing. The amount of resources gained is minimal, and the technical complications are quite big. The system would have to make multiple passes to calculate the best outcome. Say it thinks 5 should go to the first scavenge and 15 to the second, is it then more efficient to send out 0 and 20 or 10 and 10? So thanks for mentioning it, but yeah, not really worth fixing to me.

  10. Hi, excellent Calculator!!

    I am receiving an error when trying to download the script, is this a problem on my end?

    Regards,

    Richard

  11. Hi, optimise for resources per run, with an 8hr limit and largish troops isn’t working for me. Its not using all troops, the first level isn’t being utilitised at all, and the second tier is only around 3hrs long.

    Sorry to keep reporting this stuff.

    1. Don’t be sorry, thank you so much for mentioning it! I’ve gone through all the code again, and fished out a couple inconsistencies and problems. So, it’s fixed! (Or at least, as good as. It still leaves 300 troops behind but if I’d make it fix that it would take too long to calculate, and it’s only 3% of the troops on the slowest run, so probably <1% resource gain.)

    1. Hi Lucas,

      My German is absolutely terrible, but you’re free to request whitelisting yourself. If you get some sort of number (like a ticket number or so) that I can display to show others it’s whitelisted, I’ll happily add it to this page.

      If the author needs to make the request, you can mention that I asked you to request it on my behalf.

      With kind regards, Daniël

  12. Hi,
    Thank you for this great calculator! That’s exactly what I was looking for.

    Could you add the German world?

    w184
    Game speed 1.25

    Or is that the same setting as world ZZ1 in the calculator?

    greetings

Leave a Reply

Your email address will not be published.

CAPTCHA ImageChange Image