'Path to the directory in which to save the collected data.') flags.DEFINE_bool( 'clear', False, 'Whether to clear output directories before generating results.') flags.DEFINE_integer( 'video_eps', 0, 'Num. episodes for which to save videos of the screen, original and reconstructed SC2 frames.' ) flags.DEFINE_float('fps', 22.5, 'The frames per second ratio used to save the videos.') flags.DEFINE_integer( 'crf', 18, 'Video constant rate factor: the default quality setting in `[0, 51]`') point_flag.DEFINE_point('window_size', '1024,768', 'SC2 window size.') flags.DEFINE_bool( 'hide_hud', True, 'Whether to hide the HUD / information panel at the bottom of the screen.') flags.mark_flags_as_required( ['replays', 'experiment', 'env', 'vae_model', 'pe_model']) RWD_DIM = 1 def process_replay(args, file, vae_model, session): logging.info('Replaying {}...'.format(file)) # create environment env = SC2Environment(file,
import threading from absl import app from absl import flags from future.builtins import range # pylint: disable=redefined-builtin from pysc2 import maps from pysc2.env import available_actions_printer from pysc2.env import run_loop from pysc2.env import sc2_env from pysc2.lib import point_flag from pysc2.lib import stopwatch FLAGS = flags.FLAGS flags.DEFINE_bool("render", True, "Whether to render with pygame.") point_flag.DEFINE_point("feature_screen_size", "84", "Resolution for screen feature layers.") point_flag.DEFINE_point("feature_minimap_size", "64", "Resolution for minimap feature layers.") point_flag.DEFINE_point("rgb_screen_size", None, "Resolution for rendered screen.") point_flag.DEFINE_point("rgb_minimap_size", None, "Resolution for rendered minimap.") flags.DEFINE_enum( "action_space", None, sc2_env.ActionSpace._member_names_, # pylint: disable=protected-access "Which action space to use. Needed if you take both feature " "and rgb observations.") flags.DEFINE_bool("use_feature_units", False, "Whether to include feature units.") flags.DEFINE_bool("disable_fog", False, "Whether to disable Fog of War.")
import time from absl import app from absl import flags from future.builtins import range # pylint: disable=redefined-builtin from pysc2 import maps from pysc2 import run_configs from pysc2.lib import point_flag from s2clientprotocol import common_pb2 as sc_common from s2clientprotocol import sc2api_pb2 as sc_pb flags.DEFINE_bool("raw", False, "Enable raw rendering") point_flag.DEFINE_point("feature_size", "64", "Resolution for feature layers.") point_flag.DEFINE_point("rgb_size", "64", "Resolution for rgb observations.") FLAGS = flags.FLAGS def main(unused_argv): interface = sc_pb.InterfaceOptions() interface.score = True interface.raw = FLAGS.raw if FLAGS.feature_size: interface.feature_layer.width = 24 FLAGS.feature_size.assign_to(interface.feature_layer.resolution) FLAGS.feature_size.assign_to( interface.feature_layer.minimap_resolution) if FLAGS.rgb_size: FLAGS.rgb_size.assign_to(interface.render.resolution)
from pysc2.lib import actions from baselines_legacy import cnn_to_mlp from baselines.logger import Logger, TensorBoardOutputFormat, HumanOutputFormat from common.vec_env.subproc_vec_env import SubprocVecEnv from a2c.policies import CnnPolicy from a2c import a2c import deepq_mineral_4way import deepq_nexus_wars from pysc2.lib import actions from pysc2.lib import features from pysc2.lib import point_flag FLAGS = flags.FLAGS point_flag.DEFINE_point("screen_size", "84", "Resolution for screen actions.") point_flag.DEFINE_point("minimap_size", "64", "Resolution for minimap actions.") flags.DEFINE_bool("hide_specific", False, "Hide the specific actions") from pysc2.agents import random_agent from pysc2.env import run_loop from pysc2.env import sc2_env from pysc2.tests import utils _MOVE_SCREEN = actions.FUNCTIONS.Move_screen.id #_SELECT_ARMY = actions.FUNCTIONS.select_army.id _SELECT_ALL = [0] _NOT_QUEUED = [0] step_mul = 8
from pysc2.lib import renderer_human from pysc2.lib import replay from pysc2.lib import stopwatch from s2clientprotocol import sc2api_pb2 as sc_pb FLAGS = flags.FLAGS flags.DEFINE_bool("render", True, "Whether to render with pygame.") flags.DEFINE_bool("realtime", False, "Whether to run in realtime mode.") flags.DEFINE_bool("full_screen", False, "Whether to run full screen.") # flags.DEFINE_float("fps", 22.4, "Frames per second to run the game.") # flags.DEFINE_float("fps", 60, "Frames per second to run the game.") flags.DEFINE_integer("step_mul", 1, "Game steps per observation.") flags.DEFINE_bool("render_sync", False, "Turn on sync rendering.") point_flag.DEFINE_point("feature_screen_size", "84", "Resolution for screen feature layers.") point_flag.DEFINE_point("feature_minimap_size", "64", "Resolution for minimap feature layers.") flags.DEFINE_integer("feature_camera_width", 24, "Width of the feature layer camera.") point_flag.DEFINE_point("rgb_screen_size", "256,192", "Resolution for rendered screen.") point_flag.DEFINE_point("rgb_minimap_size", "128", "Resolution for rendered minimap.") point_flag.DEFINE_point("window_size", "640,480", "Screen size if not full screen.") flags.DEFINE_string("video", None, "Path to render a video of observations.") flags.DEFINE_integer("max_game_steps", 0, "Total game steps to run.") flags.DEFINE_integer("max_episode_steps", 0, "Total game steps per episode.")