Thank you @djvj , yes some help could speed up the development a lot. I often rely on other people to open a game client and share the game mechanics and the parts of the interactions to be automated. Usually, there is no time left for me to open a game client myself.
This year, I have not opened the game client and do not remember the necessary interactions. As far as I remember, the bot did collect coins by clicking representations of coins floating above buildings.
Is that enough functionality of the first version of the bot? Do we need anything more than that?
Since I never used the bot, I am unfamiliar of the extent of it’s functionality or exactly how it determined when a coin can be clicked. I thought it would at least que up new production, which would really be ideal, that and train troops. So Ideally a bot would do this:
Coins
Click ~50 pixels under coin (coin itself hovers over building above it)
Production
Same as above, but once all production is gone off screen, click building, then click next que, close popup window
Barracks
Click new Barracks/Training Grounds, que up next soldier, close popup window
These are the main 3 that require users to really check in constantly.
Do we have a sample image of how the coin looks in the game client? When I have a sample image in original quality, I can use that to train a function that located the coin on the screen.
Thank you very much! I see you chose PNG as the file format. I wonder if I should convert it to BMP in the training repository to simplify the parsing. Windows Explorer says the PNG file is 447 KB in size. I used Paint.NET to save a representation in BMP. That one is 483 KB large. So the conversion to BMP did not increase the size much. I expect we don’t use any precision with this conversion.
Yea it probably prefers the raw bitmap image for .net. Changing format shouldn’t be an issue. If you need another one saved as BMP for any reason, I can grab another. Precision will play the role in avoiding false positives.
Select the window the bot should operate on in the “pick window” tab.
To select the game window, check the checkbox “pick next focused window” and then click on the game window.
If the window has been successfully selected, its title will be shown under “last picked window”.
There is no pick window tab. All I see is this: https://imgur.com/Lw5FsPL
So basically I have no ability to pick the window/tab the bot should be looking at.
Good point. We need some way to pick the target window. I forgot to mention that. Here is how it works today: The bot picks the topmost window in the display order, the one in the front. This selection happens once when starting the bot. The bot then remembers the window address and continues working on the same window.
To use this bot, bring the target window to the foreground after pressing the button to run the bot. When the bot displays the window title in the status text, you know it has completed the selection.
In the screenshot you posted, the bot status text shows it picked the window of the botlab client.
Ok I see that I have to click play, then immediately select the browser window, otherwise it picks the bot window, which is topmost at the time. I did that, the bot sees the correct window, gets its screenshot, finds 5 object in 5 locations, which there are actually 16 on screen, and sits there and nothing ever happens.
I work in the window with title ‘Elvenar - Fantasy City Builder Game - Google Chrome’.
Operate bot:
The last screenshot had a width of 1936 and a height of 1048 pixels.
I found the object in 5 locations:
[ { x = 1689, y = 548 }, { x = 1400, y = 519 }, { x = 1375, y = 392 }, { x = 1212, y = 425 }, { x = 1081, y = 1013 } ]
Waiting for task to complete.
I work in the window with title ‘Elvenar - Fantasy City Builder Game - Google Chrome’.
Operate bot:
The last screenshot had a width of 1936 and a height of 1048 pixels.
I found the object in 4 locations:
[ { x = 1400, y = 519 }, { x = 1375, y = 392 }, { x = 1212, y = 425 }, { x = 1081, y = 1013 } ]
Waiting for task to complete.
I noticed the bot is using between 30-60% cpu and 1.7GB ram, so it’s very busy doing nothing or stuck in a loop.
Seeing these numbers, I will invest in reducing runtime expenses next. The image processing framework is new, and I see some low-hanging fruits that might reduce the expenses to a fraction. Maybe I get to implement this next week. We will then check the recording from your session for the missing matches.
I tried the bot, but it doesn’t works or doesn’t start
in the botlab window it comes
Get the next reading from the game
Taking the first reading from the window…
— Framework —
Waiting for 0 task(s) to complete:
2 task(s) from bot in queue
Stopped with result: Failed to create volatile process: System.Exception: Failed to setup the volatile process: System.Exception
—> Microsoft.CodeAnalysis.Scripting.CompilationErrorException: (177,8): error CS8983: Eine „Struktur“ mit Feldinitialisierern muss einen explizit deklarierten Konstruktor enthalten.
at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.ThrowIfAnyCompilationErrors(DiagnosticBag diagnostics, DiagnosticFormatter formatter)
at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.CreateExecutor[T](ScriptCompiler compiler, Compilation compilation, Boolean emitDebugInformation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.Script1.GetExecutor(CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Scripting.Script1.RunAsync(Object globals, Func2 catchException, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Scripting.Script1.RunAsync(Object globals, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript.RunAsync[T](String code, ScriptOptions options, Object globals, Type globalsType, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript.RunAsync(String code, ScriptOptions options, Object globals, Type globalsType, CancellationToken cancellationToken)
at BotLabClient.VolatileProcess.RunScript(String script)
— End of inner exception stack trace —
at BotLabClient.VolatileProcess…ctor(Func`2 getFileFromHashSHA256, String csharpScriptCode, Object scriptGlobals)
at BotLab.Client.PlaySession.PerformAgentTask(StartTask startTask)
This one works normally also with BotLab client version 2022-10-07.
The status text from the bot then looks like this:
Wait before starting next reading...
Last reading from window: window.width = 880, window.height = 774, windowClientArea.width = 862, windowClientArea.height = 765, observed = 0, 0, 878, 772
Pixels: 170280 binned 2x2, 19992 original.
I found the coin in 3 locations:
[ { x = 415, y = 452 }, { x = 403, y = 323 }, { x = 173, y = 328 } ]
--- Framework ---
I work in the window with title '2022-03-07-elvenar-djvj-BTqe1xf.bmp - Paint'.
Waiting for 0 task(s) to complete:
0 task(s) from bot in queue
Operate bot
This week I made a new version of the Elvenar bot. It is now easier to use and more robust when locating in-game objects like, for example, the coins to collect.
I will update that thread when new features arrive. Support for workshops and aggregating performance metrics/collection counters will probably be next.
Hello and thank you for all the effort i would like to ask if there is any update on this project i tried using the botlab and im getting this error
Failed building JavaScript on retry: Failed compiling the bot program code: in file src/Backend/InterfaceToHost_Root.elm: Unknown bot interface version ID: ‘20210823’. This compiler only supports the following 2 versions: 2023_02_06, 2023_05_15
i think it means that it is outdated, anything we could do ?
Thank you again in advance have a nice day