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

Allow arbitrary size of graphics display #75

Closed
mttk opened this issue May 9, 2016 · 5 comments
Closed

Allow arbitrary size of graphics display #75

mttk opened this issue May 9, 2016 · 5 comments

Comments

@mttk
Copy link

mttk commented May 9, 2016

Some of the games (e.g., MsPacman, MontezumaRevenge) are rendered in very small windows which can't be changed - it would make sense to allow a size parameter when rendering to allow for the graphics to possibly be upscaled (even at the cost of pixelating) for presentation / demonstrative purposes.

@gdb
Copy link
Collaborator

gdb commented May 10, 2016

@joschu what do you think?

@joschu
Copy link
Contributor

joschu commented May 10, 2016

Seems reasonable, though I'm not sure if it's worth the extra complexity.
You can always get the rgb_array and then render that yourself.

@JKCooper2
Copy link
Contributor

JKCooper2 commented May 10, 2016

I've been running some tests with resizing the SimpleImageViewer used by the atari environment and it looks like it would be reasonably straight forward. It would probably just be an additional function in atari env called set_display_dimensions(width, height) (in order to keep it seperate from the _render function) that would set the dimensions used by SimpleImageViewer to display but not alter the inputs. I'll put up a pull request if I can get something working pretty soon

@gdb
Copy link
Collaborator

gdb commented May 16, 2016

After looking at the implementation, I agree with John that we shouldn't support this right now. If there's lots of demand, we can support something, but otherwise we'll be maintaining something that's a bit complicated and isn't obviously universally needed.

Thanks for raising this, however! If you end up writing some code to render the rgb_array yourself, please make sure to post it somewhere (this issue is fine, or alternatively a Gist writeup in gym).

@gdb gdb closed this as completed May 16, 2016
@mttk
Copy link
Author

mttk commented Jun 28, 2016

@gdb @joschu is this still relevant? I started typing something up, however I'm not sure if the VideoRecorder allows for some resizing options.

Edit: Nevermind, I think it should be relevant. There are two solutions as I see them, one of them part of the gym and one an outside edit.

The latter would grab the rgb array, do some interpolation and use SimpleImageViewer to display the array.
As for the former, I think the most painless way to include the functionality would be to create another viewer (ResizableImageViewer) which could replace the SimpleImageViewer when needed (either on shape argument pass or some function). I think it wouldn't complicate the code, however I completely understand why you wouldn't want it.

I'll pop a gist when I do some experiments with interpolating the games.

Edit 2:
Random agent with increased rendering size:
https://gist.github.com/mttk/74dc6eaaea83b9f06c2cc99584d45f96

So, i backed off from doing any heavy computation and decided to keep it simple by just repeating the x and y axes of the rgb matrix by a whole factor. The rendering is then large enough for demonstrative purposes.

I've tested it on most of the environments (100 iters of random agent) and it works fine. I didn't test on MuJoCo ones since I didn't get the license. I couldn't test on the ones that just have text display (obviously).

For some of the games there's a double rendering - something (the monitor?) renders the original sized rgb array before I render the upscaled one, and the two renders are seen in parallel. I've reproduced this with Pendulum-v0.

For my needs, this is enough, so I'll leave it like this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants