Farm Manager - Tribal Wars 2 Farmbot

help me please))

Starting the bot…

running bot ef8b6657b4… using client v2021-11-03 failed with exception: System.NotImplementedException: Failed for 1 attempts. Output file not found. Maybe the output from the Elm make process from the last attempt helps to find the cause:
Exit Code: 1
Standard Output:
Dependency problem!

Standard Error:
'-- PROBLEM BUILDING DEPENDENCIES -----------------------------------------------

I ran into a compilation error when trying to build the following package:

stil4m/elm-syntax 7.2.7

Hello and Welcome Danu!

That looks like a part of the error message is missing.
Below the part that we see here there are more details on the error. When you copy these too, we can understand the problem.

I will add a function to copy the error message to the client software. This will make it easier to copy the complete text.

Getting error below. Bot doesn’t re-open the game client after and get stuck at this phase.

<--- Last few GCs --->

[3560:000001D333C111F0]  2164584 ms: Scavenge 7.2 (7.8) -> 6.3 (7.8) MB, 0.8 / 0.0 ms  (average mu = 0.992, current mu = 0.992) allocation failure
[3560:000001D333C111F0]  2169148 ms: Scavenge 7.2 (7.8) -> 6.3 (7.8) MB, 1.5 / 0.0 ms  (average mu = 0.992, current mu = 0.992) allocation failure
[3560:000001D333C111F0]  2170396 ms: Scavenge 7.2 (7.8) -> 6.4 (7.8) MB, 0.9 / 0.0 ms  (average mu = 0.992, current mu = 0.992) allocation failure


<--- JS stacktrace --->


#
# Fatal javascript OOM in Committing semi space failed.
#

Press any key to continue . . .

What is the text above that error message? With the full text, I will see more of the path taken in this case.

I will add a function to copy the error message to the client software. This will make it easier to copy the complete text.

EDIT:
The new graphical user interface has this button for easy export of error messages and other relevant information:
image

Here is the full

Bot 45f9664606... in session '9a45b1965a017e6af068' ('2021-11-22T05-48-43-e2a677') is running. Press SHIFT + CTRL + ALT keys to pause the bot.                                                                                                  Last bot event was 0 seconds ago at 06-22-35.919. There are 0 tasks in progress.                                        Status message from bot:                                                                                                                                                                                                                        Session performance: attacks sent: 6, coordinates read: 211, completed farm cycles: 1                                   Completed first farm cycle 28 minutes ago with 1 villages (Attack limit: 1). Sent 6 attacks in 4 minutes.               ---                                                                                                                     Checked 205 unique coordinates and found 12 villages, 6 of which are barbarian villages.                                Found 1 own villages.                                                                                                   Did not yet read battle reports.                                                                                        Started the web browser 1 times, last time was 33 minutes ago.                                                                                                                                                                                                                                                                                                          Current activity:                                                                                                       + Next farm cycle starts in 16 minutes. Last cycle completed 28 minutes ago.                                            ---                                                                                                                     Settings: cycles: 999, breaks: 45 - 60, max dist: 50, web-browser-user-profile-id: default                              --------                                                                                                                Web browser framework status:                                                                                           Last script run result is: Success: {"WebBrowserClosed":{}}                                                             Current activity: Operate bot.                                                                                                                                                                                                                  
<--- Last few GCs --->

[9868:000002C9EE340A70]  1995182 ms: Scavenge 9.9 (10.6) -> 8.9 (10.6) MB, 0.6 / 0.0 ms  (average mu = 0.995, current mu = 0.997) allocation failure
[9868:000002C9EE340A70]  2003685 ms: Scavenge 9.9 (10.6) -> 8.9 (10.6) MB, 0.5 / 0.0 ms  (average mu = 0.995, current mu = 0.997) allocation failure
[9868:000002C9EE340A70]  2009361 ms: Scavenge 9.9 (10.6) -> 8.9 (10.6) MB, 0.5 / 0.0 ms  (average mu = 0.995, current mu = 0.997) allocation failure


<--- JS stacktrace --->


#
# Fatal javascript OOM in Committing semi space failed.
#

Press any key to continue . . .

Great, that gives a much more complete picture. In that sample, I also see that the error came via the chrome instance controlled via the volatile process and not from the javascript engine that runs in the botlab client.

One implication is that we will find the error message reflected in the session record. The embedding, in turn, helps to see the relation to session duration and the duration since the last reopening of the web browser.

The session performance statistics we see in your texts help us understand how early in a session this problem occurred.

The error message indicates a problem related to the amount of available memory.
Since we now know which instance was affected, I can add functionality to monitor that instance to see how much it uses on your setup.

One thing you can do immediately is to change the in-game configuration to try to reduce memory usage.

I will look into updating the integrated web browser to a newer version. That might also help with these kinds of problems.

Independent of the information we get through the botlab client, we can use the Windows Task Manager app to check how much memory the browser uses. This screenshot shows how Task Manager displays information on memory usage:

I updated the bot to use a newer version of that chromium browser.

Before using the new bot, install the new botlab client I also released today: https://to.botlab.org/guide/how-to-install-the-botlab-client-and-register-the-botlab-command

Then you can run the new bot from
https://catalog.botlab.org/2979167a62ed916a80365b31bfe7123694488eb3fcd0d4bc84ed0650f3155500

What result do you get with bot 2979167a62?

It not giving the error message anymore but it still not able to properly re-launch the browser again. This is what it’s spitting out now.

Bot 2979167a62... in session 'c9c1f19613bd3ade1d0f' ('2021-11-23T19-29-11-50d78c') is running. Press SHIFT + CTRL + ALT keys to pause the bot. Last bot event was 0 seconds ago at 22-02-56.559. There are 1 tasks in progress ( setup-11 ). Status message from bot: Session performance: attacks sent: 59, coordinates read: 1641, completed farm cycles: 1 Completed first farm cycle 121 minutes ago with 2 villages (Attack limit: 1, Out of units: 1). Sent 59 attacks in 31 minutes. --- Sent 0 attacks in the current cycle. Checked 1471 unique coordinates and found 174 villages, 59 of which are barbarian villages. Found 2 own villages. Did not yet read battle reports. Started the web browser 308 times, last time was 0 minutes ago. Current activity: + Waiting because reloaded web page 9 seconds ago. waiting for completion (pending request) --- Settings: cycles: 999, breaks: 25 - 35, max dist: 50, web-browser-user-profile-id: default -------- Web browser framework status: Last script run result is: Error: Exception from volatile process: System.AggregateException: One or more errors occurred. (One or more errors occurred. (Timed out after 30000 ms while trying to connect to Base!)) ---> System.AggregateException: One or more errors occurred. (Timed out after 30000 ms while trying to connect to Base!) ---> PuppeteerSharp.ProcessException: Timed out after 30000 ms while trying to connect to Base! at PuppeteerSharp.States.ChromiumStartingState.StartCoreAsync(LauncherBase p) at PuppeteerSharp.States.ChromiumStartingState.StartCoreAsync(LauncherBase p) at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options.... Current activity: Waiting for completion of task 'setup-11': Starting the web browser. This can take a while because I might need to download the web browser software first.

1 Like

I’ve also found out if I lower my break time to a short duration like 5 min it works fine, it seems like it’s having a hard time when it’s a longer break duration like 30min.

Update: Works fine if the break isn’t longer than 20min. So, there is something that preventing it from opening the browser when it’s longer than 20Min. Not sure if there’s anything I can do to help find the culprit.

1 Like

Thanks, these observations are plenty to work with for now.
That looks like we can avoid the problem just by opening the web browser again earlier, with an empty page. With a blank page, the web browser should not consume significant resources. When the break is over, we can let it load the game website again.
I will post here when I have implemented this approach.
Besides, I can do some research based on the error message you found.

1 Like

I implemented this approach with bot 5dc8f27d88
You can run it from https://reactor.botlab.org/catalog/5dc8f27d88feb2fe

This is working great! It also now works with ranging breaks which is great, Thanks so much!

1 Like

Thank you for checking it. I also updated the guide for the latest version of the bot program. The latest version also fixed a bug that caused the bot to restart the web browser too often when the game had not been loaded yet.
You can find it at https://catalog.botlab.org/9ddb087cd1b6da29

1 Like

Yes, you can now do that with https://catalog.botlab.org/7bd210a6b1742134

Add open-website-on-start to your bot settings to choose the website you want to open. There are many different servers for Tribal Wars 2, so it depends on your account. You can copy the address to use in the settings from the browser’s address bar.

1 Like

Where is the attack time counting bot? What more units are going? Is the bot discoverable? Overflow is

I must be doing something wrong here. When entering the website, do I have to put a specific format for it to work? Because I get this.

Bot 7bd210a6b1... in session '1cc81135e76a3dc22849' ('2021-12-17T15-05-25-b68997') is running. Press SHIFT + CTRL + ALT keys to pause the bot.                                                                                                  Last bot event was 0 seconds ago at 15-05-43.434. There are 0 tasks in progress.                                        Status message from bot:                                                                                                                                                                                                                        Error: Failed to parse these bot-settings: Failed to parse assignment 'open-website-on-start = https://en.tribalwars2.com/game.php?world=en&character_id=#': Did not find the equals sign '=' in this text.                          Here is an example of an assignment:                                                                                    break-duration = 1234                                                                                                   --------                                                                                                                Web browser framework status:                                                                                           Last script run result is: Nothing                                                                                      Current activity: The bot finished the session.                                                                                                                                                                                                 
Session 1cc81135e76a3dc22849 finished: The bot has sent the signal to finish the session.

Session 1cc81135e76a3dc22849 finished: The bot has sent the signal to finish the session.
[2021-12-17T15-05-44] v2021-11-23 Session ended.

Update: So, it looks like it doesn’t work when there’s a ‘=’ in the link itself. Works when the link doesn’t contain that equal sign. It would need to work with the Equal sign if the player has multiple world or it won’t know which one to open.

1 Like

Right, 7bd210a6b1 does not support an equals sign in the open-website-on-start setting. I am looking for an update to support that scenario too.
One way to solve it would be to apply some decoding of that string. But then the user would need to apply the encoding when building the settings.
Maybe we get around asking the user to apply encoding with smarter parsing. We could ignore all equals signs following the first one when breaking the string to separate setting names and values.

I found a solution. Now there is this new bot that also supports URLs containing equals signs for the open-website-on-start setting: https://reactor.botlab.org/catalog/8e4889805127fc25

It accepts the link with equal signs. But the issue now is, it doesn’t recognize the rest of the parameters like how many cycles, breaks, outgoing preset…etc.

Completed first farm cycle 0 minutes ago with 16 villages (No preset: 16). Sent 0 attacks in 0 minutes.                 ---                                                                                                                     Checked 0 unique coordinates and found 0 villages, 0 of which are barbarian villages.                                   Found 16 own villages.                                                                                                  Did not yet read battle reports.                                                                                        Started the web browser 1 times, last time was 0 minutes ago.                                                                                                                                                                                                                                                                                                           Current activity:                                                                                                       + Currently selected village is 4055 (507|959 'B0'. Last update 15 s ago. 987 available units. 14 outgoing commands.)                                                                                                                 ++ Found no army presets matching the patterns ['farm'].                                                                +++ Current village is completed (No matching preset for this village.).                                                ++++ All villages completed.                                                                                            +++++ Finish farm cycle.                                                                                                ++++++ Finish session because I finished all 1 configured farm cycles.                                                  ---                                                                                                                     Settings: cycles: 1, breaks: 90 - 120, max dist: 50, web-browser-user-profile-id: default                               --------                                                                                                                Web browser framework status:                                                                                           Last script run result is: Success: {"RunJavascriptInCurrentPageResponse":{"requestId":"19","webBrowserAvailable":true,"directReturnValueAsString":"{\"getPresets\"....                                                                         Current activity: The bot finished the session.                                                                                                                                                                                                 
Session b474e6b32082205771e1 finished: The bot has sent the signal to finish the session.

Session b474e6b32082205771e1 finished: The bot has sent the signal to finish the session.
[2021-12-20T15-09-13] v2021-11-23 Session ended.

The way I’ve got around it is making a redirection into a short link so it doesn’t contain the equal sign for those wondering.