Giter VIP home page Giter VIP logo

Comments (5)

simoninithomas avatar simoninithomas commented on June 17, 2024 4

Hello,

You need to import the roms they are not provided by default.

  1. Download zip file from http://www.atarimania.com/rom_collection_archive_atari_2600_roms.html
  2. Open Roms.rar > ROMS.rar
  3. Extract all
  4. python -m retro.import . (don't forget the point)

Taken from here #53

Have a great day !

from retro.

SadAngelF avatar SadAngelF commented on June 17, 2024 1

@simoninithomas Thank you very much! That works. Yesterday I tried to find the ROMs, but I failed.

from retro.

waltdrexler avatar waltdrexler commented on June 17, 2024

Hello,

You need to import the roms they are not provided by default.

  1. Download zip file from http://www.atarimania.com/rom_collection_archive_atari_2600_roms.html
  2. Open Roms.rar > ROMS.rar
  3. Extract all
  4. python -m retro.import . (don't forget the point)

Pls help a TRUE novice out: Where are we typing in the pythonmretroimport. Right click the folder? command line, etc

from retro.

8bitmp3 avatar 8bitmp3 commented on June 17, 2024

Pls help a TRUE novice out: Where are we typing in the pythonmretroimport. Right click the folder? command line, etc

@waltdrexler perhaps this "starter guide" I've put together can help and if there's an error maybe @endrift or @christopherhesse can point it out. Step 3 refers to importing ROMs.

You'll need to work in Jupyter (type your commands with a "!" in the cells) or use a command line (no need for "!").

  1. If you haven't already, install retro:
pip install gym-retro

Alternatively, you can also git clone a fresh version of the repo with git clone https://github.com/openai/retro.git and then run python setup.py install.

  1. To run Sonic you should ideally get the game from Steam. Download the Steam app, create an account, purchase and download the game. The Retro Gym Contest run by OpenAI in 2018 worked on three version of Sonic: the original Sonic The Hedgehog, Sonic 2, and Sonic 3 And Knuckles. You should get at least one of these games before moving on to the next step.

  2. Once the game(s) are downloaded, import the game ROMs from the installed Steam directory, which hosts the Steam-purchased games, with:

python -m retro.import '/STEAM-DIRECTORY-PATH/Steam'

(Note: on MacOS, the path would be somewhere under '/Users/USER-NAME/Library/Application Support/Steam'). The output should look like this:

Importing 7422 potential games...
Importing SonicAndKnuckles3-Genesis
Importing SonicTheHedgehog2-Genesis
Importing SonicTheHedgehog-Genesis
Imported 3 games

Note: to list all supported game ROM environments before choosing the one(s) you have already: retro.data.list_games() (it's quite a long list).

  1. The Sonic game environments you need to take note of are:

'SonicTheHedgehog-Genesis'
'SonicTheHedgehog-Sms'
'SonicTheHedgehog2-Genesis'
'SonicTheHedgehog2-Sms'
'SonicTheHedgehog3-Genesis'
'SonicTheHedgehogRandomLevels-Genesis'
I'd recommend using Genesis

  1. Also, take note of the game levels (ignore ".state"—these are just the file types). You can view them all here:

GreenHillZone.Act1.state
GreenHillZone.Act2.state
GreenHillZone.Act3.state
LabyrinthZone.Act1.state
LabyrinthZone.Act2.state
LabyrinthZone.Act3.state
MarbleZone.Act1.state
MarbleZone.Act2.state
MarbleZone.Act3.state
ScrapBrainZone.Act1.state
ScrapBrainZone.Act2.state
SpringYardZone.Act1.state
SpringYardZone.Act2.state
SpringYardZone.Act3.state
StarLightZone.Act1.state
StarLightZone.Act2.state
StarLightZone.Act3.state

  1. Test it with a nice viz of the game. First, check if you have matplotlib installed, and if not—"pip install matplotlib. Add a cell in Jupyter or create a sonic-rl-test.py` file:
import retro
%matplotlib inline
import matplotlib as mpl # For visualization
import matplotlib.pyplot as plt
mpl.rc('axes', labelsize=14)
mpl.rc('xtick', labelsize=12)
mpl.rc('ytick', labelsize=12)

# Instantiate the Sonic 1 environment and level 1 as follows:
env = retro.make(game='SonicTheHedgehog-Genesis', state='GreenHillZone.Act1')

obs = env.reset()

for i in range(100): # For 100 steps
    random_action = env.action_space.sample() # Take random actions
    obs, reward, done, info = env.step(random_action) # Progress the game (an agent's action is fed into `env.step()` and a new `obs` is sent to the agent)
    if done: 
        obs = env.reset() # Reset the environment if "game over" (done)

plt.imshow(obs)

Run it and you should see a snapshot of what the agent was up to.

  1. Add env.close() to shut the environment's window and free up the resources.

  2. Consider using a neat package called retrowrapper to run multiple instances of envs as subprocesses (pip install retrowrapper):

import retrowrapper

env_greehill_act1 = retrowrapper.RetroWrapper(
    game='SonicTheHedgehog-Genesis', 
    state='GreenHillZone.Act1')

env_labyrinth_act1 = retrowrapper.RetroWrapper(
    game='SonicTheHedgehog-Genesis', 
    state='LabyrinthZone.Act1')

from retro.

waltdrexler avatar waltdrexler commented on June 17, 2024

worked like a charm

from retro.

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.