Skip to main content

Gameboy (Color) environments in Gymnasium 🤖

Project description

Logo

Gymboy 🤖
Gameboy (Color) Environments in Gymnasium

Kirby Dream Land 1 Pokemon Blue Pokemon Gold Super Mario Land 1

Gymboy supports a range of different RL environments from the Game Boy Color using the Gymnasium API.

Implemented Environments 🌍

Environment Name Python Source
Kirby-Dream-Land-1-flatten-v1 Click
Kirby-Dream-Land-1-minimal-image-v1 Click
Kirby-Dream-Land-1-full-image-v1 Click
Pokemon-Blue-flatten-v1 Click
Pokemon-Blue-minimal-image-v1 Click
Pokemon-Blue-full-image-v1 Click
Pokemon-Gold-flatten-v1 Click
Pokemon-Gold-minimal-image-v1 Click
Pokemon-Gold-full-image-v1 Click
Pokemon-Red-flatten-v1 Click
Pokemon-Red-minimal-image-v1 Click
Pokemon-Red-full-image-v1 Click
Pokemon-Silver-flatten-v1 Click
Pokemon-Silver-minimal-image-v1 Click
Pokemon-Silver-full-image-v1 Click
Pokemon-Yellow-flatten-v1 Click
Pokemon-Yellow-minimal-image-v1 Click
Pokemon-Yellow-full-image-v1 Click
Super-Mario-Land-1-flatten-v1 Click
Super-Mario-Land-1-minimal-image-v1 Click
Super-Mario-Land-1-full-image-v1 Click
Tetris-flatten-v1 Click
Tetris-minimal-image-v1 Click
Tetris-full-image-v1 Click

Installation ⚙️

Install the package via pip:

pip install gymboy

⚠️ Important: Gymboy requires specific ROM files to function properly. Make sure you have the necessary ROMs available before using any of the environments.

Usage 🚀

Here's a quick example of how to use a gymboy environment:

import numpy as np

import gymboy

# Create the environment
env = gymboy.make(
    env_id="Pokemon-Blue-full-image-v1",
    rom_path="./resources/roms/pokemon/gen_1/pokemon_blue.gb",
    init_state_path="./resources/states/pokemon/gen_1/pokemon_blue_after_intro.state",
)
num_steps = 1000

# Reset the environment
observation, info = env.reset()
for i in range(num_steps):
    # Sample a random action
    action = env.action_space.sample()

    # Perform the action
    observation, reward, terminated, truncated, info = env.step(action)
    done = np.logical_or(terminated, truncated)

    if done:
        # Case: Environment has terminated
        break

# Close the environment
env.close()

You can also create multiple instances of the environment running in parallel:

import numpy as np

import gymboy

# Create the environments
envs = gymboy.make_vec(
    env_id="Pokemon-Blue-full-image-v1",
    num_envs=2,
    rom_path="./resources/roms/pokemon/gen_1/pokemon_blue.gb",
    init_state_path="./resources/states/pokemon/gen_1/pokemon_blue_after_intro.state",
)
num_steps = 1000

# Reset the environments
observations, infos = envs.reset()
for i in range(num_steps):
    # Sample random actions
    actions = envs.action_space.sample()

    # Perform the actions
    observations, rewards, terminated, truncated, infos = envs.step(actions)
    dones = np.logical_or(terminated, truncated)
    # No need to check for dones — environments auto-reset internally

# Close the environments
envs.close()

Development 🔧

Contributions are welcome!

Please fork the repository and submit a pull request.

Make sure to follow the coding standards and write tests for any new features or bug fixes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gymboy-0.0.1.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gymboy-0.0.1-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

Details for the file gymboy-0.0.1.tar.gz.

File metadata

  • Download URL: gymboy-0.0.1.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for gymboy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 57f06257738b1ae6a19f06a589df7a862cd748961b16690c165aac97169e2e34
MD5 ed4a125b336fbc56f38911a0965e925b
BLAKE2b-256 3b1fffa1c94a729006f6a132c03eb5c5c214ed572ad2dce6942326a34974b89a

See more details on using hashes here.

File details

Details for the file gymboy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: gymboy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 37.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for gymboy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e97bbf771732ba09814191cec6b15746692a88fec7e80a68cd7191937ec26779
MD5 c063b42cd93bac9c9b7e2bd815001d2f
BLAKE2b-256 7431b4d7364170911214b7c0f76d0221fe5ae8fa6f51f303d8440cbbd483975d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page