MrChriwo / VectorVelocity

A space-themed OpenAI Gym environment designed for reinforcement learning. Users pilot a spaceship through an asteroid field while collecting coins. The environment increases in difficulty as the speed escalates, with asteroids and coins spawning randomly, providing dynamic challenges that are ideal for developing and refining Agents
https://mrchriwo.github.io/VectorVelocity/
GNU General Public License v3.0
0 stars 0 forks source link

Getting an error when using the gymnasium env checker #38

Open Cornslakes opened 1 month ago

Cornslakes commented 1 month ago

Describe the bug It is not possible to use the gymnasium env_checker on the environment.

To Reproduce Steps to reproduce the behavior:

`from gymnasium.utils.env_checker import check_env from stable_baselines3.common.env_checker import check_env

env modifications if needed

GAMEOVER_PENALTY = 75 MISSED_COIN_PENALTY = 3

DODGED_OBSTACLE_REWARD = 1 COLLECTED_COIN_REWARD = 12

def create_env(): env = VectorVelocityEnv() env.coin_missed_penalty = MISSED_COIN_PENALTY env.game_over_penalty = GAMEOVER_PENALTY env.dodged_obstacle_reward = DODGED_OBSTACLE_REWARD env.coin_reward = COLLECTED_COIN_REWARD return env

env = create_env() check_env(env)`

Expected behavior The code should run properly.

Desktop (please complete the following information):

MrChriwo commented 1 month ago

Thanks for sharing that bug. It seems like it's related to Gymnasium's options parameter in the step function. As a workaround, the Stable Baselines3 check_env function can be used. The fix for this bug will be provided in the next release.

sample workaround

from stable_baselines3.common.env_checker import check_env
from gym_vectorvelocity import VectorVelocityEnv

GAMEOVER_PENALTY = 75
MISSED_COIN_PENALTY = 3

DODGED_OBSTACLE_REWARD = 1
COLLECTED_COIN_REWARD = 12

def create_env():
    env = VectorVelocityEnv()
    env.coin_missed_penalty = MISSED_COIN_PENALTY
    env.game_over_penalty = GAMEOVER_PENALTY
    env.dodged_obstacle_reward = DODGED_OBSTACLE_REWARD
    env.coin_reward = COLLECTED_COIN_REWARD
    return env

env = create_env()
check_env(env)