Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGB pixels are all zero? #329

Open
tspeterkim opened this issue Jul 23, 2021 · 0 comments
Open

RGB pixels are all zero? #329

tspeterkim opened this issue Jul 23, 2021 · 0 comments

Comments

@tspeterkim
Copy link

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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant