-
-
Notifications
You must be signed in to change notification settings - Fork 42
How can we support fighting Sirens? #48
Comments
I'd like to see your code and the assets you used. |
Sure def get_enemies(self, blacklist=[]):
sim = 0.99
if blacklist != []:
Logger.log_info('Blacklist: ' + str(blacklist))
self.l = [x for x in self.l if (x not in blacklist)]
while self.l == []:
Utils.update_screen()
l1 = filter(lambda x:x[1] > 80 and x[1] < 977 and x[0] > 180, map(lambda x:[x[0] - 3, x[1] - 45], Utils.find_all('enemy/fleet_level', sim - 0.15, self.chapter_map)))
l1 = [x for x in l1 if (not self.filter_blacklist(x, blacklist))]
l2 = filter(lambda x:x[1] > 80 and x[1] < 977 and x[0] > 180, map(lambda x:[x[0] + 75, x[1] + 110], Utils.find_all('enemy/fleet_1_down', sim, self.chapter_map)))
l2 = [x for x in l2 if (not self.filter_blacklist(x, blacklist))]
l3 = filter(lambda x:x[1] > 80 and x[1] < 977 and x[0] > 180, map(lambda x:[x[0] + 75, x[1] + 110], Utils.find_all('enemy/fleet_2_down', sim - 0.02, self.chapter_map)))
l3 = [x for x in l3 if (not self.filter_blacklist(x, blacklist))]
l4 = filter(lambda x:x[1] > 80 and x[1] < 977 and x[0] > 180, map(lambda x:[x[0] + 75, x[1] + 130], Utils.find_all('enemy/fleet_3_up', sim - 0.06, self.chapter_map)))
l4 = [x for x in l4 if (not self.filter_blacklist(x, blacklist))]
l5 = filter(lambda x:x[1] > 80 and x[1] < 977 and x[0] > 180, map(lambda x:[x[0] + 75, x[1] + 110], Utils.find_all('enemy/fleet_3_down', sim - 0.06, self.chapter_map)))
l5 = [x for x in l5 if (not self.filter_blacklist(x, blacklist))]
l6 = filter(lambda x:x[1] > 80 and x[1] < 977 and x[0] > 180, map(lambda x:[x[0] + 35, x[1] + 100], Utils.find_all('enemy/fleet_siren_dd_blue', sim - 0.1, self.chapter_map)))
l6 = [x for x in l6 if (not self.filter_blacklist(x, blacklist))]
l7 = filter(lambda x:x[1] > 80 and x[1] < 977 and x[0] > 180, map(lambda x:[x[0] + 35, x[1] + 100], Utils.find_all('enemy/fleet_siren_ca_blue', sim - 0.1, self.chapter_map)))
l7 = [x for x in l7 if (not self.filter_blacklist(x, blacklist))]
l8 = filter(lambda x:x[1] > 80 and x[1] < 977 and x[0] > 180, map(lambda x:[x[0] + 35, x[1] + 100], Utils.find_all('enemy/fleet_siren_cl_blue', sim - 0.1, self.chapter_map)))
l8 = [x for x in l8 if (not self.filter_blacklist(x, blacklist))]
l9 = filter(lambda x:x[1] > 80 and x[1] < 977 and x[0] > 180, map(lambda x:[x[0] + 35, x[1] + 100], Utils.find_all('enemy/fleet_siren_cv_blue', sim - 0.1, self.chapter_map)))
l9 = [x for x in l9 if (not self.filter_blacklist(x, blacklist))]
self.l = l1 + l2 + l3 + l4 + l5 + l6 + l7 + l8 + l9
sim -= 0.005
self.l = Utils.filter_similar_coords(self.l)
return self.l When I run it, it crash with below msg
|
I pasted your code and your assets in my working tree: the code ran fine, I didn't get your error. I think you might have named your assets in a different way or put them in another folder and cv2 failed to load them. As for the assets, I think they need to be remade since even after lowering the similarity threshold to below 0.9 they weren't detected and the bot started findings random points on the map. Did you get the screenshots by running |
Here you have a more detailed guide: https://github.com/Egoistically/ALAuto/wiki/Creating-new-assets-for-bot. |
Referencing this since I'd like to make the siren addition to my own working copy, the code above should still work in the current latest version correct? It's just potentially a matter of remaking the assets? |
Yeah with proper assets it should work fine. |
Yes, I did.
I cropped via ACDSee, save it, then put it in
Thank you @hjk22, @Egoistically |
I able to support fighting sirens now. |
Gonna give it a go with these assets, also have a question regarding assets: if you clear the background out and leave it transparent keeping only the actual siren's sprite) would detection be more accurate? in this case for example, removing the background to leave just parts of the siren regarding the code in Line 445 in 70f52a5
what does the -0.15 signify? what does altering the value do, as i noticed it is different (in the following lines) based on what asset the script is looking for For the moment everything seems to work fine, script found sirens and engaged them correctly Think it's safe to say that everything is working smoothly, left the script unattended while running some errands and there were no problems |
@didzkows, I think that's the offset for param |
What @sukitpr said, some enemies are easier/harder to detect than others, that offsets default similarity. |
@Egoistically Cheers, any input on my question regarding assets.
|
I haven't tried that yet. Thus, I think transparent wouldn't work. You could give it a try! :) |
I'll try answering your question about the background transparency in assets @didzkows, but I'm not an expert of image recognition algorithms. EDIT: I didn't see your answer sukitpr, but it's pretty much what you said. |
Thank you kindly, looks fascinating but as you mentioned not something that is overly important with regards to this project. |
Closing this issue since an option to detect sirens has been implemented. |
For most of events, there are some sirens spawn to the map.
So I try to add support them at below code in
combat.py
:ALAuto/modules/combat.py
Lines 442 to 460 in 70f52a5
I added new
l6
,l7
,l8
by trying to calculate from graphic from enemy sirens of each type (DD, CL, CA) but couldn't make it.I'm quite new in python so please shade me some light so I can open PR later :)
The text was updated successfully, but these errors were encountered: