Kautenja / gym-super-mario-bros

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

newer version of gym requires rewards to be float #114

Closed haruishi43 closed 2 years ago

haruishi43 commented 2 years ago

Description

Newer versions of gym>=0.20.0 requires reward returned by step() to be float. The new passive_env_checker.py checks if the environment complies with this or not. This error could not be avoided with writing custom wrappers that converts the original int reward to float.

Error log:

  ...
  File "/home/ubuntu/.pyenv/versions/3.8.8/lib/python3.8/site-packages/gym/utils/passive_env_checker.py", line 278, in passive_env_step_check
    assert isinstance(
AssertionError: The reward returned by `step()` must be a float

Type of change

Please select all relevant options:

Checklist

haruishi43 commented 2 years ago

Might need to update nes_py as well. And I noticed that the reward range is a tuple of ints, which might still raise the error. https://github.com/Kautenja/nes-py/blob/bd1b06448e29675b82eaf2953fa83886250dc67f/nes_py/nes_env.py#L303

Kautenja commented 2 years ago

Version 8.2.0 of nes-py resolves this issue for all downstream environments. Thanks for bringing it to my attention and making the suggestion!