26/10/2015

Gaming on the Go

Last week I decided to have a go at something that's been trialled commercially (and unsuccessfully) a few times - a game streaming service.

The reason that OnLive and others have failed was down to the speed of residential internet connections as opposed to how good the service actually was. While most homes in the UK probably have access to a good enough connection to stream 1080p video, the real problem is likely to be getting a latency of < 40ms to the nearest data centre (on ethernet, wifi need not apply). I wanted to have a go at this last year, but sharing an ADSL connection with 5 other students made it impossible. This year, however, we're practically sat on top of a fibre cabinet, with a 40ms ping to the Amazon data centre in Ireland :D

So, how does this actually work? My laptop may be incapable of running games, but it does have enough oomph to decode HD video (thankfully). This means that it's possible to rent out a sever with some beefy graphics hardware and run the game on that, streaming the output to my laptop and sending my key presses and mouse inputs back. An hour on one of Amazon's g2.2xlarge instances will set you back a whole 45p and nets you 8 CPUs and 15GB of memory as well as a decent GPU.

After spinning up a new node with Windows Server, the first step is to sort out the hardware. By default windows insists on using the basic display driver for graphical output, leaving you to utilise the supplied GRID GPU for whatever you please. Unfortunately, we want to utilise the GRID for graphical output, and Windows insists so hard that disabling and uninstalling the default driver isn't enough to convince it that you don't want it anywhere near your server. Once that's done you need to start the Windows audio service and set up a virtual sound card so you can get some audio output.

The first thing most people think of when you mention streaming desktop stuff is RDP or VNC. As we found out last term when we used VNC to cast the Artemis captain's screen to a projector, they are not designed for performance, and you won't get anywhere near 60 frames per second. Most likely, you'll be measuring in seconds per frame. The best tool for this is actually Steam 'in home streaming' - because the link from laptop to data centre is not that far off a home network. You do need to VPN the two hosts together to trick Steam into thinking that you are in fact in the same room as the server. In fact, getting steam to consistently recognise the link between the two workstations was the biggest problem, and stems from it's inability to correctly deal with more than one network adapter. Discovery packets are often sent out on the default adapter and not the simulated VPN one, resulting in frustration and sadness. People have reported similar issues when using hosts with VirtualBox adapters.

But even with all of that, it actually works surprisingly well. Well enough that I often forgot I was streaming. You won't get miracles though: 1080p is probably about the highest you'd want to go to avoid hitting performance and bandwidth limits. The hardware you get is a GRID K520, which is two GK104 boards glued together (a slightly underclocked GTX680). This is somewhere between the current GTX 970 and GTX 980 in terms of pixel pushing power. So, achieveable? Yes. Practical? Still not quite there yet - having a good enough connection available is still quite limiting.