GithubHelp home page GithubHelp logo

alibaba / gym-starcraft Goto Github PK

View Code? Open in Web Editor NEW
527.0 77.0 135.0 84 KB

StarCraft environment for OpenAI Gym, based on Facebook's TorchCraft. (In progress)

Python 100.00%
openai-gym gym-starcraft starcraft reinforcement-learning artificial-intelligence deep-learning

gym-starcraft's Introduction

gym-starcraft

Gym StarCraft is an environment bundle for OpenAI Gym. It is based on Facebook's TorchCraft, which is a bridge between Torch and StarCraft for AI research.

Installation

  1. Install OpenAI Gym and its dependencies.

  2. Install TorchCraft and its dependencies. You can skip the torch client part.

  3. Install torchcraft-py and its dependencies.

  4. Install the package itself:

    git clone https://github.com/deepcraft/gym-starcraft.git
    cd gym-starcraft
    pip install -e .
    

Usage

  1. Start StarCraft server with BWAPI by Chaoslauncher.

  2. Run examples:

    cd examples
    python random_agent.py --ip $server_ip --port $server_port 
    

    The $server_ip and $server_port are the ip and port of the server running StarCraft.

gym-starcraft's People

Contributors

tangzk 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

gym-starcraft's Issues

How to extract state info

In this paper the author extract the state for each unit as a tensor 72 * 72 * 16, 72*72 represent the map size, each channel in the space describes either the hit points, the damage or the safety attacking range for all the agents on the map, How can I extract this info from self.state?

The iteration in the SINGLE BATTLE ENV

I have questions about the 40-45 lines in single_battle_env.py.

        for uid, ut in self.state['units_myself'].iteritems():
            myself_id = uid
            myself = ut
        for uid, ut in self.state['units_enemy'].iteritems():
            enemy_id = uid
            enemy = ut

What does the iteration mean?
Does single battle env mean that it only concern one unit combats with one enemy?

AttributeError: 'Box' object has no attribute 'n'

from baselines import deepq
env = sc.SingleBattleEnv(args.ip, args.port)
act = deepq.learn(
env,
q_func=model,
lr=1e-3,
max_timesteps=100000,
buffer_size=50000,
exploration_fraction=0.1,
exploration_final_eps=0.02,
print_freq=10
)
error happen.
num_actions=env.action_space.n,
AttributeError: 'Box' object has no attribute 'n'
How do I solve it?

The truth value of an array with more than one element is ambiguous.

When running the example, I came across an error:
"""
Traceback (most recent call last):
File "random_agent.py", line 30, in
obs, reward, done, info = env.step(action)
File "/Library/Python/2.7/site-packages/gym/core.py", line 122, in step
observation, reward, done, info = self._step(action)
File "/Users/sk/Projects/gym-starcraft/gym_starcraft/envs/starcraft_env.py", line 36, in _step
self.client.send(self._make_commands(action))
File "/Users/sk/Projects/gym-starcraft/gym_starcraft/envs/single_battle_env.py", line 33, in _make_commands
if self.state is None or not action:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
"""
It seems there is a problem with the gym environment and the starcraft, but I can't solve it.
I would appreciate it if someone could help me.

Restart protocol not working

Environment:

  • BWAPI: 4.1.2
  • Torchcraft 1.0.2

I use SingleBattleEnv as my environment, and hard code env._reset() when it reach max_steps. like:

if steps >  max_steps:
    env._reset()

But, the restart protocol doesn't work! The game still running.

Crashing immediately after launching an example

Include BWAPI error log:
//////////////////////////////////////////////////
TIME: Thu Apr 06 20:29:41 2017

VERSION: 1.16.1.1
BWAPI:
REVISION: 4708
BUILD: RELEASE
ERROR: None
LOCATION: Single Player
MAP: marines_1v1
m5v5_c_far.scm

EXCEPTION: 0xC0000005 EXCEPTION_ACCESS_VIOLATION
FAULT: 0x6BD44F78 czmq.dll
REGISTERS:
EDI: 049D5F30
ESI: 00000000
EBX: 00000000
EDX: 00000000
ECX: 00000000
EAX: 00000000
EBP: 0019F928
EIP: 6BD44F78
ESP: 0019F928
STACK:
czmq.dll 0x6BD44F78 zsock_is
czmq.dll 0x6BD455D0 zsock_resolve
czmq.dll 0x6BD419E6 zmsg_send
czmq.dll 0x6BD4643E zsock_vsend
czmq.dll 0x6BD45642 zsock_send
BWEnv.dll 0x5A876713 newAIModule
BWEnv.dll 0x5A8632F0 ----
BWEnv.dll 0x5A868A48 newAIModule
BWAPI.dll 0x1003471E ----
BWAPI.dll 0x1003496A ----
BWAPI.dll 0x10041BC9 ----
BWAPI.dll 0x100345E7 ----

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.