pysc2 icon indicating copy to clipboard operation
pysc2 copied to clipboard

RGB pixels are all zero?

Open tspeterkim opened this issue 3 years ago • 0 comments

I'm trying to get the RGB screen and minimap values. The exact code that I'm running is as such (I'm on a mac):

from pysc2.agents import base_agent, scripted_agent
from pysc2.env import sc2_env
from pysc2.lib import actions, features, units
from absl import app

def main(unused_argv):
    agent = scripted_agent.MoveToBeacon()
    try:
        while True:
            with sc2_env.SC2Env(map_name='MoveToBeacon',
                                players=[sc2_env.Agent(sc2_env.Race.zerg)],
                                agent_interface_format=features.AgentInterfaceFormat(
                                    rgb_dimensions=features.Dimensions(screen=84, minimap=64),
                                ),
                                step_mul=16,
                                game_steps_per_episode=0,
                                visualize=True) as env:
                agent.setup(env.observation_spec(), env.action_spec())

                timesteps = env.reset()
                agent.reset()

                while True:
                    step_actions = [agent.step(timesteps[0])]
                    if timesteps[0].last():
                        break
                    timesteps = env.step(step_actions)
    except KeyboardInterrupt:
        pass

if __name__ == '__main__':
    app.run(main)

Basically, I'm just running the MoveToBeacon mini game agent.

However, when I check timesteps[0].observation['rgb_screen'], I am always getting (480, 276, 3) numpy array with all zeros!

  • Getting all zeros for RGB values doesn't seem right. How do I fix this?
  • 480, 276 dimension values look arbitrary since I set the dimension of screen as 84. How are the dimensions calculated for RGB screen and minimap values?

tspeterkim avatar Jul 23 '21 08:07 tspeterkim