How I live streamed on Twitch with my 1Mb home connection
I previously wrote an article series about my game development live streaming adventures but omitted my first hurdle in starting.
I had a connection of only 1Mb up and Twitch recommends 3-6Mb for a 720p or 1080p stream broadcast 😱.
Well, that took a little while to find 😅.
Getting a faster connection would be simplest solution but neither fibre or cable was available to our building. 4G home connection was next on my list but was not viable either due to coverage and/or usage caps.
Moving home was too extreme for a potentially short experiment. Renting a flat or private office was too expensive. Hot desking was cheaper but not practical as I would be talking most of the time and that wouldn’t go down well in a shared environment.
I did wonder about borrowing a friend’s place but unfortunately didn’t know anyone close enough within a sensible commute.
With the obvious ideas out of running, I started to wonder about feasibility of it all.
After a few more weeks of pondering, Googling and more crazy ideas (this included having multiple phone lines and bonding them to create one faster line), came the epiphany.
Realising that I was able to watch full HD videos on my connection and my measly 1Mb upload was just about capable of Skype/WhatsApp/Facebook video calls, I should be able to ‘stream’/remote desktop to myself while video calling back.
This would allow me to have the benefit of the bandwidth of where the PC was and be able to stay in the comfort of my own home for the broadcast!
Cloud Gaming providers OnLive and Gaikai have already proven this would work (with some latency) so the theory was sound, I just need to find a way to replicate this for games development environment.
Without the restriction of needing a private space for streaming, I was able to use the local co-working space and rent a corner for a headless PC for about the cost of a broadband connection.
Now I had to work out what software setup was needed to actually make this work.
Bear in mind that this was in 2016 so some of the solutions available today weren’t around back then (more on that later).
I ran through all the mainstream remote desktop software that I could find and they all suffered from one or more of the following issues:
- Not all keyboard shortcuts worked from my Mac client to the remote Windows host (e.g. Ctrl + Space to bring up intellisense wouldn’t work)
- Costs money for a commercial license
- The framerate was too low to do any realtime editing such as 3D modelling
Eventually, I found NoMachine which could capture the mouse and keyboard input completely, was free and supposedly fast enough to play games with.
The local LAN tests worked really well. I was surprised that I could play a First Person Shooter game like Counter Strike without too much trouble. Working in an IDE and the Unity3D editor remote was fantastic. There were some compression artifacts on full screen changes, but not enough to make unusable.
However, as with anything, there was a catch.
NoMachine required (and still does) a direct connection so for it to work across the internet, the host’s router needs port forwarding to be configured and the WAN IP address to Internet to be known.
As I was renting space in a co-working office, configuring the router wasn’t an option.
(This was starting to be a gift that keeps on giving… 😒)
Knowing that I had to use NoMachine, I looked for to see if this was a solvable problem. This wasn’t something I’ve come across before and it took me a while to narrow down the search terms to find relevant results.
Turns out that I needed the PC to ‘phone home’ in some way and setup a network tunnel (known as ‘reverse tunnelling’) or have a known server that both the client and host could connect to.
Top of my list of services to try were:
Both were free to use and easy to setup on Windows and MacOS. There were several others but they were primary geared towards Linux.
While they both worked, unfortunately they shared the same problem. A server in the middle was used to route traffic through and for both services, it was located in the US.
This led to large latency times that when typing, I would be a character or two behind which led to typos and having to mentally cater delayed visual feedback of what I was doing.
On the bright side, this did lead me down the path that a local VPN service would work and luckily, my home ASUS router had this feature built in.
Enabled the feature, created a few accounts (both the client and host had to connect) and amazingly, it was working as well as it could be with minimal latency.
My home Internet connection didn’t have a static IP address but this was solved using a free dynamic service like noip.com that would continuously update the DNS of an URL to my IP address.
Finally, there was some light at the end of the tunnel. I could now stream at full HD while being physically at home on a slow connection. How awesome was that? Even I was surprised by this!
All that was left were some finishing touches to complete the streaming experience and some housekeeping for managing the remote PC.
I used Skype to ‘forward’ my webcam and voice to the remote PC by calling myself. I’d set the account to auto accept calls from my primary account to streamline the setup process. The only fault would be that the video would occasionally drop but solved by a quick recall.
For the first week or so, I would walk over to the co-working space to turn the PC before each stream. As you could imagine, I got bored of this pretty quickly and was looking for ways to be able to flip the switch remote.
The search brought up products like smart home button pushers or home solutions such as using a Raspberry Pi as the switch itself to close the circuit via the GPIO pins.
In the end, I enabled WakeOnLan on the PC and used an always on Raspberry Pi connected to the same network. I logged into the Pi using SSH via VPN and used it to send a magic packet to wake the PC.
The final concern was from a security point of view. As the PC was going to be left in a hot desking, shared space, I was worried that someone could just simply pick up the PC and leave.
As I didn’t want someone to easily game access to my home network, I didn’t store the home VPN credentials on the device.
I ended up using Hamachi Mesh VPN for both the Pi and on startup of the PC. This allowed me to have an extra layer of security, so that if either the Pi or PC was stolen, I could just remove the accounts that they use from the VPN group.
Once the PC was started, I could then remote in and connect to the home VPN for better latency. It’s an extra step during the stream startup process but the peace of mind is worth it.
And finally, I was done! I had a setup where I could stream and manage the PC remotely and even better, no one was the wiser when viewing the stream.
These days, it is now a lot easier to create a similar setup. Parsec now provides a similar remote desktop experience to NoMachine but doesn’t need a direct connection so the home VPN setup is no longer needed and reduces the complexity.
The two major downsides are that it doesn’t capture the keyboard input completely but it comes close enough that I’m now using it over NoMachine when possible.
The second is that it isn’t installed as a service unlike TeamViewer or NoMachine. This means that unless it is running on an account that it is logged in, the PC is not accessible.
On top of this, you can now rent a decent spec gaming PC in the cloud to remote desktop into which would have solved my need for the co-working space.
Thankfully, I have since moved house to somewhere that has a much faster connection that I wouldn’t have to go through this again if I took up streaming again.
So as happy as I was to persevere and find a solution to all of this, I’m much happier knowing that I can now just stream at flip of a switch 😁.