openai / universe

Universe: a software platform for measuring and training an AI's general intelligence across the world's supply of games, websites and other applications.
https://universe.openai.com
MIT License
7.45k stars 956 forks source link

Screen tearing over vnc connection #98

Closed ghost closed 7 years ago

ghost commented 7 years ago

Expected behavior

connect to vnc on port 5900 etc. and see core Atari game running

Actual behavior

game screen tears in between frames for seconds at a time: game/black/game/black/game/game

Recording of behaviour for AirRaid-v0 https://www.youtube.com/watch?v=6WQIFSsshT4

Versions

Darwin Andrews-MBP.home 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64 Python 3.5.2 :: Anaconda 4.2.0 (x86_64)

Metadata-Version: 1.0 Name: universe Version: 0.21.0 Summary: Universe: a software platform for measuring and training an AI's general intelligence across the world's supply of games, websites and other applications. Home-page: https://github.com/openai/universe Author: OpenAI Author-email: universe@openai.com License: UNKNOWN Location: /Users/andrewjohnson/test/universe Requires: autobahn, docker-py, docker-pycreds, fastzbarlight, go-vncdriver, gym, Pillow, PyYAML, six, twisted, ujson Classifiers:

Metadata-Version: 1.0 Name: gym Version: 0.7.0 Summary: The OpenAI Gym: A toolkit for developing and comparing your reinforcement learning agents. Home-page: https://github.com/openai/gym Author: OpenAI Author-email: gym@openai.com License: UNKNOWN Location: /Users/andrewjohnson/test/gym Requires: numpy, requests, six, pyglet Classifiers:

Metadata-Version: 1.1 Name: numpy Version: 1.11.2 Summary: NumPy: array processing for numbers, strings, records, and objects. Home-page: http://www.numpy.org Author: NumPy Developers Author-email: numpy-discussion@scipy.org License: BSD Location: /Users/andrewjohnson/anaconda/lib/python3.5/site-packages Requires: Classifiers: Development Status :: 5 - Production/Stable Intended Audience :: Science/Research Intended Audience :: Developers License :: OSI Approved Programming Language :: C Programming Language :: Python Programming Language :: Python :: 2 Programming Language :: Python :: 2.6 Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.2 Programming Language :: Python :: 3.3 Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 Programming Language :: Python :: Implementation :: CPython Topic :: Software Development Topic :: Scientific/Engineering Operating System :: Microsoft :: Windows Operating System :: POSIX Operating System :: Unix Operating System :: MacOS

Metadata-Version: 2.0 Name: go-vncdriver Version: 0.4.19 Summary: UNKNOWN Home-page: UNKNOWN Author: UNKNOWN Author-email: UNKNOWN Installer: pip License: UNKNOWN Location: /Users/andrewjohnson/anaconda/lib/python3.5/site-packages Requires: numpy Classifiers:

Metadata-Version: 1.1 Name: Pillow Version: 3.3.1 Summary: Python Imaging Library (Fork) Home-page: http://python-pillow.org Author: Alex Clark (Fork Author) Author-email: aclark@aclark.net License: Standard PIL License Location: /Users/andrewjohnson/anaconda/lib/python3.5/site-packages Requires: Classifiers: Development Status :: 6 - Mature Topic :: Multimedia :: Graphics Topic :: Multimedia :: Graphics :: Capture :: Digital Camera Topic :: Multimedia :: Graphics :: Capture :: Screen Capture Topic :: Multimedia :: Graphics :: Graphics Conversion Topic :: Multimedia :: Graphics :: Viewers Programming Language :: Python :: 2 Programming Language :: Python :: 2.6 Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.2 Programming Language :: Python :: 3.3 Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy You are using pip version 8.1.2, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

tlbtlbtlb commented 7 years ago

That's strange. Can you tell if you're getting black screens in the agent also? Inserting print(np.mean(observation)) is a useful hack.

You'll get much faster performance with non-VNC version of the Atari games. --env-id AirRaid-v0 rather than --env-id gym-core.AirRaid-v0

ghost commented 7 years ago

Agent is fine, and tried connecting with a different VNC client. It seems that it only affects the client(TigerVNC) that I was using.

I am OK with this resolution, but either this server or TigerVNC are somewhat incompatible.

tlbtlbtlb commented 7 years ago

I recommend either using TurboVNC on Mac for the client, or pointing your browser to http://localhost:15900 to use an in-browser VNC client.

Closing, but please reopen if it happens with another VNC client or (scariest!) in the agent's observation.

ghost commented 7 years ago

At the packet layer I was able to see what was happening here. The issue is directly correlated to lag after a bunch of update requests. I am guessing that a zeroed out buffer is being pushed out prematurely.

Here is another video of the behaviour: https://www.youtube.com/watch?v=5TAbbjGTdhU

You can see in the middle of the video what looks like normal lag. However I had to correct for that or the screen would be black from a bunch of PutPixel vnc packets. This is at about 100 update requests per second to the vnc server. I will try dialing it down to 10 fps and hope to remove the lag. Hopefully that will make the games playable.