In the OpenAI ProcGen gym, I am not getting a way to get the meanings of the action values, I can see that there are 15 actions for the coinrun environment using env.action_space.n
. I have tried both the Gym and the Gym3 versions.
This is how I make the environment (gym version).
env = gym.make('procgen:procgen-%s-v0'%('coinrun'))
Neither of these are working to seem to work.
env.action_spec()
env.env.get_action_meanings()
I have tried to change env
with env.env
and env.env.env
, nothing works. I get the message: AttributeError: 'ToGymEnv' object has no attribute 'get_action_meanings'
.
Please tell me how I can get the labelled action list.
Object Types: env
is a ToGymEnv
object, env.env
is , and env.env.env
is ProcgenGym3Env
.
The action meanings are hidden in the get_combos
method in the procgen.env
.
def get_combos(self):
return [
("LEFT", "DOWN"),
("LEFT",),
("LEFT", "UP"),
("DOWN",),
(),
("UP",),
("RIGHT", "DOWN"),
("RIGHT",),
("RIGHT", "UP"),
("D",),
("A",),
("W",),
("S",),
("Q",),
("E",),
]
To access them from an environment created in gym (procgen==0.10.4
) you can use:
env = gym.make('procgen:procgen-%s-v0'%('coinrun'))
print(env.unwrapped.env.env.combos)
Which will result in:
[('LEFT', 'DOWN'), ('LEFT',), ('LEFT', 'UP'), ('DOWN',), (), ('UP',), ('RIGHT', 'DOWN'), ('RIGHT',), ('RIGHT', 'UP'), ('D',), ('A',), ('W',), ('S',), ('Q',), ('E',)]
In order to acces them from a ProcgenEnv
use:
env = procgen.ProcgenEnv(env_name='maze', num_envs=1)
print(env.env.combos)