Farm Manager - Tribal Wars 2 Farmbot

Thanks for this farming cycle it works fine for me

Does it work for win7?

My powershell is just crashing when opening botengine.

Win7 is not supported. As far as I remember, the web browser framework depends on a component that Microsoft added with Windows 8.

Hallo Harkum, ich habe eine Version erstellt die das farmen widerholt. Du kannst diese so starten:

botengine  run-bot  "https://github.com/Viir/bots/tree/5e082111848380c9362a93a6a20a169d514f63c6/implement/applications/tribal-wars-2/tribal-wars-2-farmbot"

---------------------------ā€-----------------------
Hat soweit gut funktioniert, leider sind die Pausen von 120-180 Minuten zwischen den Circeln ein bisschen extrem, kann mann sowas auch selber Ƥndern und einfach lokal laden oder kƶnntest du noch eine Version mit kĆ¼rzeren breaks erstellen vielleicht 20 bis 40 Minuten

Kein Problem, hier ist eine version mit Pausendauer zwischen 20 und 40 Minuten:

botengine  describe-bot  "https://github.com/Viir/bots/tree/214e5e623694d1376ac3e0772863e898fa75e439/implement/applications/tribal-wars-2/tribal-wars-2-farmbot"

Und ja, du kannst das auch selbst Ƥndern und von lokal laden. Ich habe nur die Werte fĆ¼r farmCycleBreakLengthMinMinutes und farmCycleBreakLengthMaxMinutes geƤndert in der Datei Bot.elm.

Hinter diesem Link siehst du die Differenz zwischen den beiden Versionen:

1 Like

perfekte Arbeit, vielen Dank dafĆ¼r!!

Hi @Viir Im having issues installing ā€œ2020-02-13ā€ bot installation file.
I get error ā€œThere is a problem with the bot source: I found a file at ā€˜src/BotEngine/Interface_To_Host_20190808.elmā€™. Seems like that bot is not compatible with this version of the app.ā€ when running the command.
Can you please help?
Thank you.
image

Full Command:

C:\Users\beast>C:\Users\beast\Downloads\2020-02-13.botengine-console\BotEngine.exe run-bot ā€œbots/implement/applications/tribal-wars-2/tribal-wars-2-farmbot at 42b11c257f99c61538b7060ea1a4fd4f7d40f0eb Ā· Viir/bots Ā· GitHubā€
I am recording a log of this session to file ā€˜C:\Users\beast\AppData\Local\botengine\bot-session\2020-02-14T15-52-01-CD5FB0BA67BB\session.2020-02-14T15-52-01-CD5FB0BA67BB.jsonlā€™
This bot source looks like a URL. I try to load the bot from Github
I found 9 files in ā€˜bots/implement/applications/tribal-wars-2/tribal-wars-2-farmbot at 42b11c257f99c61538b7060ea1a4fd4f7d40f0eb Ā· Viir/bots Ā· GitHubā€™.

There is a problem with the bot source: I found a file at ā€˜src/BotEngine/Interface_To_Host_20190808.elmā€™. Seems like that bot is not compatible with this version of the app.

The bot source you used in this case is not compatible with app version 2020-02-13 or newer.

There is a newer version of the bot which works with the new app:

C:\path\to\the\BotEngine.exe  run-bot  "https://github.com/Viir/bots/tree/032f0dc8d3d229d8fee1ff2fb787b59ef9880c8e/implement/applications/tribal-wars-2/tribal-wars-2-farmbot"

This version (and later versions) are compatible with app version 2020-02-13 and newer.

@Viir Up and running, Thank you

After extracting the .rar and running BotEngine.exe with the command I get the following:

c:\botengine>BotEngine.exe run-bot ā€œbots/implement/applications/tribal-wars-2/tribal-wars-2-farmbot at 032f0dc8d3d229d8fee1ff2fb787b59ef9880c8e Ā· Viir/bots Ā· GitHubā€
I am recording a log of this session to file ā€˜C:\Users**********\AppData\Local\botengine\bot-session\2020-02-16T02-40-05-1CC7A0547521\session.2020-02-16T02-40-05-1CC7A0547521.jsonlā€™
This bot source looks like a URL. I try to load the bot from Github
I found 9 files in ā€˜bots/implement/applications/tribal-wars-2/tribal-wars-2-farmbot at 032f0dc8d3d229d8fee1ff2fb787b59ef9880c8e Ā· Viir/bots Ā· GitHubā€™.
I loaded bot F10A1B30FB03B94C9B67C8CAE28A95E93FA39F07CA63F64B7395969B582458DF.
Starting the botā€¦

run-bot failed with exception: System.IO.DirectoryNotFoundException: Could not find a part of the path ā€˜C:\Users*******\AppData\Local\botengine.cache\by-sha256ā€™.
at System.IO.Enumeration.FileSystemEnumerator1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) at System.IO.Enumeration.FileSystemEnumerator1.Init()
at System.IO.Enumeration.FileSystemEnumerator1..ctor(String directory, Boolean isNormalized, EnumerationOptions options) at System.IO.Enumeration.FileSystemEnumerable1ā€¦ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
at BotEngine.Windows.Console.BotEngine.ReadValueFromCacheSHA256(String expectedFileName) in V:\inceptum\BotEngine\dev-of-BotEngine\repo\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\Program.cs:line 678
at BotEngine.Windows.Console.BotEngine.GetFileFromHashSHA256(Byte[] hashSHA256) in V:\inceptum\BotEngine\dev-of-BotEngine\repo\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\Program.cs:line 572
at BotEngine.Windows.Console.BotEngine.<>c__DisplayClass8_1.b__7(Byte[] hashSHA256) in V:\inceptum\BotEngine\dev-of-BotEngine\repo\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\Program.cs:line 26
at Kalmit.BlobLibrary.GetBlobWithSHA256(Byte[] sha256)
at Kalmit.ProcessFromElm019Code.get_GetElmExecutableFileCompressedGzip()
at Kalmit.ProcessFromElm019Code.get_GetElmExecutableFile()
at Kalmit.ProcessFromElm019Code.CompileElm(IImmutableDictionary2 elmCodeFiles, IImmutableList1 pathToFileWithElmEntryPoint, String outputFileName, String elmMakeCommandAppendix)
at Kalmit.ProcessFromElm019Code.CompileElmToJavascript(IImmutableDictionary2 elmCodeFiles, IImmutableList1 pathToFileWithElmEntryPoint, String elmMakeCommandAppendix)
at Kalmit.ProcessFromElm019Code.ProcessFromElmCodeFiles(IReadOnlyCollection1 elmCodeFiles, Nullable1 overrideElmAppInterfaceConfig)
at Kalmit.PersistentProcess.PersistentProcessWithHistoryOnFileFromElm019Codeā€¦ctor(IProcessStoreReader storeReader, IReadOnlyCollection1 elmAppFiles, Action1 logger, Nullable1 overrideElmAppInterfaceConfig) at BotEngine.Windows.Console.Bot.RunBotSession(TreeComponent botCode, Func2 getFileFromHashSHA256, String processStoreDirectory, Action1 logEntry, Action1 logProcessBotEventReport, String botConfiguration, String sessionCustomName, String botSource, String keyToStartOnlineSession, Int32 sessionLengthLimitInMinutes, IImmutableList`1 pauseBotKeys) in V:\inceptum\BotEngine\dev-of-BotEngine\repo\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\Bot.cs:line 51
at BotEngine.Windows.Console.BotEngine.<>c__DisplayClass8_2.b__8() in V:\inceptum\BotEngine\dev-of-BotEngine\repo\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\Program.cs:line 171
[2020-02-16T02-40-07] Bot session ended.

Sorry for the inconvenience. It looks like this error with the DirectoryNotFoundException was caused by a recently introduced bug.
I fixed this and uploaded this new version of the app at https://botengine.blob.core.windows.net/blob-library/by-name/2020-02-16-botengine-console.zip

Thanks man!

Bot seems pretty awesome actually and works well, might buy credits for it.

Some little improvements though, when the bot finishes and I leave the browser open to play, if I run the bot to do 1 farm cycle again with the browser still open, it will spam blank pages until I close and re-open the browser and login again.

What would be really perfect is if I could leave something running on my PC at home, and via ā€œreactor.botengine.orgā€ I can login on my phone and start a bot cycle whenever I want. I can play from work on my phone, but canā€™t send out all the farms for 10+ villages at endgame obviously. Takes too long.

But yeah, nice program :slight_smile:

Thank you for the feedback. I will look into the browser window issue.

About starting a cycle using the web interface: That is doable, but I am wondering if there is an alternative that can be developed earlier. How do you decide when a cycle should be started? Does this decision depend on information outside the game?

This problem is fixed in a new version of the bot:

botengine  run-bot  "https://github.com/Viir/bots/tree/bf51d851ea1b452ed031155a52303d8cfc4acc36/implement/applications/tribal-wars-2/tribal-wars-2-farmbot"

This version also works when there is still a leftover web browser from a previous run.

error i see it all the time when i try to configure parameter of farming cycles.
My cod

C:\Users\Admin\Desktop\botnew\BotEngine.exe run-bot --key-to-start-online-session=xxxxxxxxxxxxxxxxxxxx --bot-configuration=ā€œnumber-of-farm-cycles = 140, break-duration = 10 - 20ā€ ā€œbots/implement/applications/tribal-wars-2/tribal-wars-2-farmbot at bf51d851ea1b452ed031155a52303d8cfc4acc36 Ā· Viir/bots Ā· GitHubā€

And second problem is - after 20 min farming or less barb villagers disappear.

And one more, can u pls add the functions for bot - reload game if he stuck on one village, its happen sometimes when server laging.
Best regards

PS I foung that i can download bot and use it from my disc! Now i can configure it))

Welcome Tod and thank you for the feedback!

In the screenshot of the console window, I also found this text:

I found 188 files in 'https://github.com/Viir/bots/tree/bf51d851ea1b452ed031155a52303d8cfceacc36'.

There is a problem with the bot source: I did not find an 'elm.json' file directly in this directory. Did you mean the subdirectory 'implement\devtools\read-from-image'?

This error message looks like the last part of the command was truncated, the end of the path to the bot code (/implement/applications/tribal-wars-2/tribal-wars-2-farmbot) got lost somehow. So the engine loaded the root directory of the repository containing all the different bots.

So far, I have no idea what could have caused this or how it is related to the addition of the configuration.
I tried to copy the code you posted to see if I can get the same error. I tested these variants:

botengine run-bot --key-to-start-online-session=xxxxxxxxxxxxxxxxxxxx --bot-configuration=ā€œnumber-of-farm-cycles = 140, break-duration = 10 - 20" "https://github.com/Viir/bots/tree/bf51d851ea1b452ed031155a52303d8cfc4acc36/implement/applications/tribal-wars-2/tribal-wars-2-farmbot"
"C:\Users\John\Downloads\2020-02-16-botengine-console\BotEngine.exe"  run-bot --key-to-start-online-session=xxxxxxxxxxxxxxxxxxxx --bot-configuration=ā€œnumber-of-farm-cycles = 140, break-duration = 10 - 20" "https://github.com/Viir/bots/tree/bf51d851ea1b452ed031155a52303d8cfc4acc36/implement/applications/tribal-wars-2/tribal-wars-2-farmbot"

In both cases, the loading worked as expected, I got this output:

I found 9 files in 'https://github.com/Viir/bots/tree/bf51d851ea1b452ed031155a52303d8cfc4acc36/implement/applications/tribal-wars-2/tribal-wars-2-farmbot'.

No idea how I could reproduce the error you were seeing. :man_shrugging:


Good idea, I will add that. :+1:
Reloading is simple, I just need to figure out how to detect if it is stuck.

1 Like

Thx, i downloaded files on my pc and now i havenā€™t problem n1.
About how figure the stucking, maybe when bot dont change villas for a 15 (or some) min? It will work in any situation. The bigest problem what i see for this bot is he all the time moving around map.Its a browser not optimized game, it will always proke many problems, and reload - one way to cleanup.
Best regards

1 Like

Thank you for clarifying Tod. I added the reload feature now, the newest version of the bot reloads the web page, by default every fifteen minutes.

You can run this version from bots/implement/applications/tribal-wars-2/tribal-wars-2-farmbot at cd99c4db9a2fe9ed69eade9681e3bf3ed25ad4c3 Ā· Viir/bots Ā· GitHub

It also indicates in the user interface when the last reload happened:

Reloaded the web page 7 minutes ago.

1 Like

Hey Viir
I am enjoying this seeing as I had to restart in a new world it has helped me a lot.

However, I have a few issues. And I thought by buying 300.000 points they would get solved somehow with a longer session, but sadly no.

First:
It takes very very long for it to search barb villages, and send out attacks, is this normal? 1 coordinate takes around 1 second to search - so one village spends maybe 15 min to send out all attacks - then the problem becomes:
By the time it has reached to send out the attacksā€¦ the farm troops have already returned backā€¦ so it keeps sending from that same village over and over cause it never hits the 50 attack limit?

It takes the bot about 1 hour and 40 minutes to send attacks from 5 different villages (and cause of that problem I mentioned, I have to manually pause bot, switch village in chromium, then press enter to resume bot so it starts sending from that villageā€¦)

Am I the only one to experience this?

Is there any way to make the bot REMEMBER those coordinates it has already searched and found the barb villages at - and then automatically send them there next time instead of searching for coordinates each time?

Besides that, great job to you!

1 Like

Hello Lanson,
Thank you for sharing your experience.

It does hit the 50 attack limit, no matter how fast your troops are because the attacks donā€™t go to the same barbarian villages in the same farm cycle. With each attack, the distance to the next barbarian village is further, so it takes more time for the troops to return.

It only takes long in the first farm cycle per session. In the second farm cycle, the bot remembers the locations of the barbarian villages, so it does not need to search them anymore. Sending an attack then should take less than 7 seconds.
So starting with the second farm cycle, half an hour is enough for sending 250 attacks.

If you prefer, you can have the bot switch between your villages earlier, so it does not anymore need to reach the 50 attack limit. If you choose this option, it still uses the available 50 attacks, just the ordering between villages would be different.

Many people use a configuration where the bot remembers the barbarian villages for most attacks, which makes them less likely to experience this situation.

Yes, the way is make it remember is to configure more farm cycles. The bot remembers all those coordinates within the same session, so it can reuse this knowledge, starting with the second farm cycle. (It sends only one attack per target per farm cycle, to the remembering does not affect the first farm cycle)

To enable more farm cycles, start the bot with a configuration. If you used the Command Prompt to start the bot, you can apply the configuration using an adapted command.
In your case, the command would be this:

botengine  run-bot  --online-session  --bot-configuration="number-of-farm-cycles = 4, break-duration = 20 - 40"  "https://github.com/Viir/bots/tree/4a4f4b8ba166a441882214337f0b129ea6430da0/implement/applications/tribal-wars-2/tribal-wars-2-farmbot"         

If you apply this configuration, the bot also shows this message after completing the first farm cycle:

Completed 1 of 4 farm cycles.

1 Like