Kautenja / gym-super-mario-bros

An OpenAI Gym interface to Super Mario Bros. & Super Mario Bros. 2 (Lost Levels) on The NES
Other
685 stars 134 forks source link

Question about env.step(action) return value. #61

Closed leaderj1001 closed 6 years ago

leaderj1001 commented 6 years ago

This environment is really nice environment to learn reinforcement learning. Thank you so much. But When I using this environment, I encountered little problem. When I did env.step(action), I can receive four kinds of different return values such as next_state, reward, done and info. So I want to see that kinds of values. When I display a info value, info value was empty. I use Windows 10. Why does this happen?

Kautenja commented 6 years ago

I'll need more information to understand why this is happening. Validate your version is 3.1.0 or later using the following:

import pkg_resources
print(pkg_resources.get_distribution("gym-super-mario-bros").version)

If you are running any version of gym-super-mario-bros below 3.1.0, info will not contain anything and you should upgrade using python -m pip install gym-super-mario-bros -U

If you are running version 3.1.0, 3.1.1, or 3.1.2, please run the following and provide the output:

import gym_super_mario_bros
env = gym_super_mario_bros.make('SuperMarioBros-v0')
_ = env.reset()
_, _, _, i = env.step(0)
print(i)

Using 3.1.2 on Windows 10 I get {'flag_get': False} as the output (which is expected).

leaderj1001 commented 6 years ago

Answer thank you so much. But, I want to get a distance information and time information. Could I get that information?

Kautenja commented 6 years ago

version 4.0.0 has been released to address your issue (among others). Please see the below table for the new table of values offered in the info dictionary:

Key Type Description
coins int The number of collected coins
flag_get bool True if Mario reached a flag or ax
life int The current life (i.e., {3, 2, 1})
score int The cumulative in-game score
stage int The current stage (i.e., {1, ..., 4})
time int The time left on the clock
world int The current world (i.e., {1, ..., 8})
x_pos int Mario's x position in the stage

Does this resolve your issue?

leaderj1001 commented 6 years ago

Wooooow!!! It was super greatest update for me!! Thank you so much :) Now I can using super-mario deep learning easily. I really appreciate 👍