Moonlight is a client that lets you stream games from a PC with Steam to your Batocera box. It's a game streaming software similar to Steam Link, a piece of hardware that was discontinued in 2018 and that now lives as an Android/iPhone app.

This page is valid for Batocera 5.26+ only (there was a change in recent NVidia protocol that makes earlier versions not compatible any longer).

These are the PC side prerequisites to enable Moonlight to fetch and stream your games:

  • Nvidia GeForce GTX/RTX 600+ series GPU
  • NVIDIA GeForce Experience (GFE) 2.1.1 or higher installed (Windows Desktop Only)
  • 720p or higher display (or headless display dongle) connected to the GeForce GPU.

If you are facing any issue, please take a look at the first topics inside Setup Guide at Moonlight wiki. They are focused on the installation at the PC site of this setup.

Moonlight requires a bit of manual configuration. In order to do that, you need to connect to your Batocera with SSH.

First, make sure your PC with Steam is up and running, and on the same local network as your Batocera.

On Batocera, run:

# batocera-moonlight list
Searching for server...
Connect to
Generating certificate...done
You must pair with the PC first

This command correctly discovered my PC running Steam, with its IP address, but tells me I need to pair with it. Let's do it:

# batocera-moonlight pair
Connect to
Please enter the following PIN on the target PC: 1234

The PIN 1234 is an example, you'll get a different PIN in your setup. You have to enter this PIN in the pop-up window of your PC running Steam, where it asks a PIN to connect a “SHIELD” device.

Once the PIN is entered on you Steam PC, you should see Succesfully paired on your Batocera terminal.

You can check that the connection is successful by typing moonlight list again in your Batocera terminal, you should now see the list of Steam games available.

We now need to build the list of games we want to reference. In order to do so, enter the command:

 # batocera-moonlight init
 Fetching games ...
 Game found: [game 1]
 Game found: [game 2]
 Scraping games ...
 Scraping [game 1]
 Scraping [game 2]

For each of the supported game in your Steam library, this script has now created /userdata/roms/moonlight/*.moonlight files, a gamelist.xml and might have scraped some metadata into /userdata/roms/moonlight/downloaded_images/ as well.

It also generated a list with all games available in /userdata/system/configs/moonlight/gamelist.txt.

The configuration directory for Moonlight is /userdata/system/config/moonlight/. The main configuration file there is moonlight.conf. Depending on your hardware configuration, you might want to tune the resolution, framerate or bitrate of the game streams.

You can also relaunch a new game scraping with the command batocera-moonlight scrape.

If you encounter the following error:

 Traceback (most recent call last):
   File "<string>", line 1, in <module>
 KeyError: ''

It can be safely ignored. It just means that Batocera couldn't get some data from theGamesDB, so there will be some metadata missing in your gamelist.xml. Your games are still likely to be listed, though.

Gamepad shortcuts:

  • Start+Select+L1+R1 - Quit session
  • Start - Open settings UI (when not streaming)
  • Start (press and hold) - Toggle mouse mode

Keyboard shortcuts:

  • Ctrl+Alt+Shift+Q - Quit session
  • Ctrl+Alt+Shift+X - Toggle windowed/full-screen
  • Ctrl+Alt+Shift+Z - Toggle mouse mode
  • Ctrl+Alt+Shift+S - Toggle performance stats overlay
  • emulators/moonlight.txt
  • Last modified: 10 months ago
  • by lbrpdx