When I render an environment with gym it plays the game so fast that I can’t see what is going on. And it shouldn’t be a problem with the code because I tried a lot of different ones.
Use time.sleep(.1)
after every render.
You can manually control the frame rate using the 'fps' argument:
import gym
env = gym.make("CartPole-v1", render_mode="rgb_array")
gym.utils.play.play(env, fps=8)
This applies for playing an environment, but not for simulating one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With