robertoschiavone / flappy-bird-env

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

how can i customize the env? #2

Open dattienle2573 opened 6 months ago

dattienle2573 commented 6 months ago

I want to stack 4 frame instead of 3 frame and covert rgb color to gray scale. How can I do that?

robertoschiavone commented 6 months ago

Currently you get a single RGB frame, there is no stacking. To get what you are looking for, you must use the Observation Wrappers provided by gymnasium.

I'd do it this way:

import flappy_bird_env  # noqa
from gymnasium.wrappers import FrameStack, GrayScaleObservation
env = gymnasium.make("FlappyBird-v0")
env = GrayScaleObservation(env)
env = FrameStack(4)
dattienle2573 commented 5 months ago

render_mode = None does not work. I don't want to render everytime I trained the model, so how to resolve this?

robertoschiavone commented 5 months ago

You cannot have frames with render_mode = None. You can use render_mode = "rgb_array_list" to then get the collected frames with render() or reset().

dattienle2573 commented 5 months ago

If I resize the env by env = ResizeObservation(env, 80), what part of the env observation space would it keep? Do you have any suggestions if you know another effective way to do this?