Categories
Uncategorized

Playing PC Games On Your Raspberry Pi

by Jamie Dickson and Benjy Boxer

Tl;dr We recently released Parsec for the Raspberry Pi, allowing you to play PC games on the Pi streamed from your own gaming PC or a cloud machine at 1080p / 60 FPS. Check out the demo video below, sign up for our product here if you want to try it out, or join our community discussion on Discord.

Last autumn we released Parsec, a standalone cloud gaming system that can be used to play games remotely, either on your own PC or in the cloud via AWS. Today we’re proud to announce that we’re adding support for the Raspberry Pi.

Why?

The dream of the thin client — one that could be good enough not just for basic computing tasks, but even highly demanding tasks such as gaming — has long eluded us. A few decades ago, when computers were much scarcer, this used to be the default way of interacting with a computer via Teletype or the like. Since you couldn’t really do much with the machine, these types of thin clients could pretty much do anything you could do locally, albeit with added latency.

But as technology progressed, the incredible experiences a computer could create locally greatly outpaced our ability to deliver these experiences remotely. We moved from a world of text based terminals to GUIs and real-time rendered 3D video, and with those things dramatically more data to ship around. In the golden days of Windows, we didn’t even try — you would go to the store and buy one or more physical installation disks, then install and run the software on your PC. All processing was done locally, and all data generated by the applications was also stored locally.

Then the internet happened. The web introduced a hybrid model where some of the processing still happened locally, but most of the processing happened remotely on a server. Essentially, perform the heavy lifting on a server somewhere, and deliver a lightweight interface to the user via HTML and javascript. At the same time, this allowed the application’s data to be stored remotely, freeing the user from a single PC. This model has mostly dominated application delivery for the past twenty years, with a bit of a regression since the dawn of the mobile era bringing us back to shipping binaries around.

But something is changing, and rather than state the conclusion, I’ll pose a question: If internet latency were low enough, bandwidth were high enough, and video processing were fast enough, could it be possible to do away with your local interface entirely and simply make a remote interface your “daily driver?” We believe the answer is “yes”, and that the necessary components are coming together to make the thin client a reality in today’s world. And to us, nothing exemplifies this concept better than playing PC games delivered via a cloud machine on a Raspberry Pi.

https://www.periscope.tv/w/1RDGlRpQlzRxL

How We Made It Work

The core technology is explained in detail here, but we’ve done a lot to make the Raspberry Pi application as low latency as possible.

While many of us think of a the humble Raspberry Pi as a standard linux machine, under the hood it has a lot more in common with your cell phone than it does with your desktop PC. For graphics, the Pi uses a GPU called the “VideoCore IV”. This little Broadcom invention allows us to interact with it via a standard that has been dubbed OpenMax. Now, for what it is, OpenMax gets the job done, but the documentation seems a bit thin at best. There is a lot of hunting through header files and old forum posts to figure out exactly how these functions work.

Being of a graphical nature, our initial thought was to make Parsec work in X Windows. Getting the basics working wasn’t bad, but we had one glaring flaw to deal with: the mouse cursor was behind the video. Now, OpenMax cooperates fairly well with the other standards in place on the Pi, and the particular issue we were having here was the interaction between OpenMax’s video_render layer and the fact that X’s mouse cursor was rendered along with all of its other GUI elements on the same layer. The solution to this was to just scrap X11 entirely.

Using Dispmanx, the Pi gives us a nice way to render video without the use of a graphical user environment. Fortunately, Parsec counts on a well-made library named SDL2 to handle most of the input. This gives us a nice cross-platform way to support the huge number of input variations that exist system to system. In this case, as of SDL2.0.5 some enterprising soul has written a preliminary native implementation of mouse handling for the Raspberry Pi. Getting this going using the integrated SDL hint to change the window’s layer got video and a mouse cursor pretty quickly, but that’s where the going got a bit rough.

The SDL2 mouse functions were a good start, but using the cursor as dynamically as Parsec does, a few cracks started to appear in the mouse functionality. Switching between relative and absolute mode caused the cursor to jump around. The “hot” point in the cursor was incorrect, eg the I-Beam was selecting with the upper left corner. Like any red-blooded American, we did what was necessary: we threw together a fix for the SDL code. You can take a look at a few of the changes we made to SDL here. Beyond that, there was more subtle tweaking to HDMI frequencies and things of that nature to make Parsec what it is, but those were the big rocks on our way to getting the little $35 Pi to a place where you could play Overwatch on it.

What Is A Raspberry Pi?

For the uninitiated, The Raspberry Pi Foundation released their first low powered, inexpensive computer in 2012 with the admirable goal to “put the power of digital making into the hands of people all over the world, so they are capable of understanding and shaping our increasingly digital world, able to solve the problems that matter to them, and equipped for the jobs of the future.” These devices range in price from $5 to $35 for the Raspberry Pi 3. Despite the very low price tag, they pack a powerful punch. Over 10 million Raspberry Pi had been sold by September 2016, and the projects that people are building on the hardware range from simple hobby projects to sophisticated robots.

The Raspberry Pi 3 was a great candidate for us to build an application that can connect to your gaming PC or one in the cloud. Although it only has a quad core ARM chip, it has a high quality H.264 video decoder, Bluetooth support for peripherals, and an HDMI port.

What’s Making This Possible Today?

Compression algorithms and dedicated hardware for video encoding and decoding are now standard on every device manufactured since 2012. The good news is that this is getting even better with the introduction of the H.265 codec in 2015. By 2020, we’ll all have an H.265 hardware decoder and access to more bandwidth for higher quality, lower latency video streams.

http://s3securitysystems.com/h-265-the-arrival-of-video-compressions-future/

Additionally, the price and availability of bandwidth continue to move in favor of ubiquitous access to significant amounts of bandwidth. In fact, our median user has a 54 Mbps and 21 Mbps connection in the US and Europe respectively.

Finally, cloud providers have been investing substantial resources in GPUs over the last couple of years. Amazon, Microsoft, and Google all announced new GPU instances available throughout the world. These GPU instances are primarily valuable to machine learning algorithms for artificial intelligence projects, but they’re also very valuable to Parsec and others trying to move rendering to the cloud.

How Do I Start Playing On My Raspberry Pi?

Our goal is to both expand the market for gaming by giving people access to gaming hardware from the cloud and to prove that computers-as-a-service is the future of computing. With Parsec for RPi, we’re decoupling expensive PC hardware from gaming, so anyone with a screen, a $35 computer, and a good internet connection can play their favorite games at the highest settings.

  1. Create an account on Parsec
  2. Pick up a Raspberry Pi 3 if you don’t have one
  3. Download and install the Parsec on your RPi 3
  4. Follow the set up instructions in the Readme or here
  5. Connect to your gaming machine via the Parsec server software
  6. Win!

Power your remote workplace. Try Parsec for Teams

Leave a Reply

Your email address will not be published.