Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to slow down the game environment with gym’s OpenAI?

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.

like image 689
sprmbng Avatar asked Nov 08 '22 01:11

sprmbng


2 Answers

Use time.sleep(.1) after every render.

like image 153
C.Schoening Avatar answered Nov 15 '22 06:11

C.Schoening


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.

like image 37
acrystal Avatar answered Nov 15 '22 05:11

acrystal