Giter VIP home page Giter VIP logo

pysc2's Introduction

PySC2 - StarCraft II Learning Environment

PySC2 is DeepMind's Python component of the StarCraft II Learning Environment (SC2LE). It exposes Blizzard Entertainment's StarCraft II Machine Learning API as a Python RL Environment. This is a collaboration between DeepMind and Blizzard to develop StarCraft II into a rich environment for RL research. PySC2 provides an interface for RL agents to interact with StarCraft 2, getting observations and sending actions.

We have published an accompanying blogpost and paper, which outlines our motivation for using StarCraft II for DeepRL research, and some initial research results using the environment.

About

Disclaimer: This is not an official Google product.

If you use the StarCraft II Machine Learning API and/or PySC2 in your research, please cite the StarCraft II Paper

You can reach us at [email protected].

Quick Start Guide

Get PySC2

PyPI

The easiest way to get PySC2 is to use pip:

$ pip install pysc2

That will install the pysc2 package along with all the required dependencies. virtualenv can help manage your dependencies. You may also need to upgrade pip: pip install --upgrade pip for the pysc2 install to work. If you're running on an older system you may need to install libsdl libraries for the pygame dependency.

Pip will install a few of the binaries to your bin directory. pysc2_play can be used as a shortcut to python -m pysc2.bin.play.

From Source

Alternatively you can install latest PySC2 codebase from git master branch:

$ pip install --upgrade https://github.com/deepmind/pysc2/archive/master.zip

or from a local clone of the git repo:

$ git clone https://github.com/deepmind/pysc2.git
$ pip install --upgrade pysc2/

Get StarCraft II

PySC2 depends on the full StarCraft II game and only works with versions that include the API, which is 3.16.1 and above.

Linux

Follow Blizzard's documentation to get the linux version. By default, PySC2 expects the game to live in ~/StarCraftII/. You can override this path by setting the SC2PATH environment variable or creating your own run_config.

Windows/MacOS

Install of the game as normal from Battle.net. Even the Starter Edition will work. If you used the default install location PySC2 should find the latest binary. If you changed the install location, you might need to set the SC2PATH environment variable with the correct location.

PySC2 should work on MacOS and Windows systems running Python 3.8+, but has only been thoroughly tested on Linux. We welcome suggestions and patches for better compatibility with other systems.

Get the maps

PySC2 has many maps pre-configured, but they need to be downloaded into the SC2 Maps directory before they can be played.

Download the ladder maps and the mini games and extract them to your StarCraftII/Maps/ directory.

Run an agent

You can run an agent to test the environment. The UI shows you the actions of the agent and is helpful for debugging and visualization purposes.

$ python -m pysc2.bin.agent --map Simple64

It runs a random agent by default, but you can specify others if you'd like, including your own.

$ python -m pysc2.bin.agent --map CollectMineralShards --agent pysc2.agents.scripted_agent.CollectMineralShards

You can also run two agents against each other.

$ python -m pysc2.bin.agent --map Simple64 --agent2 pysc2.agents.random_agent.RandomAgent

To specify the agent's race, the opponent's difficulty, and more, you can pass additional flags. Run with --help to see what you can change.

Play the game as a human

There is a human agent interface which is mainly used for debugging, but it can also be used to play the game. The UI is fairly simple and incomplete, but it's enough to understand the basics of the game. Also, it runs on Linux.

$ python -m pysc2.bin.play --map Simple64

In the UI, hit ? for a list of the hotkeys. The most basic ones are: F4 to quit, F5 to restart, F8 to save a replay, and Pgup/Pgdn to control the speed of the game. Otherwise use the mouse for selection and keyboard for commands listed on the left.

The left side is a basic rendering. The right side is the feature layers that the agent receives, with some coloring to make it more useful to us. You can enable or disable RGB or feature layer rendering and their resolutions with command-line flags.

Watch a replay

Running an agent and playing as a human save a replay by default. You can watch that replay by running:

$ python -m pysc2.bin.play --replay <path-to-replay>

This works for any replay as long as the map can be found by the game.

The same controls work as for playing the game, so F4 to exit, pgup/pgdn to control the speed, etc.

You can save a video of the replay with the --video flag.

List the maps

Maps need to be configured before they're known to the environment. You can see the list of known maps by running:

$ python -m pysc2.bin.map_list

Run the tests

If you want to submit a pull request, please make sure the tests pass on both python 2 and 3.

$ python -m pysc2.bin.run_tests

Environment Details

For a full description of the specifics of how the environment is configured, the observations and action spaces work read the environment documentation.

Note that an alternative to this environment is now available which provides an enriched action and observation format using the C++ wrappers developed for AlphaStar. See the converter documentation for more information.

Mini-game maps

The mini-game map files referenced in the paper are stored under pysc2/maps/ but must be installed in $SC2PATH/Maps. Make sure to follow the download instructions above.

Maps are configured in the Python files in pysc2/maps/. The configs can set player and time limits, whether to use the game outcome or curriculum score, and a handful of other things. For more information about the maps, and how to configure your own, read the maps documentation.

Replays

A replay lets you review what happened during a game. You can see the actions and observations that each player made as they played.

Blizzard is releasing a large number of anonymized 1v1 replays played on the ladder. You can find instructions for how to get the replay files on their site. You can also review your own replays.

Replays can be played back to get the observations and actions made during that game. The observations are rendered at the resolution you request, so may differ from what the human actually saw. Similarly the actions specify a point, which could reflect a different pixel on the human's screen, so may not have an exact match in our observations, though they should be fairly similar.

Replays are version dependent, so a 3.16 replay will fail in a 3.16.1 or 3.17 binary.

You can visualize the replays with the full game, or with pysc2.bin.play. Alternatively you can run pysc2.bin.replay_actions to process many replays in parallel.

pysc2's People

Contributors

botdot avatar bradensawatsky avatar brean avatar cole-maclean avatar cool-rr avatar gusqls1603 avatar inoryy avatar islamelnabarawy avatar jagapiou avatar jonhoye avatar k24d avatar luismesas avatar mgvalverde avatar michaelstuartjr avatar now-raymond avatar oriolvinyals avatar philomely avatar richardapowell avatar rsfbarreira avatar safplusplus avatar samvelyan avatar skjb avatar soygema avatar tewalds avatar tomwardio avatar tsuiwwwayne avatar ttinies avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pysc2's Issues

the problem of maps:reading map errors

I put the map packages into StarCraft II/Maps, but still show: "ERROR:root:Error reading map 'Simple64' from: /Applications/StarCraft II/Maps/Melee/Simple64.SC2Map"

Screen/minimap position inconsistencies

I'm using a screen size of (64,64), a minimap size of (64,64), and camera of size 24 on map Simple64. This results in a camera on the minimap of size (16,16).

I'd expect that a 1 pixel shift on the minimap results in a 4 pixel shift across the map since 64/16 = 4. This seems to be true, except every once in a while the pixel shift is only 2 resulting in inconsistent amount of traversal across the real map for traversal across the minimap.

I'm guessing this might have to do with the map having a size that isn't a perfect factor of 64? Any thoughts on why this might be happening?

Code that reproduces the issue:

from PIL import Image

from pysc2.agents import base_agent
from pysc2.lib import actions
from pysc2.env.environment import StepType

class Prototype(base_agent.BaseAgent):

    def __init__(self):
        super(Prototype, self).__init__()
        self.action_queue = [
                              # 2 px shift
#                             actions.FunctionCall(1, [(45, 45)]),
#                             actions.FunctionCall(1, [(46, 45)])

                             # Expected 4 px shift
                             actions.FunctionCall(1, [(45, 45)]),
                             actions.FunctionCall(1, [(44, 45)])
                            ]
        self.ix = list(range(len(self.action_queue)))
    
    def step(self, obs):
        super(Prototype, self).step(obs)
        
        if obs.step_type != StepType.FIRST:
            minimap = obs.observation['minimap']
            screen = obs.observation['screen']
        
            ix = self.ix.pop(0)
            
            Image.fromarray((screen[4] > 0).astype('uint8')*255).save('~/{}_screen.png'.format(ix))
            Image.fromarray((minimap[3] > 0).astype('uint8')*255).save('~/{}_minimap.png'.format(ix))
        
        return self.action_queue.pop(0)

python -m pysc2.bin.agent --agent agents.debugging_1.Prototype --map Simple64 --screen_resolution 64 --agent_race T

Change the size of the display window?

Hey hey, Linux user here.

Currently when I run the environment, my window is a bit wonky. I have multiple monitors and use i3, so my setup is non-standard to say the least.

I was wondering if there are any flags hidden away that I can use to define the size of the actual environment display window? (not the resolution of the feature layers themselves ^_^)

Any tips would be most appreciated!

Thanks!!

Support Multiplayer

I wrote my simple version of AI. And my friend wrote his own.
Is it possible to run one versus the other? Our only built-in one is now supported?
I read the documentation but didn't any way to do it.

Default random agent Out of Bound Error

When I ran Randomagent for BuildMarines, I got this error from time to time

Exception in thread Renderer:
Traceback (most recent call last):
  File "/home/jay/miniconda2/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/home/jay/miniconda2/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/jay/miniconda2/lib/python2.7/site-packages/pysc2/lib/renderer_human.py", line 878, in render_thread
    self.render_obs(obs)
  File "/home/jay/miniconda2/lib/python2.7/site-packages/pysc2/lib/renderer_human.py", line 56, in _with_lock
    return func(*args, **kwargs)
  File "/home/jay/miniconda2/lib/python2.7/site-packages/pysc2/lib/stopwatch.py", line 197, in _stopwatch
    return func(*args, **kwargs)
  File "/home/jay/miniconda2/lib/python2.7/site-packages/pysc2/lib/renderer_human.py", line 894, in render_obs
    surf.draw(surf)
  File "/home/jay/miniconda2/lib/python2.7/site-packages/pysc2/lib/renderer_human.py", line 352, in <lambda>
    lambda surf: self.draw_feature_layer(surf, feature))
  File "/home/jay/miniconda2/lib/python2.7/site-packages/pysc2/lib/stopwatch.py", line 197, in _stopwatch
    return func(*args, **kwargs)
  File "/home/jay/miniconda2/lib/python2.7/site-packages/pysc2/lib/renderer_human.py", line 849, in draw_feature_layer
    surf.blit_np_array(feature.color(feature.unpack(self._obs.observation)))
  File "/home/jay/miniconda2/lib/python2.7/site-packages/pysc2/lib/stopwatch.py", line 197, in _stopwatch
    return func(*args, **kwargs)
  File "/home/jay/miniconda2/lib/python2.7/site-packages/pysc2/lib/features.py", line 94, in color
    return self.palette[plane]
IndexError: index 16 is out of bounds for axis 0 with size 16

Question about Starcraft 2 Versions

Recently Blizzard has announced a major patch that is currently being beta tested. This patch would change some of the gameplay of SC2 and deprecate old replays and trained bots. Are we save to assume this API project will always stay up to date to the latest patch?

problem with subprocess.Popen in sc_process.py

Hi,
Firstly, I'd like to apologize if I'm annoying you because of too much opening issues.
But I'm in trouble with subprocess.Popen in sc_process.py

When I repeat to create and close SC2Env,
OSError occurs after a couple of iterations.
My codes looks like below.

for episode in range(start_epi, num_episodes):
    with sc2_env.SC2Env(
            "Odyssey",
            agent_race=myrace,
            bot_race=botrace,
            difficulty="1",
            visualize=visualize) as env:
        agent = minerva_agent.MinervaAgent(mainDQN)
        run_result = run_loop( blabla~~)
        env.close()

and full error codes are like below

ERROR:root:Failed to launch
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pysc2/lib/sc_process.py", line 119, in _launch
    return subprocess.Popen(args, cwd=run_config.cwd, env=run_config.env)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1490, in _execute_child
    restore_signals, start_new_session, preexec_fn)
OSError: [Errno 12] Cannot allocate memory

I'm currently using Ubuntu Linux
and I tried to increase my swap memory, but it only helps to increase only one more iteration.
I checked whether subprocess was killed or not (via psutil), but I guess env.close() works well.
If you need to check my full code, here it is.

Thank you.

RGB Pixel Values Question

Since the feature of having raw RGB pixels is not available, is it safe to assume the results created in the initial DeepMind paper were all done using the convolutional layers directly on the features such as unit_density and height_map? I am struggling to understand how the bot is trained. The observation data seems strange.

SyntaxError in Python 3

flake8 testing of https://github.com/deepmind/pysc2 on Python 3.6.2

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./pysc2/bin/gen_actions.py:143:50: E999 SyntaxError: invalid syntax
    if ability.target in (sc_data.AbilityData.None,
                                                 ^

connect to existing server

I think it would be reasonable to allow connecting to an existing server. For example, the cli args could take a host/port to connect to, instead of starting a new server process. This is particularly useful if the sc2 server is running on a remote host

Any one used save_map function?

I tried to use save_map function and it does not work?(No error or warning, but no map is saved.)

I use save_map(map_path='path/to/me', data=map_data)

How do I get the valid action space for a particular mini game map?

I know we could use "available_action" to get the result dynamically, is there a way to get the static valid action space for a mini game map?

Also, same question for Unit Type Feature map, the input could be huge regarding to 1850 different unit type, can we get certain unit type for certain mini game map?

pysc2.bin.replay_actions : Module not found "Queue"

When i try to run replay_actions, i get this error :

File "C:\Python36\lib\site-packages\pysc2\bin\replay_actions.py", line 24, in <module> import Queue ModuleNotFoundError: No module named 'Queue'

line used to run :
python -m pysc2.bin.replay_actions --replay <replay_path>
python -m pysc2.bin.replay_actions --help

Issues with screen dimensions

I'm trying to understand the relationship between screen, minimap, and camera dimensions.

For example, I'm using default values:

screen_size_px = (64, 64)
minimap_size_px = (64, 64)
camera_width_world_units = 24

With these values, I'd expect obs.observation['screen'].shape to be (13, 64, 64) but what is actually returned has the shape (13, 84, 84). Furthermore, this shape stays the same even when changing screen_size_px. Am I missing something or is this a bug?

Also, I don't understand the purpose of camera_width_world_units. Shouldn't screen_size_px be sufficient and camera_width_world_units becomes redundant? In other words, I expect the camera to render a portion of the map to the screen, so I'd expect the dimensionality of the camera to be the same as the dimensionality of the screen.

Edit:
Turns out I was editing the screen dimension in the wrong place and the FLAG default of 84 was not being changed as I thought it was. No issue here.

"Failed to create the socket" error

When I try to run pysc2.bin.play, I eventually get a "Failed to create the socket" error. It happens with all arguments as far as I can tell. The specific command I'm trying to run is: python -m pysc2.bin.play --map Simple64

If I kill the task with a ctrl-C, I get the following output:

File "C:\Program Files\Python36\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "C:\Program Files\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python36\lib\site-packages\pysc2\bin\play.py", line 183, in
main()
File "C:\Program Files\Python36\lib\site-packages\pysc2\bin\play.py", line 179, in main
app.really_start(_main)
File "C:\Program Files\Python36\lib\site-packages\pysc2\lib\app.py", line 50, in really_start
sys.exit(main(argv))
File "C:\Program Files\Python36\lib\site-packages\pysc2\bin\play.py", line 129, in _main
with run_config.start(full_screen=FLAGS.full_screen) as controller:
File "C:\Program Files\Python36\lib\site-packages\pysc2\run_configs\lib.py", line 102, in start
return sc_process.StarcraftProcess(self, **kwargs)
File "C:\Program Files\Python36\lib\site-packages\pysc2\lib\sc_process.py", line 74, in init
self._sock = self._connect(self._port)
File "C:\Program Files\Python36\lib\site-packages\pysc2\lib\stopwatch.py", line 197, in _stopwatch
return func(*args, **kwargs)
File "C:\Program Files\Python36\lib\site-packages\pysc2\lib\sc_process.py", line 139, in _connect
timeout=2 * 60) # 2 minutes
File "C:\Program Files\Python36\lib\site-packages\websocket_core.py", line 487, in create_connection
websock.connect(url, **options)
File "C:\Program Files\Python36\lib\site-packages\websocket_core.py", line 211, in connect
options.pop('socket', None))
File "C:\Program Files\Python36\lib\site-packages\websocket_http.py", line 71, in connect
sock = _open_socket(addrinfo_list, options.sockopt, options.timeout)
File "C:\Program Files\Python36\lib\site-packages\websocket_http.py", line 114, in _open_socket
sock.connect(address)

My set up:
windows 10
python 3.6.0
I run all my commands with an admin-enabled command prompt
I checked my firewall, and python is allowed to access all networks
My "SC2PATH" is set to "X:\Games\Starcraft II"

An example of supervised learning from replays

I am trying to reproduce the result of "supervised learning from replay" in the sc2le paper, but it seems to me that there is no tutorial on this topic.

By the way, how can I get actions triggered by a player in a replay?

pysc2.bin.replay_actions : parsing valid replays as invalid.

Hello, I'm still trying to make replay_actions work.

I've run across another bug : when I launch it with replay as arguments : python -m pysc2.bin.replay_actions --replays "D:\Program Files\StarCraft II\Replays\test", it first says 2 replay found (normal), but later in the execution, the replays are found to be invalid.

It might have something to do with the fact that there is a point from where the replay is referenced as "replay.SC2Repla", and nor "replay.SC2Replay" (the 'y' is missing).

Here is the file of the output I get : see the difference between line 40 and 41 , the 'y' disappeard, and the replay is invalid.
dump.txt

Meaning of each action's argument?

Hi,

I found a comment that describes about types of action's arguments.
There are 13 possible action argument's id,
and each stands for screen, minimap, queued, etc.

I understand the arguments of minimap, screen and queued,
but I have no idea what action argument means for the rest of cases.
For example, 3 with arg.name 'control_group_act', and so on.
And is it possible to unload all units, regardless of unit ids? like giving id=0 or etc.

Thank you.

Ladder2017Season1, 2, 3 are undefined names

flake8 testing of https://github.com/deepmind/pysc2 on Python 2.7.13

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./pysc2/maps/ladder.py:44:30: F821 undefined name 'Ladder2017Season3'
    ("AbyssalReef",          Ladder2017Season3, "AbyssalReefLE", 2),
                             ^

./pysc2/maps/ladder.py:45:30: F821 undefined name 'Ladder2017Season3'
    ("Acolyte",              Ladder2017Season3, "AcolyteLE", 2),
                             ^

./pysc2/maps/ladder.py:46:30: F821 undefined name 'Ladder2017Season3'
    ("AscensiontoAiur",      Ladder2017Season3, "AscensiontoAiurLE", 2),
                             ^

./pysc2/maps/ladder.py:47:30: F821 undefined name 'Ladder2017Season1'
    ("BelShirVestige",       Ladder2017Season1, "BelShirVestigeLE", 2),
                             ^

./pysc2/maps/ladder.py:48:30: F821 undefined name 'Ladder2017Season2'
    ("BloodBoil",            Ladder2017Season2, "BloodBoilLE", 2),
                             ^

./pysc2/maps/ladder.py:49:30: F821 undefined name 'Ladder2017Season1'
    ("CactusValley",         Ladder2017Season1, "CactusValleyLE", 4),
                             ^

./pysc2/maps/ladder.py:50:30: F821 undefined name 'Ladder2017Season2'
    ("DefendersLanding",     Ladder2017Season2, "DefendersLandingLE", 2),
                             ^

./pysc2/maps/ladder.py:51:30: F821 undefined name 'Ladder2017Season3'
    ("Frost",                Ladder2017Season3, "FrostLE", 2),
                             ^

./pysc2/maps/ladder.py:52:30: F821 undefined name 'Ladder2017Season1'
    ("Honorgrounds",         Ladder2017Season1, "HonorgroundsLE", 4),
                             ^

./pysc2/maps/ladder.py:53:30: F821 undefined name 'Ladder2017Season3'
    ("Interloper",           Ladder2017Season3, "InterloperLE", 2),
                             ^

./pysc2/maps/ladder.py:54:30: F821 undefined name 'Ladder2017Season3'
    ("MechDepot",            Ladder2017Season3, "MechDepotLE", 2),
                             ^

./pysc2/maps/ladder.py:55:30: F821 undefined name 'Ladder2017Season1'
    ("NewkirkPrecinct",      Ladder2017Season1, "NewkirkPrecinctTE", 2),
                             ^

./pysc2/maps/ladder.py:56:30: F821 undefined name 'Ladder2017Season3'
    ("Odyssey",              Ladder2017Season3, "OdysseyLE", 2),
                             ^

./pysc2/maps/ladder.py:57:30: F821 undefined name 'Ladder2017Season1'
    ("PaladinoTerminal",     Ladder2017Season1, "PaladinoTerminalLE", 2),
                             ^

./pysc2/maps/ladder.py:58:30: F821 undefined name 'Ladder2017Season2'
    ("ProximaStation",       Ladder2017Season2, "ProximaStationLE", 2),
                             ^

./pysc2/maps/ladder.py:59:30: F821 undefined name 'Ladder2017Season2'
    ("Sequencer",            Ladder2017Season2, "SequencerLE", 2),
                             ^

16    F821 undefined name 'Ladder2017Season3'

WebSocketTimeoutException (Bash on Windows)

I'm running Ubuntu 16.04 on Windows 10, Python 3.6.1 (Anaconda distribution). Everything seems to have installed fine (pysc2, maps), but when I run pysc2_agent --map Simple64 I get the following output and error. Do I need to have an X server or something set up for this to work? I assumed, even if no graphical output was on my screen, that it would be able to run a bot and save a reply of the match.

pysc2_agent --map Simple64
Version: B55958 (SC2.3.16)
Build: Jul 31 2017 13:19:41
Command Line: '"/home/neighthan/StarCraftII/Versions/Base55958/SC2_x64" -listen 127.0.0.1 -port 20058 -dataDir /home/neighthan/Star
CraftII/ -tempDir /tmp/sc-6h55h2cr/ -displayMode 0'
Starting up...
Startup Phase 1 complete
Startup Phase 2 complete
Creating stub renderer...
Listening on: 127.0.0.1:20058 (20058)
Startup Phase 3 complete. Ready for commands.
Requesting to join a single player game
Configuring interface options
Configure: raw interface enabled
Configure: feature layer interface enabled
Configure: score interface enabled
Configure: render interface disabled
Entering load game phase.
Launching next game.
Next launch phase started: 2
Next launch phase started: 3
Next launch phase started: 4
Next launch phase started: 5
Next launch phase started: 6
Next launch phase started: 7
Next launch phase started: 8
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/websocket/_socket.py", line 80, in recv
    bytes_ = sock.recv(bufsize)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/neighthan/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/neighthan/anaconda3/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/pysc2/bin/agent.py", line 74, in run_thread
    visualize=visualize) as env:
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/pysc2/env/sc2_env.py", line 178, in __init__
    self._controller.join_game(join)
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/pysc2/lib/remote_controller.py", line 80, in _valid_status
    return func(self, *args, **kwargs)
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/pysc2/lib/remote_controller.py", line 55, in _check_error
    return check_error(func(*args, **kwargs), error_enum)
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/pysc2/lib/stopwatch.py", line 197, in _stopwatch
    return func(*args, **kwargs)
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/pysc2/lib/remote_controller.py", line 120, in join_game
    return self._client.send(join_game=req_join_game)
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/pysc2/lib/protocol.py", line 127, in send
    res = self.send_req(sc_pb.Request(**kwargs))
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/pysc2/lib/protocol.py", line 113, in send_req
    return self.read()
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/pysc2/lib/stopwatch.py", line 197, in _stopwatch
    return func(*args, **kwargs)
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/pysc2/lib/protocol.py", line 86, in read
    response = self._read()
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/pysc2/lib/protocol.py", line 152, in _read
    response_str = self._sock.recv()
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/websocket/_core.py", line 293, in recv
    opcode, data = self.recv_data()
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/websocket/_core.py", line 310, in recv_data
    opcode, frame = self.recv_data_frame(control_frame)
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/websocket/_core.py", line 323, in recv_data_frame
    frame = self.recv_frame()
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/websocket/_core.py", line 357, in recv_frame
    return self.frame_buffer.recv_frame()
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/websocket/_abnf.py", line 340, in recv_frame
    self.recv_header()
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/websocket/_abnf.py", line 288, in recv_header
    header = self.recv_strict(2)
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/websocket/_abnf.py", line 375, in recv_strict
    bytes_ = self.recv(min(16384, shortage))
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/websocket/_core.py", line 427, in _recv
    return recv(self.sock, bufsize)
  File "/home/neighthan/anaconda3/lib/python3.6/site-packages/websocket/_socket.py", line 83, in recv
    raise WebSocketTimeoutException(message)
websocket._exceptions.WebSocketTimeoutException: timed out

WARNING:root:Terminating attempt 0...
WARNING:root:Terminated.

I also installed pysc2 and SC2 on Windows, and there things run fine (I do, of course, have the Linux SC2 installed as well). Ubuntu on Windows is probably a niche market, so if it's not entirely supported, I'll understand.

I wasn't sure where to ask this, especially as the project is so new, but if there's a Google group or such that would be better (as this is probably not an issue in pysc2 so much as a problem with my setup), please let me know.

pysc2.maps.lib.NoMapException: Map doesn't exist: <My-Mini-Game-Map> in Mac

I have already created My-Mini-Game-Map.sc2map and add it to Applications/StartCraft2/Maps/mini-games folder and also in /pysc2/maps/mini-games too.
When executing agent python3 -m pysc2.bin.agent --map the error is given by

Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/site-packages/pysc2/bin/agent.py", line 112, in
app.run(main)
File "/usr/local/lib/python3.6/site-packages/pysc2/lib/app.py", line 57, in run
really_start(main or sys.modules["main"].main)
File "/usr/local/lib/python3.6/site-packages/pysc2/lib/app.py", line 51, in really_start
sys.exit(main(argv))
File "/usr/local/lib/python3.6/site-packages/pysc2/bin/agent.py", line 87, in main
maps.get(FLAGS.map) # Assert the map exists.
File "/usr/local/lib/python3.6/site-packages/pysc2/maps/lib.py", line 136, in get
raise NoMapException("Map doesn't exist: %s" % map_name)
pysc2.maps.lib.NoMapException: Map doesn't exist:

I have tried
--with another sample of mini-games map given by default samples and works perfectly
-- Ask for map list by python3 -m pysc2.bin.map_list and does not appear

Do you know how can I solve this issue?
Wich step did I miss?

Thanks for this project !!

Correct Terminology Food vs Supply

In the feature panel, the word "food" is used to describe supply. This is confusing even for someone who routinely plays SC2, just use the correct terminology.

Expose more information in the renderer

There's a fair amount of information in the game that isn't yet exposed in the renderer:

  • build queue
  • transports
  • selection
  • friendly action names
  • control groups
  • maybe representing shields and energy

traceback error when trying to view valid actions

I was trying to get some output similar to what is described in environments.md and have been having some issues. I ran these in windows10 powershell, in case that helps. Do I need to add s2clientprotocol to path?

PS > python -m pysc2.bin.valid_actions
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda2\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\ProgramData\Anaconda2\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Users\HODOR\desktop\flisz\pysc2\pysc2\bin\valid_actions.py", line 21, in <module>
    from pysc2.lib import actions
  File "pysc2\lib\__init__.py", line 23, in <module>
    from pysc2.lib.actions import Arguments
  File "pysc2\lib\actions.py", line 26, in <module>
    from s2clientprotocol import spatial_pb2 as sc_spatial
ImportError: No module named s2clientprotocol

Missing Observations

Could we add some of the following details to the observations? These details are visible to a human player on the loading screen:

  1. The map (name, version, anything required to get a unique ID in case the maps change over time)
  2. Map spawn locations (although maybe this could be included in the map details in point 1)
  3. Each player's chosen race (T, V, Z, random) - not the actual race for random

Since a player's strategy will often depend on the map, the opponent's race and their location, all of these details would help a bot in the early game.

A more advanced bot may study the feature layers, but simpler bots could achieve a lot with less effort if these details were available.

"nextEventMatchingMask should only be called from the Main Thread!"

On Mac OS (Sierra, 10.12.5), on a MacBook Pro (15-inch, 2016)

python -m pysc2.bin.agent --map Simple64

Crashes with the following output:

NSWindowEdgeResizing is off!
2017-08-09 21:06:05.039 Python[2686:52867] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/xw/ch07jry12bn15s2bhs2wlvr40000gn/T/org.python.python.savedState
2017-08-09 21:06:05.648 Python[2686:52867] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff8de062cb __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00007fffa2c1148d objc_exception_throw + 48
    2   AppKit                              0x00007fff8bff2e82 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4480
    3   libSDL-1.2.0.dylib                  0x0000000107cb99dc QZ_PumpEvents + 358
    4   libSDL-1.2.0.dylib                  0x0000000107c99866 SDL_PumpEvents + 35
    5   libSDL-1.2.0.dylib                  0x0000000107c99a44 SDL_EventState + 197
    6   libSDL-1.2.0.dylib                  0x0000000107cb82dd SDL_JoystickEventState + 41
    7   joystick.so                         0x0000000107f51db2 joy_autoinit + 50
    8   Python                              0x000000010629a921 PyObject_Call + 99
    9   Python                              0x000000010631de37 PyEval_CallObjectWithKeywords + 165
    10  base.so                             0x0000000107c89c6c init + 268
    11  Python                              0x000000010631a884 PyEval_EvalFrameEx + 26960
    12  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    13  Python                              0x00000001062b8c73 function_call + 350
    14  Python                              0x000000010629a921 PyObject_Call + 99
    15  Python                              0x000000010631aed8 PyEval_EvalFrameEx + 28580
    16  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    17  Python                              0x00000001062b8c73 function_call + 350
    18  Python                              0x000000010629a921 PyObject_Call + 99
    19  Python                              0x000000010631aed8 PyEval_EvalFrameEx + 28580
    20  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    21  Python                              0x000000010631e45e fast_function + 117
    22  Python                              0x000000010631a78f PyEval_EvalFrameEx + 26715
    23  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    24  Python                              0x000000010631e45e fast_function + 117
    25  Python                              0x000000010631a78f PyEval_EvalFrameEx + 26715
    26  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    27  Python                              0x00000001062b8c73 function_call + 350
    28  Python                              0x000000010629a921 PyObject_Call + 99
    29  Python                              0x00000001062a5685 instancemethod_call + 173
    30  Python                              0x000000010629a921 PyObject_Call + 99
    31  Python                              0x00000001062e1d50 slot_tp_init + 64
    32  Python                              0x00000001062defb9 type_call + 182
    33  Python                              0x000000010629a921 PyObject_Call + 99
    34  Python                              0x000000010631a6bc PyEval_EvalFrameEx + 26504
    35  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    36  Python                              0x00000001062b8c73 function_call + 350
    37  Python                              0x000000010629a921 PyObject_Call + 99
    38  Python                              0x000000010631aed8 PyEval_EvalFrameEx + 28580
    39  Python                              0x000000010631e4f1 fast_function + 264
    40  Python                              0x000000010631a78f PyEval_EvalFrameEx + 26715
    41  Python                              0x000000010631e4f1 fast_function + 264
    42  Python                              0x000000010631a78f PyEval_EvalFrameEx + 26715
    43  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    44  Python                              0x00000001062b8c73 function_call + 350
    45  Python                              0x000000010629a921 PyObject_Call + 99
    46  Python                              0x00000001062a5685 instancemethod_call + 173
    47  Python                              0x000000010629a921 PyObject_Call + 99
    48  Python                              0x000000010631de37 PyEval_CallObjectWithKeywords + 165
    49  Python                              0x000000010634a63a t_bootstrap + 70
    50  libsystem_pthread.dylib             0x00007fffa370f93b _pthread_body + 180
    51  libsystem_pthread.dylib             0x00007fffa370f887 _pthread_body + 0
    52  libsystem_pthread.dylib             0x00007fffa370f08d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[1]    2686 abort      python -m pysc2.bin.agent --map Simple64

Difference btwn Attack_screen and Attack_Attack_screen?

Firstly, I really appreciate that you opened this great API to us.
By the way, I found very similar actions while their ids are different -
Attack_screen (12) and Attack_Attack_screen (14).
Similarly, there are also Attack_minimap (13) and Attack_Attack_minimap (15)

I wonder what is different between those.
Thank you.

Examples Request

Hi!
Would you please give us some examples on how to train an agent in mini-games or other games?
Such as an actor-critic agent using tensorflow?
Thank you very much in advance!

Observation feature for unit list.

  1. Is there a plan for unit list observation feature?

I could find the list of units in raw API data from StarCraft II.
env._obs.observation.raw_data.units
2017-09-03 9 30 13

But I can not find the unit list in observation space.

  1. How can I retrieve unit_id for 'select_unit_id' action?

select_unit_id=ArgumentType.scalar(500),

I could not find unit_id from raw_data from StarCraft II
env._obs.observation.raw_data.units

Thanks!

replay_actions isn't generic and doesn't do what you'd expect

Hi,
I used a Ubuntu16.06 and installed the game successfully. All the functions work well except for running python -m pysc2.bin.replay_actions --replays='/home/hxu/StarCraftII/Replays/Replays/f57ab36fd55aad2bf3b24645fe37c16824f4af1eb6a08654be43381a8ed2eef0.SC2Replay'.
Here is what I've got. There are partial stats but not sequential events or state-action pairs.

Getting replay list: /home/hxu/StarCraftII/Replays/Replays/f57ab36fd55aad2bf3b24645fe37c16824f4af1eb6a08654be43381a8ed2eef0.SC2Repl
ay
1 replays found.

[0] Starting up a new SC2 instance.
Version: B55958 (SC2.3.16)
Build: Jul 31 2017 13:19:41
Command Line: '"/home/hxu/StarCraftII/Versions/Base55958/SC2_x64" -listen 127.0.0.1 -port 21645 -dataDir /home/hxu/StarCraftII/ -te
mpDir /tmp/sc-5QgJ1W/ -displayMode 0'
Starting up...
Startup Phase 1 complete
Startup Phase 2 complete
Creating stub renderer...
Listening on: 127.0.0.1:21645 (21645)
Startup Phase 3 complete. Ready for commands.
[0] SC2 Started successfully.
[0] Got replay: /home/hxu/StarCraftII/Replays/Replays/f57ab36fd55aad2bf3b24645fe37c16824f4af1eb6a08654be43381a8ed2eef0.SC2Replay
[0] ------------------ Replay Info f57ab36fd5 ------------------
[0] map_name: "Catallena LE (Void)"
[0] player_info {
[0] player_info {
[0] player_id: 1
[0] race_requested: Terran
[0] race_actual: Terran [38/1813]
[0] }
[0] player_result {
[0] player_id: 1
[0] result: Defeat
[0] }
[0] player_mmr: 3437
[0] player_apm: 83
[0] }
[0] player_info {
[0] player_info {
[0] player_id: 2
[0] race_requested: Zerg
[0] race_actual: Zerg
[0] }
[0] player_result {
[0] player_id: 2
[0] result: Victory
[0] }
[0] player_mmr: 3381
[0] player_apm: 107
[0] }
[0] game_duration_loops: 23529
[0] game_duration_seconds: 1050.47509766
[0] game_version: "3.16.1.55958"
[0] data_build: 55958
[0] base_build: 55958
[0] data_version: "5BD7C31B44525DAB46E64C4602A81DC2"
[0] ------------------------------------------------------------
[0] Starting f57ab36fd5 from player 1's perspective
============================================= Summary 10 secs =============================================
Replays: 0, Steps total: 0

Camera move: 0, Select pt: 0, Select rect: 0, Control group: 0

Maps: 1
{Catallena LE (Void): 1}

Races: 2
{Zerg: 1, Terran: 1}

Unit ids: 0
{}

Valid abilities: 0
{}

Made abilities: 0
{}

Valid actions: 0
{}

Made actions: 0
{}
Races: 2
{Zerg: 1, Terran: 1}

Unit ids: 0
{}

Valid abilities: 0
{}

Made abilities: 0
{}

Valid actions: 0
{}

Made actions: 0
{}

Crashing replays: 0
[]

Invalid replays: 0
[]
---------------------------------------------- Process stats ----------------------------------------------
[ 0] replay: f57ab36fd5, replays: 0, steps: 0, game loops: 0, last: start_replay, 0 s ago

Properly Implementing AC3 Algorithm

This may be a naive question, but in the process of implementing my RL bot using AC3, I had to place many of my changes into the environment files such as run_loop.py. Using this method, I was able to control when calls to .step() occurred. Is this the proper method for implementing non-scripted bots?

Remove Starcraft Fatal Error after run Mac

After each agent run, there is a "Unexpected Fatal Error" warning to send feedback to Blizzard. I do not think they will be interested in these errors. Is there anyway to disable them or will this need to be on the starcraft api side?

screen shot 2017-08-13 at 10 32 55 pm

How to slow down?

When I run an agent, the frame speed of the game is too fast. Would you please tell us where to modify the parameter of game speed?

Feature Request: List of individual unit details as features

Hi,

I've noticed that all the features that are provided are provided as images (or spatially based). I can see why this is probably the best default set of features, however, I've had good results in the past using raw object features (i.e. a list of object feature vectors) and using a permutation invariant network (basically 1x1 convolutions and pooling) to convert the list into a single vector. I can also see this being useful for people who want to write other kinds of AI (e.g. GOFAI).

To clarify, the feature set would be a list of visible units, where each unit is represented by some feature vector e.g. one hot of class concatenated with health, position co-ordinates, etc. This could be broken down into separate lists for different classes, or all included in one big list.

EDIT: I realise this is possible using the client API, but it might be nice to make this information available under the same interface for comparing/combining the two different types.

'SDL.h' file not found on Mac

python anaconda 3.5
mac os 10.12.5
When install pysc2 by pip install pysc2, get this error.

    running build_ext
    building 'pygame.scrap' extension
    creating build/temp.macosx-10.6-x86_64-3.5
    creating build/temp.macosx-10.6-x86_64-3.5/src
    /usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/wzy/anaconda/include -arch x86_64 -DENABLE_NEWBUF=1 -I/NEED_INC_PATH_FIX -I/Users/wzy/anaconda/include/python3.5m -c src/scrap.c -o build/temp.macosx-10.6-x86_64-3.5/src/scrap.o
    src/scrap.c:27:10: fatal error: 'SDL.h' file not found
    #include "SDL.h"
             ^
    1 error generated.
    error: command '/usr/bin/clang' failed with exit status 1

Failed to open the map archive:

After I run the command
'python -m pysc2.bin.play --replay 0a0acb390e984a69e57406bc40a57e910b6bf8e352cbfa93f5ee7be6acca5e70.SC2Replay'
to play a replay downloaded from the replay packs 3.16.1 - Pack 1, I receive this error:

pysc2.lib.remote_controller.RequestError: SC2APIProtocol.ResponseReplayInfo.Error.ParsingError: 'Possible corruption - Failed to open the map archive: /Users/Shared/Blizzard/Battle.net\Cache/fd/88/fd8898dbe586fa967760980debcad0ce20610fb447cd0697c109d4ebf7d1d5cf.s2ma'

However, I check the Cache folder, the required file is there.

Thanks!

`ValueError: width greater than radius' when Mothership Core is killed

Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/py/PycharmProjects/pysc2/pysc2/lib/renderer_human.py", line 878, in render_thread
    self.render_obs(obs)
  File "/home/py/PycharmProjects/pysc2/pysc2/lib/renderer_human.py", line 56, in _with_lock
    return func(*args, **kwargs)
  File "/home/py/PycharmProjects/pysc2/pysc2/lib/stopwatch.py", line 197, in _stopwatch
    return func(*args, **kwargs)
  File "/home/py/PycharmProjects/pysc2/pysc2/lib/renderer_human.py", line 894, in render_obs
    surf.draw(surf)
  File "/home/py/PycharmProjects/pysc2/pysc2/lib/renderer_human.py", line 840, in draw_screen
    self.draw_units(surf)
  File "/home/py/PycharmProjects/pysc2/pysc2/lib/stopwatch.py", line 197, in _stopwatch
    return func(*args, **kwargs)
  File "/home/py/PycharmProjects/pysc2/pysc2/lib/renderer_human.py", line 635, in draw_units
    surf.draw_circle(colors.green, p, u.radius + 0.05, 1)
  File "/home/py/PycharmProjects/pysc2/pysc2/lib/renderer_human.py", line 110, in draw_circle
    thickness)
ValueError: width greater than radius

As I play as human, this error happens every time when protoss mothership core is killed.
What's wrong?

unable to run the game: ValueError: Source and destination surfaces need the same format.

when i use python -m pysc2.bin.play --map Simple64 command, the error message of
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/ray_enough/.local/lib/python2.7/site-packages/pysc2/lib/renderer_human.py", line 878, in render_thread
self.render_obs(obs)
File "/home/ray_enough/.local/lib/python2.7/site-packages/pysc2/lib/renderer_human.py", line 56, in _with_lock
return func(*args, **kwargs)
File "/home/ray_enough/.local/lib/python2.7/site-packages/pysc2/lib/stopwatch.py", line 197, in _stopwatch
return func(*args, **kwargs)
File "/home/ray_enough/.local/lib/python2.7/site-packages/pysc2/lib/renderer_human.py", line 894, in render_obs
surf.draw(surf)
File "/home/ray_enough/.local/lib/python2.7/site-packages/pysc2/lib/renderer_human.py", line 839, in draw_screen
self.draw_base_map(surf)
File "/home/ray_enough/.local/lib/python2.7/site-packages/pysc2/lib/stopwatch.py", line 197, in _stopwatch
return func(*args, **kwargs)
File "/home/ray_enough/.local/lib/python2.7/site-packages/pysc2/lib/renderer_human.py", line 775, in draw_base_map
surf.blit_np_array(out)
File "/home/ray_enough/.local/lib/python2.7/site-packages/pysc2/lib/renderer_human.py", line 124, in blit_np_array
pygame.transform.scale(raw_surface, self.surf.get_size(), self.surf)
ValueError: Source and destination surfaces need the same format.

just error in CollectMineralShards

I can run other map just CollectMineralShards have problem. run agent and play is ok for other map.

but when I use CollectMineralShards, the window show the load, when load over, than cask:
python -m pysc2.bin.agent --map CollectMineralShards
NSWindowEdgeResizing is off!
Traceback (most recent call last):
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/protocol.py", line 61, in catch_websocket_connection_errors
yield
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/protocol.py", line 152, in _read
response_str = self._sock.recv()
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/websocket/_core.py", line 293, in recv
opcode, data = self.recv_data()
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/websocket/_core.py", line 310, in recv_data
opcode, frame = self.recv_data_frame(control_frame)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/websocket/_core.py", line 323, in recv_data_frame
frame = self.recv_frame()
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/websocket/_core.py", line 357, in recv_frame
return self.frame_buffer.recv_frame()
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/websocket/_abnf.py", line 340, in recv_frame
self.recv_header()
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/websocket/_abnf.py", line 288, in recv_header
header = self.recv_strict(2)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/websocket/abnf.py", line 375, in recv_strict
bytes
= self.recv(min(16384, shortage))
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/websocket/_core.py", line 427, in _recv
return recv(self.sock, bufsize)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/websocket/_socket.py", line 93, in recv
"Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"main", mod_spec)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/bin/agent.py", line 112, in
app.run(main)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/app.py", line 57, in run
really_start(main or sys.modules["main"].main)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/app.py", line 51, in really_start
sys.exit(main(argv))
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/bin/agent.py", line 98, in main
run_thread(agent_cls, FLAGS.map, FLAGS.render)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/bin/agent.py", line 74, in run_thread
visualize=visualize) as env:
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/env/sc2_env.py", line 180, in init
static_data = self._controller.data()
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/remote_controller.py", line 151, in data
return static_data.StaticData(self.data_raw())
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/remote_controller.py", line 80, in _valid_status
return func(self, *args, **kwargs)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/stopwatch.py", line 197, in _stopwatch
return func(*args, **kwargs)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/remote_controller.py", line 147, in data_raw
ability_id=True, unit_type_id=True))
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/protocol.py", line 127, in send
res = self.send_req(sc_pb.Request(**kwargs))
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/protocol.py", line 113, in send_req
return self.read()
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/stopwatch.py", line 197, in _stopwatch
return func(*args, **kwargs)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/protocol.py", line 86, in read
response = self._read()
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/protocol.py", line 152, in _read
response_str = self._sock.recv()
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/contextlib.py", line 77, in exit
self.gen.throw(type, value, traceback)
File "/Users/codeMan/anaconda3/envs/keras/lib/python3.5/site-packages/pysc2/lib/protocol.py", line 63, in catch_websocket_connection_errors
raise ConnectionError("Connection already closed. SC2 probably crashed. "
pysc2.lib.protocol.ConnectionError: Connection already closed. SC2 probably crashed. Check the error log.

[Help] - Installing

i'm not sure what i'm doing wrong i'm starting with Phyton/SC2 Deep learning now. I have any idea how it works because i know #C but i'm getting this error while trying to run something.

C:\Users\Mateus Cordova\Desktop\SC2-DEEPMIND\pysc2-master>python -m pysc2.bin.map_list
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "C:\Python27\lib\runpy.py", line 102, in get_module_details
loader = get_loader(mod_name)
File "C:\Python27\lib\pkgutil.py", line 464, in get_loader
return find_loader(fullname)
File "C:\Python27\lib\pkgutil.py", line 474, in find_loader
for importer in iter_importers(fullname):
File "C:\Python27\lib\pkgutil.py", line 430, in iter_importers
import(pkg)
File "pysc2_init
.py", line 14
python -m pysc2.bin.map_list.py
^
SyntaxError: invalid syntax

Some one could help me ?

Where could I download Battle.net Cache?

I downloaded 3.16.1 - Pack 1.zip and unzip it, but only found replay files. Where could I download all the maps from Battle.net Cache used for replays? Thank you !

Mac: libc++abi.dylib: terminating with uncaught exception of type NSException

The SC2 window starts, but no actions are taken and the console gives an error (both on Python2 and Python3). However, the game and the API run fine if I start it with pysc2.bin.play.

python2 -m pysc2.bin.agent --map CollectMineralShards --agent pysc2.agents.scripted_agent.CollectMineralShards
NSWindowEdgeResizing is off!
2017-08-12 18:46:22.857 Python[30716:671361] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
*** First throw call stack:
(
0 CoreFoundation 0x00007fffd3a9c2cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fffe88ac48d objc_exception_throw + 48
2 AppKit 0x00007fffd1c87e82 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4480
3 libSDL-1.2.0.dylib 0x00000001113539dc QZ_PumpEvents + 358
4 libSDL-1.2.0.dylib 0x0000000111333866 SDL_PumpEvents + 35
5 libSDL-1.2.0.dylib 0x0000000111333a44 SDL_EventState + 197
6 libSDL-1.2.0.dylib 0x00000001113522dd SDL_JoystickEventState + 41
7 joystick.so 0x00000001115ebdb2 joy_autoinit + 50
8 Python 0x000000010f8c04a1 PyObject_Call + 98
9 Python 0x000000010f942ea8 PyEval_CallObjectWithKeywords + 166
10 base.so 0x0000000111323c6c init + 268
11 Python 0x000000010f93d651 PyEval_EvalFrameEx + 9961
12 Python 0x000000010f93ad73 PyEval_EvalCodeEx + 1621
13 Python 0x000000010f8de9e3 function_call + 330
14 Python 0x000000010f8c04a1 PyObject_Call + 98
15 Python 0x000000010f93fc9a PyEval_EvalFrameEx + 19762
16 Python 0x000000010f93ad73 PyEval_EvalCodeEx + 1621
17 Python 0x000000010f8de9e3 function_call + 330
18 Python 0x000000010f8c04a1 PyObject_Call + 98
19 Python 0x000000010f93fc9a PyEval_EvalFrameEx + 19762
20 Python 0x000000010f93ad73 PyEval_EvalCodeEx + 1621
21 Python 0x000000010f943581 fast_function + 298
22 Python 0x000000010f93d54b PyEval_EvalFrameEx + 9699
23 Python 0x000000010f93ad73 PyEval_EvalCodeEx + 1621
24 Python 0x000000010f943581 fast_function + 298
25 Python 0x000000010f93d54b PyEval_EvalFrameEx + 9699
26 Python 0x000000010f93ad73 PyEval_EvalCodeEx + 1621
27 Python 0x000000010f8de9e3 function_call + 330
28 Python 0x000000010f8c04a1 PyObject_Call + 98
29 Python 0x000000010f8cb03a instancemethod_call + 162
30 Python 0x000000010f8c04a1 PyObject_Call + 98
31 Python 0x000000010f9084e5 slot_tp_init + 68
32 Python 0x000000010f905558 type_call + 182
33 Python 0x000000010f8c04a1 PyObject_Call + 98
34 Python 0x000000010f93d604 PyEval_EvalFrameEx + 9884
35 Python 0x000000010f93ad73 PyEval_EvalCodeEx + 1621
36 Python 0x000000010f8de9e3 function_call + 330
37 Python 0x000000010f8c04a1 PyObject_Call + 98
38 Python 0x000000010f93fc9a PyEval_EvalFrameEx + 19762
39 Python 0x000000010f94351c fast_function + 197
40 Python 0x000000010f93d54b PyEval_EvalFrameEx + 9699
41 Python 0x000000010f94351c fast_function + 197
42 Python 0x000000010f93d54b PyEval_EvalFrameEx + 9699
43 Python 0x000000010f93ad73 PyEval_EvalCodeEx + 1621
44 Python 0x000000010f8de9e3 function_call + 330
45 Python 0x000000010f8c04a1 PyObject_Call + 98
46 Python 0x000000010f8cb03a instancemethod_call + 162
47 Python 0x000000010f8c04a1 PyObject_Call + 98
48 Python 0x000000010f942ea8 PyEval_CallObjectWithKeywords + 166
49 Python 0x000000010f96fc2c t_bootstrap + 70
50 libsystem_pthread.dylib 0x00007fffe93ab93b _pthread_body + 180
51 libsystem_pthread.dylib 0x00007fffe93ab887 _pthread_body + 0
52 libsystem_pthread.dylib 0x00007fffe93ab08d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

Edit existing and add new mini-maps

It would be appreciated if we could also get a small guide on how to edit the existing or create new mini-maps for training purposes. I have searched a lot but still can't figure out how to edit or create .sc2map files; the Star Craft map editor can only read/create .scm and .scx files.

Unable to start agent

System: MacOS 10.12.6
Game client downloaded from here: http://link.zhihu.com/?target=https%3A//www.battlenet.com.cn/account/download/
Python Version: 3.6.1

Error:

MacBook-Pro-4:~ haonanchen$ python -m pysc2.bin.agent --map Simple64
NSWindowEdgeResizing is off!
2017-08-14 18:11:54.310 python[15559:260057] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fffc51102cb __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffd9f2048d objc_exception_throw + 48
	2   AppKit                              0x00007fffc32fbe82 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4480
	3   libSDL-1.2.0.dylib                  0x0000000102caa9dc QZ_PumpEvents + 358
	4   libSDL-1.2.0.dylib                  0x0000000102c8a866 SDL_PumpEvents + 35
	5   libSDL-1.2.0.dylib                  0x0000000102c8aa44 SDL_EventState + 197
	6   libSDL-1.2.0.dylib                  0x0000000102ca92dd SDL_JoystickEventState + 41
	7   joystick.cpython-36m-darwin.so      0x0000000103084422 joy_autoinit + 50
	8   python                              0x0000000100ca645e _PyCFunction_FastCallDict + 526
	9   python                              0x0000000100c5dff0 _PyObject_FastCallDict + 368
	10  base.cpython-36m-darwin.so          0x0000000102c7acac init + 268
	11  python                              0x0000000100ca645e _PyCFunction_FastCallDict + 526
	12  python                              0x0000000100d2e1be call_function + 478
	13  python                              0x0000000100d2b5f8 _PyEval_EvalFrameDefault + 23560
	14  python                              0x0000000100d2ecf1 _PyEval_EvalCodeWithName + 2657
	15  python                              0x0000000100d259a0 PyEval_EvalCodeEx + 48
	16  python                              0x0000000100c85649 function_call + 345
	17  python                              0x0000000100c5dd35 PyObject_Call + 101
	18  python                              0x0000000100d2b8e6 _PyEval_EvalFrameDefault + 24310
	19  python                              0x0000000100d2ecf1 _PyEval_EvalCodeWithName + 2657
	20  python                              0x0000000100d259a0 PyEval_EvalCodeEx + 48
	21  python                              0x0000000100c85649 function_call + 345
	22  python                              0x0000000100c5dd35 PyObject_Call + 101
	23  python                              0x0000000100d2b8e6 _PyEval_EvalFrameDefault + 24310
	24  python                              0x0000000100d2ecf1 _PyEval_EvalCodeWithName + 2657
	25  python                              0x0000000100d2f4dc fast_function + 732
	26  python                              0x0000000100d2e199 call_function + 441
	27  python                              0x0000000100d2b5f8 _PyEval_EvalFrameDefault + 23560
	28  python                              0x0000000100d2f43e fast_function + 574
	29  python                              0x0000000100d2e199 call_function + 441
	30  python                              0x0000000100d2b5f8 _PyEval_EvalFrameDefault + 23560
	31  python                              0x0000000100d2ecf1 _PyEval_EvalCodeWithName + 2657
	32  python                              0x0000000100d2f785 _PyFunction_FastCallDict + 661
	33  python                              0x0000000100c5dfda _PyObject_FastCallDict + 346
	34  python                              0x0000000100c5e10c _PyObject_Call_Prepend + 156
	35  python                              0x0000000100c5dd35 PyObject_Call + 101
	36  python                              0x0000000100cbe45e slot_tp_init + 158
	37  python                              0x0000000100cba749 type_call + 313
	38  python                              0x0000000100c5dfa4 _PyObject_FastCallDict + 292
	39  python                              0x0000000100c5e3d5 _PyObject_FastCallKeywords + 197
	40  python                              0x0000000100d2e192 call_function + 434
	41  python                              0x0000000100d2b692 _PyEval_EvalFrameDefault + 23714
	42  python                              0x0000000100d2ecf1 _PyEval_EvalCodeWithName + 2657
	43  python                              0x0000000100d259a0 PyEval_EvalCodeEx + 48
	44  python                              0x0000000100c85649 function_call + 345
	45  python                              0x0000000100c5dd35 PyObject_Call + 101
	46  python                              0x0000000100d2b8e6 _PyEval_EvalFrameDefault + 24310
	47  python                              0x0000000100d2f43e fast_function + 574
	48  python                              0x0000000100d2e199 call_function + 441
	49  python                              0x0000000100d2b5f8 _PyEval_EvalFrameDefault + 23560
	50  python                              0x0000000100d2f43e fast_function + 574
	51  python                              0x0000000100d2e199 call_function + 441
	52  python                              0x0000000100d2b5f8 _PyEval_EvalFrameDefault + 23560
	53  python                              0x0000000100d2f87c _PyFunction_FastCallDict + 908
	54  python                              0x0000000100c5dfda _PyObject_FastCallDict + 346
	55  python                              0x0000000100c5e10c _PyObject_Call_Prepend + 156
	56  python                              0x0000000100c5dd35 PyObject_Call + 101
	57  python                              0x0000000100d75556 t_bootstrap + 70
	58  libsystem_pthread.dylib             0x00007fffdaa1f93b _pthread_body + 180
	59  libsystem_pthread.dylib             0x00007fffdaa1f887 _pthread_body + 0
	60  libsystem_pthread.dylib             0x00007fffdaa1f08d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

The Starcraft game is run and the small window of the game is present, but agent window is not present.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.