Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CarRacing-v0 Window size issues #1268

Closed
tleyden opened this issue Dec 28, 2018 · 6 comments
Closed

CarRacing-v0 Window size issues #1268

tleyden opened this issue Dec 28, 2018 · 6 comments

Comments

@tleyden
Copy link

tleyden commented Dec 28, 2018

When I run the following snippet in Jupyter Notebook:

import gym
env = gym.make('CarRacing-v0')
env.reset()
for _ in range(1000):
    env.render()
    env.step(env.action_space.sample()) # take a random action

It pops up a window that appears to be larger than the environment, with much of the window being clipped:

screen shot 2018-12-28 at 11 11 36 am

Is there a way to resize the window? Any workaround ideas?

Versions

  • OSX Sierra
  • gym==0.10.9
  • Python 3.7.1
@clvoloshin
Copy link

clvoloshin commented Dec 31, 2018

Here's a hack that i found to work. Change line 386 of car_racing.py to:
gl.glViewport(0, 0, WINDOW_W*2, WINDOW_H*2).

I believe the issue is that our mac screen sizes are too small for the assumed 1200x1000. Alternatively you can change the DPI.

@tleyden
Copy link
Author

tleyden commented Jan 2, 2019

Thanks! I'll give it a shot

@christopherhesse
Copy link
Contributor

This looks like a pyglet issue, what's the output of pip show pyglet?

@christopherhesse
Copy link
Contributor

Closing due to inactivity.

@jzenn
Copy link

jzenn commented Oct 20, 2019

I am running into the same issue.

By changing the line to gl.glViewport(0, 0, WINDOW_W*2, WINDOW_H*2), the window is much smaller but still the content is not fully visible (the reward-bar is not visible).

The output of pip show pyglet is

Name: pyglet Version: 1.4.5 Summary: Cross-platform windowing and multimedia library Home-page: http://pyglet.readthedocs.org/en/latest/ Author: Alex Holkner Author-email: Alex.Holkner@gmail.com License: BSD Location: [...]/lib/python3.7/site-packages Requires: future Required-by: gym

Thank you very much in advance!

@Dennis-Perrett
Copy link

To add onto clvoloshin's answer, in line 47 of car_racing.py, you can change the value of WINDOW_H to a lesser value. EG 800 works for me. Naturally you can change lines 46 and 47 to create a window that fits your needs.

@openai openai locked as resolved and limited conversation to collaborators Mar 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants