google-deepmind / pysc2

StarCraft II Learning Environment
Apache License 2.0
8.03k stars 1.16k forks source link

From 7a04e74 to b07986f Attack_minimap not working #170

Closed cdesilv1 closed 6 years ago

cdesilv1 commented 6 years ago

From Commit 7a04e74 (currently latest master branch commit as of 2018.05.06) to Commit b07986f (currently latest dev branch commit as of 2018.05.06), actions.FUNCTIONS.Attack_minimap doesn't work. When called in my created agent as:

return actions.FUNCTIONS.Attack_minimap('now', self.transformLocation(int(x) + (x_offset * 8), int(y) + (y_offset * 8)))

Once the agent hits the return, there is a long output of trace-backs that end at lib.features.func_call_ability which gives ValueError: Unknown ability_id: 3674, type: cmd_quick. Likely a bug. Pastebin link with full bash CLI trace-back: https://pastebin.com/FAVaQX7t.

The issue seems to be with how the command is stored in the actions.py file, where stored in the FUNCTIONS variable, FUNCTIONS stores Function.ability objects in the notation Function.ability(func_id, name, func, ab_id, general_id).

However, Attack_minimap only has 4 items, not 5 like most of the rest of the items generated by gen_actions.py. I have not tested this issue with any of the other commands that only contain 4 items, although since this failed in lib.features.func_call_ability, it is possible this issue is only relevant to abilities that both have only 4 properties and are cmd_minimap type commands, as I suspect, or it may cover a larger scope. From func_id 12-20, they share general_id 3674. Since Attack_minimap is missing ab_id, general_id somehow gets read in as ab_id in lib.features.func_call_ability and everything crashes, even though lib.features.func_call_ability does not throw this issue in the current master branch, with FUNCTIONS appearing unchanged from 7a04e74 to b07986f. In the FUNCTIONS variable, changing general_id of Attack_minimap from 3674 to something like 13 or 14 (numbers specifically tested) causes the program not to crash any-more, but Attack_minimap will not execute in any way, as the units will be selected, no action taken, then the step continued.

Other relevant information: OS: Ubuntu 16.04 Starcraft II Patch Level: 3.16 map: Simple64 agent_race: terran use_feature_units: True, Edit: also fails with False

tewalds commented 6 years ago

The code you're referencing is definitely correct. Attack_minimap is ability 3674, and is the general attack action that subsumes Attack_Attack_minmap, Attack_AttackBuilding_minimap, etc, which is why those ones reference it. You'll see the majority of actions (eg Behavior_CloakOff_quick) don't have a general id since they aren't subsets of some other action.

The general actions were added later, so maybe you're missing the stableid.json file that lets the game know what 3674 actually means. You say you're running 3.16, which seems unlikely given that the first version that was released was 3.16.1. Maybe give 4.0.1 a try? Alternatively try the 4.1.2 that Blizzard is about to release (linked to in the discord channel, or on their website next week).

tewalds commented 6 years ago

4.1.2 is out, so give that one a try.

wartenhx commented 5 years ago

4.1.2 is out, so give that one a try.

have you fixed that problem? i have tried 3.17 and 4.7.1 versions, but still got that issue?