Exemple #1
0
def make_env(stack=True, scale_rew=True, render=None, monitor=None, timelimit=False, episodic_life=False, video=None, single_life=False):
    """
    Create an environment with some standard wrappers.
    """
    env = retro.make("SuperMarioBros-Nes")
    env = MarioDiscretizer(env)
    if scale_rew:
        env = RewardScaler(env)
    if episodic_life:
        env = EpisodicLifeEnv(env)
    if single_life:
        if episodic_life:
            raise Exception("single_life and episodic_live can not be combined")
        env = SingleLifeEnv(env)
    if timelimit:
        if episodic_life:
            raise Exception("timelimit and episodic_life don't work together")
        env = TimeLimit(env, max_episode_steps=4000)  # should be enough for the level
    if monitor is not None:
        env = Monitor(env, monitor, video)
    env = WarpFrame(env)
    if stack:
        env = FrameStack(env, 4)
    if render is not None:
        env = AutoRenderer(env, auto_render_period=render)
    return env
def wrap_deepmind_retro(env, scale=True, frame_stack=4):
    """
    Configure environment for retro games, using config similar to DeepMind-style Atari in wrap_deepmind
    """
    env = WarpFrame(env)
    env = ClipRewardEnv(env)
    if frame_stack > 1:
        env = FrameStack(env, frame_stack)
    if scale:
        env = ScaledFloatFrame(env)
    return env
Exemple #3
0
 def _thunk():
     name = envs[i]
     env = retro.make(name[0], name[1])
     env = SonicDiscretizer(env)
     if scale_rew:
         env = RewardScaler(env)
     env = WarpFrame(env)
     if stack:
         env = FrameStack(env, 4)
     if backtracking:
         env = AllowBacktracking(env)
     return env
Exemple #4
0
def make_env(stack=True, scale_rew=True):
    """
    Create an environment with some standard wrappers.
    """
    env = make(game='SonicAndKnuckles3-Genesis', state='AngelIslandZone.Act1')
    #env = grc.RemoteEnv('tmp/sock')
    env = SonicDiscretizer(env)
    if scale_rew:
        env = RewardScaler(env)
    env = WarpFrame(env)
    if stack:
        env = FrameStack(env, 4)
    return env
Exemple #5
0
def wrap_env(env, width=84, height=84, gray_scale=True):
    if hasattr(env.unwrapped, 'get_action_meanings'):
        if 'FIRE' in env.unwrapped.get_action_meanings():
            env = FireResetEnv(env)
    env = WarpFrame(env, width, height, gray_scale)
    return env
Exemple #6
0
def wrap_env(env, width=84, height=84, gray_scale=False):
    env = WarpFrame(env, width, height, gray_scale)
    return env