robertoschiavone / flappy-bird-env

Flappy Bird as a Farama Gymnasium environment.
MIT License
26 stars 6 forks source link

rgb array returns black image #1

Open Cranbaerry opened 8 months ago

Cranbaerry commented 8 months ago

Hi,

I was trying to implement this into my RL project

import flappy_bird_env  # noqa
import gymnasium
import matplotlib.pyplot as plt
from gymnasium.wrappers import GrayScaleObservation
from stable_baselines3.common.vec_env import DummyVecEnv, VecFrameStack

env = gymnasium.make("FlappyBird-v0", render_mode="human") # if I change this into rgb_array, it returns black or 000
env = GrayScaleObservation(env, keep_dim=True)
env = DummyVecEnv([lambda: env])

state = env.reset()
# take step from sample
action = env.action_space.sample()
observation, reward, done, info = env.step([action])
print(observation[0])
plt.imshow(observation[0])
plt.show()

the option to use render_mode "rgb_array" doesn't work as it returns black image so I would have to use "human", could you take a look at this?

robertoschiavone commented 8 months ago

@Cranbaerry can you tell me what operating system and Python version are you using?

Joschua-J commented 6 months ago

I have the same bug. I am using Windows 11 and Python 3.11.0.