Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deepq_mineral_shards.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from pysc2.lib import features
from pysc2.lib import actions

import gflags as flags
from absl import flags

_PLAYER_RELATIVE = features.SCREEN_FEATURES.player_relative.index
_PLAYER_FRIENDLY = 1
Expand Down
2 changes: 1 addition & 1 deletion defeat_zerglings/dqfd.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from defeat_zerglings import common

import gflags as flags
from absl import flags

_PLAYER_RELATIVE = features.SCREEN_FEATURES.player_relative.index

Expand Down
9 changes: 7 additions & 2 deletions defeat_zerglings/run_demo_agent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

import gflags as flags
from absl import flags
from baselines import deepq
from pysc2.env import sc2_env
from pysc2.lib import actions
Expand All @@ -22,9 +22,14 @@
def main():
FLAGS(sys.argv)
with sc2_env.SC2Env(
"DefeatZerglingsAndBanelings",
map_name="DefeatZerglingsAndBanelings",
step_mul=step_mul,
visualize=True,
players=[sc2_env.Agent(sc2_env.Race.terran)],
agent_interface_format=sc2_env.AgentInterfaceFormat(
feature_dimensions=sc2_env.Dimensions(
screen=64,
minimap=64)),
game_steps_per_episode=steps * step_mul) as env:

demo_replay = []
Expand Down
9 changes: 7 additions & 2 deletions defeat_zerglings/train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

import gflags as flags
from absl import flags
from baselines import deepq
from pysc2.env import sc2_env
from pysc2.lib import actions
Expand All @@ -20,9 +20,14 @@
def main():
FLAGS(sys.argv)
with sc2_env.SC2Env(
"DefeatZerglingsAndBanelings",
map_name="DefeatZerglingsAndBanelings",
step_mul=step_mul,
visualize=True,
players=[sc2_env.Agent(sc2_env.Race.terran)],
agent_interface_format=sc2_env.AgentInterfaceFormat(
feature_dimensions=sc2_env.Dimensions(
screen=64,
minimap=64)),
game_steps_per_episode=steps * step_mul) as env:

model = deepq.models.cnn_to_mlp(
Expand Down
9 changes: 7 additions & 2 deletions enjoy_mineral_shards.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys

import baselines.common.tf_util as U
import gflags as flags
from absl import flags
import numpy as np
from baselines import deepq
from pysc2.env import environment
Expand Down Expand Up @@ -31,9 +31,14 @@
def main():
FLAGS(sys.argv)
with sc2_env.SC2Env(
"CollectMineralShards",
map_name="CollectMineralShards",
step_mul=step_mul,
visualize=True,
players=[sc2_env.Agent(sc2_env.Race.terran)],
agent_interface_format=sc2_env.AgentInterfaceFormat(
feature_dimensions=sc2_env.Dimensions(
screen=64,
minimap=64)),
game_steps_per_episode=steps * step_mul) as env:

model = deepq.models.cnn_to_mlp(
Expand Down
9 changes: 7 additions & 2 deletions tests/scripted_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pysc2.lib import features

from pysc2.lib import basetest
import gflags as flags
from absl import flags
import sys

_NO_OP = sc2_actions.FUNCTIONS.no_op.id
Expand All @@ -28,9 +28,14 @@ def test_defeat_zerglings(self):
FLAGS(sys.argv)

with sc2_env.SC2Env(
"DefeatZerglingsAndBanelings",
map_name="DefeatZerglingsAndBanelings",
step_mul=self.step_mul,
visualize=True,
players=[sc2_env.Agent(sc2_env.Race.terran)],
agent_interface_format=sc2_env.AgentInterfaceFormat(
feature_dimensions=sc2_env.Dimensions(
screen=64,
minimap=64)),
game_steps_per_episode=self.steps * self.step_mul) as env:
obs = env.step(actions=[sc2_actions.FunctionCall(_NO_OP, [])])
player_relative = obs[0].observation["screen"][_PLAYER_RELATIVE]
Expand Down
9 changes: 7 additions & 2 deletions train_mineral_shards.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

import gflags as flags
from absl import flags
from baselines import deepq
from pysc2.env import sc2_env
from pysc2.lib import actions
Expand All @@ -19,8 +19,13 @@
def main():
FLAGS(sys.argv)
with sc2_env.SC2Env(
"CollectMineralShards",
map_name="CollectMineralShards",
step_mul=step_mul,
players=[sc2_env.Agent(sc2_env.Race.terran)],
agent_interface_format=sc2_env.AgentInterfaceFormat(
feature_dimensions=sc2_env.Dimensions(
screen=64,
minimap=64)),
visualize=True) as env:

model = deepq.models.cnn_to_mlp(
Expand Down