You already have RetroPie running nicely on your Raspberry Pi. It’s the perfect retrogaming experience for your living room TV, but there’s one thing missing. The Pi doesn’t have the horsepower for more recent games. How can you play the latest PC releases? Or perhaps you fancy some PlayStation 2, Gamecube or Dreamcast emulation on the big screen?
Moonlight fits the bill. It streams gameplay from your almighty PC to the RetroPie, allowing you to sit back on the couch and play games that need a bit more grunt
Here’s how to get it setup!
What you need
- Raspberry Pi with RetroPie installed. For best performance use a Raspberry Pi 3 Model B+
- Wi-Fi connection or (for best streaming performance) Ethernet cable
- USB keyboard. To edit config files on your Raspberry Pi. Alternatively you can do this from your networked PC via SSH. Find more details in this RetroPie guide
- A gaming PC with NVIDIA GeForce GTX/RTX 600+ series GPU (GT-series and AMD GPUs aren’t supported by NVIDIA GameStream) and NVIDIA GeForce Experience (GFE) 2.1.1 or higher installed
Connecting to your Pi
Many of the steps in this guide involve tinkering with RetroPie settings at the command line
Create a file named ssh
in the root directory of your SD Card. This way you can configure RetroPie from your networked PC, no keyboard required. Learn more here
With this feature enabled, you can use any SSH client (I like PuTTY) to remotely connect to your Pi. The default connection details:
- Hostname:
retropie
- Username:
pi
- Password:
raspberry
Alternatively, you can use a USB keyboard to configure Retropie directly
Install Moonlight on your Pi
Step 1. Update Sources
On your Pi:
-
Quit Emulation Station (hit the Start button and navigate to
Quit > Quit EmulationStation
) -
Update sources file
From the bash prompt, type sudo nano /etc/apt/sources.list
. This will launch the nano text editor. Add the following line at the bottom of the file:
Make sure there is a carriage return below at the bottom of the file. Then hit Ctrl+X then Y to save and exit
Step 2. Install GPG key
Still at the bash prompt, enter the following to fetch and install the GPG key for Moonlight:
Step 3. Install Moonlight
We’ll use apt-get to install Moonlight. Enter the following:
This should install Moonlight globally. In case anything goes wrong, you can find extra troubleshooting steps here
Connect Moonlight to your PC
Run the following command to pair Moonlight with your PC
For example:
You’ll be asked to enter key on your host PC. Enter that once and the RetroPie is paired forever
Optimize controller settings
If you’re using an Xbox 360 controller on the Pi, we need to manually change some controller settings. The xpad driver that RetroPie uses leads to weird effects in moonlight
Type the following in bash:
This (temporarily) unloads the xpad driver and disables the “triggers to buttons” feature - allowing you to use triggers properly when you stream games via Moonlight. We’ll need to revert this setting or reboot before we use Emulation Station again, since this setting will break retro gaming. Later on we’ll create a script to help here. Find more info on this issue here
Run a test stream
Enter the following at the command prompt:
For example:
All going well, the game should launch at 1080p, 60fps and be playable on your Pi! Great success!
Power up your Pi
If you have a slower Pi model, you may experience some lag when streaming at 1080p, 60fps. You can either lower the resolution or overclock your Pi:
This will open a text editor. Add the following at the bottom of the file:
Press Ctrl+X then Y to save and exit, the enter the following to reboot your Pi and apply the change:
Your streaming experience should now be lag free
Integrate with EmulationStation
We can launch Moonlight from the command line, but we’d much prefer to launch and stream games directly through the RetroPie EmulationStation interface. Luckily EmulationStation is very configurable. We can do this without too much hassle.
Step 1. Add a new System in EmulationStation
You need to add “Moonlight” as a new System before it’ll appear in the RetroPie navigation menu
-
Quit EmulationStation if it is open (hit the Start button and navigate to
Quit > Quit EmulationStation
) -
Create a copy of the ES config (the default one gets overwritten during ES updates and you don’t want that)
- Add a system to the custom config:
- Add this at the bottom, but before
</systemList>
:
Step 2. Register games with EmulationStation
You need to register each GameStream game you want to stream via a textfile:
Where MYGAMENAME
is the exact game name defined in GeForce Experience / Gamestream on your PC (e.g Forza Motorsport 6 Apex.txt
). Repeat this for each game you wish to stream via Moonlight
Step 3. Add Moonlight config and startup/shutdown scripts
- Create a config directory for Moonlight:
- Edit emulators.cfg config file:
- Add these two lines to the file. Replace
homePC
with the hostname or IP address you paired earlier:
- Create startup script for Moonlight games:
- Add the following content to the file:
- Create shutdown script for Moonlight games:
- Add the following content to the file. Again, replace
homePC
with the hostname or IP address you paired earlier:
Get streaming!
You’re good to go! Reboot your Pi via sudo reboot
and launch your streams direct from EmulationStation
To end a stream hit Select + Start + L1 + R1
. You’ll be returned to the EmulationStatio menu
Happy streaming!
Optional: create a custom theme for Moonlight
Want to show custom box art or metadata for your GameStream games? You’ll need to modify the EmulationStation them
-
Quit EmulationStation if it is open (hit the Start button and navigate to
Quit > Quit EmulationStation
) -
Create a copy of the default “carbon” theme - you don’t want to break it
- Follow this guide to modify the theme to your liking
FAQ
Can I stream Windows Store aka UWP games?
Some UWP are already “GameStream onboarded” by NVIDIA and will magically appear in GeForce Experience. Others must be added via the GameStream UI (it has native support for UWP)
Can I stream the Xbox Companion app from my Windows 10 PC to Play Xbox One games on my Pi?
Yes you can and it works surprisingly well. Although it’s better to do this via a single hop (i.e. direct to a Windows 10 machine or a Mac/iOS device via OneCast)
Troubleshooting
Help! The controller stopped working
I encountered this occasionally. Quit the stream (Select + Start + L1 + R1
) and try again
I can hear sound but no visuals?
If you hear sound but see a black screen when streaming, try connecting to your GameStream PC with another Moonlight client (e.g. PC or phone). This should fix the issue
Comments