forked from openai/baselines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
register_all_atari_envs.py
57 lines (54 loc) · 2.34 KB
/
register_all_atari_envs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# https://github.com/openai/atari-py/issues/73
def register_all_gym_envs_in_v4():
from collections import defaultdict
try:
from ale_py.roms.utils import rom_name_to_id
from ale_py.gym import GymConfig, GymFlavour, _register_gym_configs
import ale_py.roms as roms
legacy_games = list(map(rom_name_to_id, roms.__all__))
obs_types = ["rgb", "ram"]
frameskip = defaultdict(lambda: 4, [("space_invaders", 3)])
versions = [
GymConfig(
"v0",
{"repeat_action_probability": 0.25, "full_action_space": False},
[
# Default for v0 has 10k steps, no idea why...
GymFlavour("", {"frameskip": (2, 5)}, {"max_episode_steps": 10000}),
# Deterministic has 100k steps, close to the standard of 108k (30 mins gameplay)
GymFlavour(
"Deterministic",
lambda rom: {"frameskip": frameskip[rom]},
{"max_episode_steps": 100000},
),
# NoFrameSkip imposes a max episode steps of frameskip * 100k, weird...
GymFlavour(
"NoFrameskip",
{"frameskip": 1},
lambda rom: {"max_episode_steps": 100000 * frameskip[rom]},
),
],
),
GymConfig(
"v4",
{"repeat_action_probability": 0.0, "full_action_space": False},
[
# Unlike v0, v4 has 100k max episode steps
GymFlavour("", {"frameskip": (2, 5)}, {"max_episode_steps": 100000}),
GymFlavour(
"Deterministic",
lambda rom: {"frameskip": frameskip[rom]},
{"max_episode_steps": 100000},
),
# Same weird frameskip * 100k max steps for v4?
GymFlavour(
"NoFrameskip",
{"frameskip": 1},
lambda rom: {"max_episode_steps": 100000 * frameskip[rom]},
),
],
),
]
_register_gym_configs(legacy_games, obs_types, versions)
except ImportError:
pass