skjb / pysc2-tutorial

Tutorials for building a PySC2 bot
https://medium.com/@skjb/building-a-basic-pysc2-agent-b109cde1477c
MIT License
287 stars 85 forks source link

I got error #17

Open rubashka opened 5 years ago

rubashka commented 5 years ago
player_y, player_x = (obs.observation["minimap"][_PLAYER_RELATIVE] == _PLAYER_SELF).nonzero()

KeyError: 'minimap'

Why does it happen and how can I fix it...?

Migdalin commented 5 years ago

Looks like there may be some breaking changes from a newer release of pysc2? In the "Refining the Sparse Reward Agent": From the command line I got an error that "T" is not a valid race type. Changing that to "terran" allowed the simulation to launch, but it soon crashed with a "key not found" error:

File "skjb\pysc2-tutorial\Refining the Sparse Reward Agent\refined_agent.py", line 173, in step unit_type = obs.observation['screen'][_UNIT_TYPE] KeyError: 'screen'

AkshayGudi commented 3 years ago

Very late solution post, but will be useful for other people hopefully,

IF YOU ARE USING pysc2 version 3.0.0

  1. Instead of obs.observation['screen'][_UNIT_TYPE] use
    obs.observation["feature_screen"][_UNIT_TYPE]

  2. Instead of obs.observation["minimap"][_PLAYER_RELATIVE] use obs.observation["feature_screen"][_PLAYER_RELATIVE]