Giter Club home page Giter Club logo

Comments (6)

Jackiexiao avatar Jackiexiao commented on August 14, 2024 10

I seems I have found the solution, you can follow the gym-wiki to register env manually.
git clone https://github.com/ppaquette/gym-super-mario
On my computer
cp -r ~/gym-super-mario/ppaquette_gym_super_mario ~/gym/gym/envs
Register env in /gym/envs/init.py:

register(
     id='SuperMarioBros-1-1-v0',
     entry_point='gym.envs.ppaquette_gym_super_mario:MetaSuperMarioBrosEnv',
)

Add your environment to the scoreboard in /gym/scoreboard/init.py

add_group(
     id='ppaquette_gym_super_mario',
     name='ppaquette_gym_super_mario',
     description='super_mario'
 )

 # mario bros
 add_task(
     id='ppaquette/SuperMarioBros-1-1-v0',
     group='ppaquette_gym_super_mario',
     summary="SuperMarioBros-1-1-v0"
  )

It works for me , you can test it by create a python file: test.py

import gym 
env = gym.make('SuperMarioBros-1-1-v0')
observation = env.reset()
for _ in range(1000):
    env.render()
    action = env.action_space.sample() # your agent here (this takes random actions)
    observation, reward, done, info = env.step(action)

from gym-super-mario.

liuny05 avatar liuny05 commented on August 14, 2024 4

@Jackiexiao's method solve my problem. But it's not very specific and has a few mistakes.
More specifically, first clone the repository git clone https://github.com/ppaquette/gym-super-mario
Then copy ppaquette_gym_super_mario to your gym/envs directory, for me it's /usr/local/lib/python3.5/dist-packages/gym/envs/
So the command is cp -r gym-super-mario/ppaquette_gym_super_mario /usr/local/lib/python3.5/dist-packages/gym/envs/
Add this to your gym/envs/__init__.py to register env

register(
     id='SuperMarioBros-1-1-v0',
     entry_point='gym.envs.ppaquette_gym_super_mario:MetaSuperMarioBrosEnv',
)

Add your environment to the scoreboard in your /gym/scoreboard/__init__.py

add_group(
     id='ppaquette_gym_super_mario',
     name='ppaquette_gym_super_mario',
     description='super_mario'
)

# mario bros
add_task(
     id='ppaquette/SuperMarioBros-1-1-v0',
     group='ppaquette_gym_super_mario',
     summary="SuperMarioBros-1-1-v0"
)

Now we done, you can test by this code

import gym 
env = gym.make('SuperMarioBros-1-1-v0')
observation = env.reset()
for _ in range(1000):
    env.render()
    action = env.action_space.sample() # your agent here (this takes random actions)
    observation, reward, done, info = env.step(action)

And the gym_pull code doesn't work now.

from gym-super-mario.

hughperkins avatar hughperkins commented on August 14, 2024 1

Cool. Nuance: you can get that path for the cp command etc by doing python -c 'import gym; print(gym.__path__[0])', so a generic cp command could be eg:

cp -r gym-super-mario/ppaquette_gym_super_mario \
    $(python -c 'import gym; print(gym.__path__[0])')/envs/

or we can copy to a var first, to use in other commands:

GYM=$(python -c 'import gym; print(gym.__path__[0])')
cp -r gym-super-mario/ppaquette_gym_super_mario ${GYM}/envs/

from gym-super-mario.

HardLu avatar HardLu commented on August 14, 2024 1

thanks all of you very much!!! its working now,the first thing to do to resolve this problem is to degrade you gym to 0.9.3 ,and you could import gym.scoreboard then, and then do as what liuny05 said.

from gym-super-mario.

borosdenes avatar borosdenes commented on August 14, 2024

Please note that gym changed 21 days ago, resulting in major change within gym/scoreboard. For me the only solution was to revert gym to the state where scoreboard was still at old version. See #16

Please also note that based on @Jackiexiao suludion only gym.make('SuperMarioBros-1-1-v0') will work.

from gym-super-mario.

danielcrane avatar danielcrane commented on August 14, 2024

I tried using an extended version of @Jackiexiao's solution that registers all of the individual stages, found here:

Env: https://gist.github.com/messiest/69569e8151d67c346eb609a0666d43b3
Scoreboard: https://gist.github.com/messiest/36a5cbb35dc57db2e480b4cf300e7223

However, regardless of which stage I try to make (i.e. gym.make('SuperMarioBros-8-2-v0')), it always loads the first stage, 1-1.

Does anyone have any idea what could be causing this?

Thanks!

from gym-super-mario.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.