ANRAR4 / AutoBTD6

The scripts contained in this repository allow you to automatically play any gamemode on any map in Bloons TD6
31 stars 4 forks source link

Amd gpu support? #1

Closed asi4luk closed 1 year ago

asi4luk commented 1 year ago

Hi, so i have AMD gpu and i get these errors image Which I found are caused by that i have AMD gpu, any alternative ideas how to fix this problem?

ANRAR4 commented 1 year ago

Do the errors cause the script to exit? As far as i know they shouldn't as the script should disable gpu usage in general. If the errors cause the script to exit you could try to uninstall tensorflow (pip uninstall tensorflow) and install the cpu only version pip install tensorflow-cpu --user.

asi4luk commented 1 year ago

Actually I have no idea what is it doing, when i execute command py replay.py file dark_castle#hard#2560x1440#noMK#noLLwMK.btd6 -r -mk while being on home screen it just appears to press the esc button every 5 seconds or so image

ANRAR4 commented 1 year ago

This would suggest the menu you are in doesn't get recognized by the script. Could you paste the entire output of the script? (including a few iterations of pressing esc). And is BTD6 running at native resolution and on your primary screen?

asi4luk commented 1 year ago

BTD6 is on primary screen running on 1920x1080 at fullscreen,

Microsoft` Windows [Version 10.0.19042.1889]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Xdmoj>d:

D:\>cd AutoBTD6

D:\AutoBTD6>py replay.py file dark_castle#hard#2560x1440#noMK#noLLwMK.btd6 -r -mk
2022-09-24 23:57:43.700527: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-09-24 23:57:43.700829: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2022-09-24 23:57:45.869231: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2022-09-24 23:57:45.869336: W tensorflow/stream_executor/cuda/cuda_driver.cc:263] failed call to cuInit: UNKNOWN ERROR (303)
2022-09-24 23:57:45.872713: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-GN1I2U9
2022-09-24 23:57:45.872868: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-GN1I2U9
2022-09-24 23:57:45.873153: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
[2022-09-24 23:57:46] stats logging enabled!
[2022-09-24 23:57:46] repeating objective indefinitely! cancel with ctrl + c!
[2022-09-24 23:57:46] including playthroughs with monkey knowledge enabled and adjusting prices according to userconfig.json!
[2022-09-24 23:57:48] new state GOTO_HOME!
[2022-09-24 23:58:07] screen BTD6_UNFOCUSED!
[2022-09-24 23:58:11] screen UNKNOWN!
[2022-09-24 23:58:20] screen BTD6_UNFOCUSED!
[2022-09-24 23:58:24] received SIGINT! exiting!

, Its just on the homescreen pressing ESC about every 5 seconds causing the "QUIT GAME" prompt to open and close

asi4luk commented 1 year ago

Could the cause be that, my main menu is slightly different from whats in D:\AutoBTD6\images\1920x1080\startmenu.png?

ANRAR4 commented 1 year ago

Could the cause be that, my main menu is slightly different from whats in D:\AutoBTD6\images\1920x1080\startmenu.png? Yes, this could be the cause. In what aspect is your main manu slightly different? And is the "screen size" setting in options (upper right corner) set to 1920x1080? If it is set to 1920x1080 the only thing you can do to get it working would be reproducing all screenshots in the images/1920x1080 folder.

asi4luk commented 1 year ago

the D:\AutoBTD6\images\1920x1080\startmenu.png vs my main menu image image

ANRAR4 commented 1 year ago

The marked differences shouldn't matter as the script only compares a small area in the image(in detail a part of the monkey knowledge symbol). One thing you could try would be to take a screenshot using py make_screenshot.py (stored in the screenshots folder) to check if it shows BTD6 as expected. Other than that the only thing you could try would be taking a screenshot of the main menu(e. g. using py make_screenshot.py) and replacing the one in images/1920x1080 to test if the script gets further.

asi4luk commented 1 year ago

I'll try it tommorow morning, thanks for blazing fast help.

Dne ne 25. 9. 2022 12:20 dop. uživatel ANRAR4 @.***> napsal:

The marked differences shouldn't matter as the script only compares a small area in the image(in detail a part of the monkey knowledge symbol). One thing you could try would be to take a screenshot using py make_screenshot.py (stored in the screenshots folder) to check if it shows BTD6 as expected. Other than that the only thing you could try would be taking a screenshot of the main menu(e. g. using py make_screenshot.py) and replacing the one in images/1920x1080 to test if the script gets further.

— Reply to this email directly, view it on GitHub https://github.com/ANRAR4/AutoBTD6/issues/1#issuecomment-1257074717, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3IEYRQ472WZ5R2ZZIHJJILV755D5ANCNFSM6AAAAAAQUZLTV4 . You are receiving this because you authored the thread.Message ID: @.***>

asi4luk commented 1 year ago

Replacing the startmenu screenshot fixed it, BUT now it will select hero, then select map, and will get stuck at the gamescreen (screenshot), any idea why is that happening? image

Microsoft Windows [Version 10.0.19042.1889]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Xdmoj>d:

D:\>cd AutoBTD6

D:\AutoBTD6>py replay.py file dark_castle#hard#2560x1440#noMK#noLLwMK.btd6 -r -mk
2022-09-25 12:24:06.823306: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-09-25 12:24:06.823410: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2022-09-25 12:24:08.890217: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2022-09-25 12:24:08.890303: W tensorflow/stream_executor/cuda/cuda_driver.cc:263] failed call to cuInit: UNKNOWN ERROR (303)
2022-09-25 12:24:08.893444: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-GN1I2U9
2022-09-25 12:24:08.893580: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-GN1I2U9
2022-09-25 12:24:08.893944: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
[2022-09-25 12:24:09] stats logging enabled!
[2022-09-25 12:24:09] repeating objective indefinitely! cancel with ctrl + c!
[2022-09-25 12:24:09] including playthroughs with monkey knowledge enabled and adjusting prices according to userconfig.json!
[2022-09-25 12:24:09] screen STARTMENU!
[2022-09-25 12:24:09] goal GOTO_HOME fullfilled!
[2022-09-25 12:24:10] entered state management!
[2022-09-25 12:24:10] new state SELECT_HERO!
[2022-09-25 12:24:14] goal SELECT_HERO obyn_greenfoot fullfilled!
[2022-09-25 12:24:14] new state UNDEFINED!
[2022-09-25 12:24:15] screen UNKNOWN!
[2022-09-25 12:24:15] entered state management!
[2022-09-25 12:24:15] new state GOTO_HOME!
[2022-09-25 12:24:21] screen STARTMENU!
[2022-09-25 12:24:21] goal GOTO_HOME fullfilled!
[2022-09-25 12:24:21] new state UNDEFINED!
[2022-09-25 12:24:22] entered state management!
[2022-09-25 12:24:22] new state GOTO_INGAME!
[2022-09-25 12:24:31] screen UNKNOWN!
[2022-09-25 12:24:44] screen BTD6_UNFOCUSED!
ANRAR4 commented 1 year ago

I guess your ingame graphics slightly differ from mine(although i tested the script on two completely differently performant systems and it worked on both). To get it working you will need to reproduce and replace all images in the 1920x1080 folder. You can ignore the collection_events subfolder as there currently aren't any active collection events.

You can probably ignore/keep unknown_insta.png, unknown_insta_mask.png, unknown_insta_mask_raw.png, button_home.png and remove_obstacle_confirm_button.png. (All not fullscreen images as they don't need to be an exact match with you ingame graphics)

For levelup.png you can wait until one occurs while running the script. If it gets stuck you can take a screenshot and if it doesn't get stuck you don't need to replace it.

ANRAR4 commented 1 year ago

In the alternate_screen_recognition branch I modified the code so it checks for the best match instead of an exact match. So you could also try running the version from the alternate_screen_recognition branch without changing any images.

LukysGaming commented 1 year ago

The branch fixed the issues i had, but now i have problems with screen UNKNOWN! which results in fail of my game, from start i didnt touch anything on my pc, and it just keeps appearing, any idea why?

[2022-09-25 21:26:39] screen UNKNOWN!
[2022-09-25 21:26:44] screen INGAME_PAUSED!
[2022-09-25 21:26:47] screen UNKNOWN!
[2022-09-25 21:26:49] screen INGAME!
[2022-09-25 21:26:50] detected money: 5219, required: 4590
[2022-09-25 21:26:50] performing action: {'action': 'upgrade', 'name': 'sniper0', 'key': 53, 'pos': (713, 237), 'path': 2, 'cost': 4590}
[2022-09-25 21:26:50] screen UNKNOWN!
[2022-09-25 21:26:56] screen INGAME_PAUSED!
[2022-09-25 21:26:58] screen UNKNOWN!
[2022-09-25 21:27:01] screen INGAME!
[2022-09-25 21:27:24] detected money: 4259, required: 15120
[2022-09-25 21:27:25] screen UNKNOWN!
[2022-09-25 21:27:27] screen DEFEAT!
ANRAR4 commented 1 year ago

When does the output screen UNKNOWN! appear and does anything other than selecting or placing a tower, purchasing an upgrade and closing the tower upgrade panel happen? From your log I would assume it appeared when the script tried to upgrade a tower. Do you have the upgrade the script wanted to purchase unlocked? If not the behaviour is as expected and you can't use the playthrough as you don't have the upgrades required(hover over a playthrough in the table in README.md to see which upgrades are required). Or did you have another window/popup messages overlapping the play button(lower right corner)?

LukysGaming commented 1 year ago

I have all of sniper upgrades unlocked so I dont think thats the problem, Actually maybe the overlap is the issue because steam shows whenever someone launches a game. ill try to change the position and get back to you

LukysGaming commented 1 year ago

Looks like all the issues are now fixed! Tysm for your help and have a good rest of your day!