Streaming your games is nothing new, in the past we have streamed games from our gaming PC to a Raspberry Pi via Steam Link and Stadia (RIP). But, using Sunshine, a self-hosted game streaming service, we can stream any of our games to a compatible device.
In this how-to we will use a Raspberry Pi 4 4GB running Moonlight, an open-source Nvidia gamestream client to stream AAA games from our gaming PC.
For The Project You Will Need
- Raspberry Pi 4 4GB (2GB should be fine)
- Gaming PC
- Ethernet connection for PC and Pi
- Game Controller (USB or Bluetooth)
How To Install Sunshine on a Windows PC
Sunshine is a self-hosted game streaming server for Moonlight. It provides low latency streaming services and supports AMD, Nvidia and Intel GPU hardware encoding. It works with many of your games and launchers, giving you a games console-like experience.
Installation is simple, as is adding games from your many libraries.
1. Download the latest installer for your OS. You can find the latest release under Assets. If yours is not listed, click on “Show all assets”. We chose sunshine-windows-installer.exe for our Windows 10 machine.
2. Double click the installer and follow the instructions. You may see a “Windows protected your PC” dialog, if so click More Info and allow the installation. Use the default installation settings, and when complete, Sunshine will open the browser to the documentation page. Bookmark this page.
3. Select Sunshine from the Start menu. This will start a background service and the command prompt will show the current status. Make a note of the URL, if one appears.
4. Open the URL in a browser. In our case it was https://localhost:47990/.
5. Set the username and password. Make a note of the details as they are needed to login to the Sunshine service.
6. Enter your username and password to login to Sunshine.
7. Select Applications from the menu. The Applications menu is where we can create Moonlight launchers for our games.
8. Click on + Add New to create a new game launcher.
9. Give the application a name and, under Detached Commands, enter the full path to the game and click + to save. We prefixed cmd.exe /c to the command so that it spawns a command prompt. We are pointing the launcher to the shortcut file as it will call the GoG launcher and any other required applications. Adding the path and command requires a little trial and error. Some games will want a command prompt, others not.
10. Set the working directory to the required location. We used the details stored in the Cyberpunk 2077 shortcut but this will vary depending on the game.
11. Click on Find Cover to source a thumbnail, select the thumbnail and then click Save.
The game has now been added to the Applications library and now our attention shifts to setting up Moonlight on a Raspberry Pi 4.
How To Install Moonlight on Raspberry Pi 4
Moonlight is the application on our Raspberry Pi which will stream our games. It establishes a connection with the PC running Sunshine and streams games across the network. Installing Moonlight is relatively straightforward and in use it is even simpler.
1. Connect your Raspberry Pi to the same network as your PC running Sunshine. Ethernet is the best option, it provides a solid and dependable connection, 5 GHz Wi-Fi offers a compromise of fast connections, but no wires.
2. Plug in a game controller. We chose to use USB but a Bluetooth controller can also be used.
3. Open a Terminal and update and then upgrade the software on your Raspberry Pi. The update command will check our local list of repositories against a remote server. Any changes are updated to our local list. Then, we use that list to upgrade the software on the Raspberry Pi. This step can take some time, depending on your connection speed and the number of updates.
sudo apt update && sudo apt upgrade -y
4. Download and install Moonlight. This package will download Moonlight and a QT based GUI.
sudo apt install moonlight-qt
5. Go to the main Raspberry Pi menu, select Games >> Moonlight. This will open Moonlight, and it will start searching for a server. It should automatically detect the Sunshine server running on your network.
6. Select the server to connect. Moonlight should auto-detect the Sunshine server. If not, click on the + icon in the top right and enter the IP address for the server.
7. Select your game from the list. This will trigger the game to start on the gaming PC. If you are playing with a controller, in our case an Xbox One controller, to exit a game press the View button, Share button left and right bumpers together. Keyboard users, press SHIFT+CTRL+ALT+Q to exit.
8. Settings options are found via the cog menu. Here you can change the streaming resolution, display mode (fullscreen is best) and under Advanced Settings force the Raspberry Pi to use hardware decoding.
Now you have everything you need to stream and play your games library from the comfort of your sofa.