Farm Manager - Tribal Wars 2 Farmbot

release
tribal-wars-2

#1

This bot farms barbarian villages in Tribal Wars 2.
It reads your battle reports and sends troops to your farms again.

Features

Easy to Configure

  • Reads battle reports to identify your farm villages.
  • Uses the ‘Attack Again’ function in the battle report to attack each target village with your preferred composition of the army.
  • Uses the chrome web browser to support in-game configuration (e.g. reports filter).

Efficient

  • Automatically activates correct villages to attack from the same villages again.
  • Improves efficiency of units distribution: Skips combination of attacking and defending village for which an attack has already been sent in the current cycle.

Safe

  • Supports random breaks between farming cycles.
  • Stops the farming when the configured time limit is met to avoid perpetual activity on your account.

How to Use Farm Manager to Automate Farming in Tribal Wars 2

To start the bot for the first time, follow these steps:

✓ Successfully loaded the bot with ID E6B2745C7E83A273567E280E05302DCD2EC49454

  • Click the Start bot operation button.
  • Enter your Bot Operation Key and click the Retry button. In case you don’t have a key yet, you can get a key at https://manage.botengine.org
  • After a few seconds, the Bot Operation App enters the Bot Operation page.
  • The first time you start the bot, it will download a web browser component which does not come with the original download. This can take some time, depending on your internet connection. Progress is displayed on the progress bar.
  • When the browser download is finished, the bot opens a web browser window which is a kind of chrome (has a blueish version of the google chrome logo).
  • When the bot has opened the browser window, pause the bot by pressing the Pause Operation button in the Bot Operation App.
  • In the browser window opened by the bot, navigate to the tribal wars 2 website and log in to your world so that you see the in-game controls.
  • Ensure that the zoom level in chrome is set to 100% (default). You can reset the zoom level to 100% by pressing the keys CTRL + 0 in the browser window.
  • In the game, configure the report list filter settings, for example, to not display reports with casualties.
  • Continue the bot by pressing the Continue Operation button.
  • From here on, the bot will operate automatically. You will see it open reports and send attacks. It also switches villages to attack again from the same village.

When finished, the bot will output some stats to inform about the number of reports looked at and attacks sent, etc.:

10:54:27.662 [870] : I am done with this session. I wait for one minute before terminating the script....
10:54:27.650 [869] : In this session, I have looked at 103 reports and sent 71 attacks from 3 villages.
10:54:27.628 [868] : In the current cycle, I have looked at 103 reports and sent 71 attacks from 3 villages.
10:54:27.615 [867] : The last 31 reports I have seen contained combinations of attacking and defending village coordinates for which I have already sent attacks in this cycle. Because of this, I do not expect to find any more new farm coordinates in the next reports. I end this cycle.

The default configuration of the bot just runs one farming cycle. The bot can be configured to perform multiple farming cycles, with breaks in between.


Bot 04088BDA - /* Tribal Wars 2 Farmbot v2018-08-22
Tribal wars 2 farmbot after update tw2 broken?
Bug In Tribal Wars 2 Web App - Broken Report Display
Tribal wars 2 farmbot after update tw2 broken?
Tribal Wars 2 Farmbot - Playing Nice With Others
Testing the Tribal Wars 2 Farmbot 2018
Testing the Tribal Wars 2 Farmbot 2018
Testing the Tribal Wars 2 Farmbot 2018
Testing the Tribal Wars 2 Farmbot 2018
Tribal Wars 2 Bot
#2

Reserved for later additions.


#3

Hey Viir, looks like you have discovered a new bot! Thank you for sharing this with us!
I added a link to this bot to the bot catalog: Bot 04088BDA - /* Tribal Wars 2 Farmbot v2018-08-22


#5

When you send me the log of from the bot, I can take a look at this problem. You find the log in the textbox under Bot Log when running the bot. You can select all the text and copy it to the clipboard using CTRL+C or the context menu (rightclick).


#8

doesnt load the bot

thats what it says

Blockquote

Loading bot from ‘https://github.com/Viir/bots/blob/e560e8174401f0b9fb8fe1f9cedffb2994a3ee72/tribal-wars-2/tribal-wars-2-farmbot.cs’ …
Trying to load archive from ‘https://github.com/Viir/bots/archive/e560e8174401f0b9fb8fe1f9cedffb2994a3ee72.zip
Failed to load archive: System.Net.Http.HttpRequestException: Fehler beim Senden der Anforderung. —> System.Net.WebException: Die Anfrage wurde abgebrochen: Es konnte kein geschützter SSL/TLS-Kanal erstellt werden…
bei System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
bei System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
— Ende der internen Ausnahmestapelüberwachung —
bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
bei BotSharp.Web.Web.d__4.MoveNext()

:x: Failed to load the bot.

Blockquote


#9

Thank you. I am not sure yet what could be the cause, I need some more information. The log you have looks like when it is in the process of loading the browser:


Do you see the loading bar shown in the screenshot above?
When you open the directory with the app in windows explorer, do you see a directory called .local-chromium in there? Are there any files in there?

#10

Hi Peter, das schaut aus wie ein Problem mit Internetverbindungen. Du kannst dieses Problem umgehen indem du die Datei von https://botengine.blob.core.windows.net/blob-library/by-name/tribal-wars-2-farmbot.v2018-08-22.cs auf dein system speicherst und dann über den Kopf 📂 Load Bot From Local File in die App lädst.

Noch eine weitere Frage zu diesem Problem: Welche Windows Version verwendest du? Nutzt du Windows 7?


#12

That is interesting. :+1: Maybe this is related to the browser loading problem. Do you see any progress happening with the browser loading bar?


#14

From what I am reading so far on the internet, this might be affected by an operating system setting. Which windows do you use? Do you use windows 7?


#16

So today I tested this on Windows 7 and did some more reading. I found that on Windows 7, the implementation to connect to the webbrowser does not work with the current version.

@otremba, I made a new version for Windows 7, you can download it from https://botengine.blob.core.windows.net/blob-library/by-name/BotEngine.v2018-08-25-win7.exe

Does this work for you?


#19

I sent you a PM for the configuration of multiple farming cycles.


#20

Improving Efficiency - Support Quicker Completion Of The Farming Cycle

Today I added a new feature to reduce the time the bot needs to complete a farming cycle.

Often, you will have many more reports than farming villages, because you get a new report per farm every time you send troops for farming. This means that the bot should not attack again for each report, but only once for each combination of coordinates in a farming cycle.
Since the first version, the bot already supported this: It reads the coordinates of attacking and defending village, and decides to skip this report if it has already sent troops for these coordinates in the current farming cycle. In the log, you then see a message like this:

An attack from 478|518 to 497|536 has already been sent in this cycle. I skip this report and continue with the next one.

With the bot operating, the number of battle reports can quickly grow into thousands. To avoid having the bot spend all the time on reading past reports for the same villages, I updated the bot to detect if it has reached the end of the reports which contain new coordinates.
It now applies heuristics to decide whether to expect new coordinates for attacking or farming villages in the next reports. It then ends the current farming cycle when it looks like no new coordinates are to be discovered.
Then you will see a message in the log like this:

The last 31 reports I have seen contained combinations of attacking and defending village coordinates for which I have already sent attacks in this cycle. Because of this, I do not expect to find any more new farm coordinates in the next reports. I end this cycle.


For the developers among us, you can see the corresponding code changes at


#21

Can this be set to auto run? When i ran it. It did the attacks then shut down window. Is this supposed to happen?


#22
  • When the bot has opened the browser window, pause the bot by pressing the Pause Operation button in the Bot Operation App.

the web page does not open


#23

Hey, you have to set yourself how many cycles to do! Change the “1” in this line
const int numberOfFarmCyclesToRepeatMin = 1;
to how many cycles you want!


#24

Ahh i see thanks. Is there also a way you can set a delay between them also ? So it sends farms out every 1hr for example. Man i need to get back into python learning again. Thanks again mate


#25

For the break duration change the 60 * 30 in this line
const int breakBetweenCycleDurationMinSeconds = 60 * 30;
now its set to 30mins to make it 1hr change to 60 * 60


#26

Hi thanks for your help. i just got home and had a look. now i see what you mean. will they be a feature that detects that its sent max amount ie 50 attacks and pause ?


#27

You need to open the web page manually (at least the first time), in the browser window which has been opened by the bot. To open the web page, you can type tribal wars 2 server address in the address bar of the browser or you can use a bookmark.

If the browser window does not open:

  • I need the Bot Log to investigate the problem.
  • Also, what version of Windows are you using?

#28

To decide this, I need to know a few things, for example:

  • What happens on the screen when you reach this max amount?
  • Why would pause be better than other alternatives of progressing?