> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How I Managed to Play AAA Games on Raspberry Pi
- URL: https://itsfoss.com/raspberry-pi-moonlight-setup/
- Published: 2024-12-09T13:00:25.000Z
- Updated: 2024-12-09T13:00:25.000Z
- Description: You can utilize your Raspberry Pi to experience games too, with a catch!
- Author: Abhishek Kumar
- Tags: Gaming 🎮, Raspberry Pi

Have you ever thought of running high-end AAA games on a Raspberry Pi? Absurd right? 

**Spoiler alert**: you can’t. Of course. 

But, you may ask — *what about the article's title?* 

In fairness, please note that I mentioned "Play" instead of "Run." That is the crucial aspect of my experiment 🤓

**You cannot run the game**, but what you *can* do is **stream those demanding games from a powerful PC to your Raspberry Pi** using [**Moonlight**](https://moonlight-stream.org/?ref=itsfoss.com), and it works like a charm!

![a screenshot of steam running via moonlight](https://itsfoss.com/content/images/2024/11/steam-game-library-inside-moonlight.jpg)

In this article, I’ll show you how I turned my humble Raspberry Pi 5 into a game-streaming powerhouse. 

Stick with me for a breakdown of every step you need to replicate this feat. And don’t worry—I’ll try keeping the technical jargon at bay. 

## What is Moonlight?

Picture this: your beastly gaming rig is upstairs, but your comfy couch (and bigger TV) is downstairs. 

Instead of running an HDMI cable across the house, you can use [Moonlight](https://moonlight-stream.org/?ref=itsfoss.com) to stream your games over your home network. Moonlight uses Nvidia’s [GameStream ](https://www.nvidia.com/en-us/support/gamestream/gamestream-pc-setup/?ref=itsfoss.com)technology to deliver smooth, high-definition, low-latency gameplay.

The Raspberry Pi, with its small form factor and affordable price, makes the perfect device for this setup. 

Whether you’re using a Raspberry Pi 4 or the newer Raspberry Pi 5, Moonlight can help you bring AAA gaming to the comfort of any room.

## What You’ll Need

Here’s the gear that I used for this project:

💡

A wired connection is highly recommended for both your Raspberry Pi and your PC for the best experience.

- **Raspberry Pi 4/5** (the more powerful, the better)
- **MicroSD Card** (16 GB or larger, for the OS)
- **Ethernet Cable** (for low latency)
- **USB Mouse and Keyboard**
- **Controller** (Xbox or PlayStation, optional but recommended)
- **A PC with a Compatible Nvidia GPU** (running [Sunshine](https://github.com/LizardByte/Sunshine?ref=itsfoss.com), an open-source GameStream host)

### Step 1: Preparing Your Raspberry Pi

📋

You should [install the official Raspberry Pi OS on your Pi](https://itsfoss.com/tutorial-how-to-install-raspberry-pi-os-raspbian-wheezy/) first.

Start by making sure your Raspberry Pi is updated. Open the terminal and run these commands:

```bash
sudo apt update && sudo apt full-upgrade -y
```

![updating and upgrading the raspberry pi](https://itsfoss.com/content/images/2024/11/updating-rpi.png)

You will need `curl` for downloading the repository and `pulseaudio` for audio support. Install them with:

```bash
sudo apt install curl pulseaudio
```

![installing curl and pusleaudio](https://itsfoss.com/content/images/2024/11/installing-curl-and-pulseaudio.png)

Set PulseAudio to start automatically when the Pi boots:

```bash
sudo systemctl --global enable pulseaudio
```

![now we need to enable pulseaudio to start automatically at startup](https://itsfoss.com/content/images/2024/11/enabling-pulseaudio-at-startup.png)

### Step 2: Installing Moonlight

Run the following command to add the Moonlight package repository:

```bash
curl -1sLf 'https://dl.cloudsmith.io/public/moonlight-game-streaming/moonlight-qt/setup.deb.sh' | distro=raspbian codename=$(lsb_release -cs) sudo -E bash

```

![adding moonlight repository](https://itsfoss.com/content/images/2024/11/adding-moonlight-repo.png)

Once the repository is added, install Moonlight with:

```bash
sudo apt install moonlight-qt
```

![installing moonlight using apt package manager](https://itsfoss.com/content/images/2024/11/installing-moonlight.png)

### Step 3: Configuring Moonlight

Edit the crontab file to launch Moonlight automatically when your Pi starts. This way, you get a seamless experience.

```bash
crontab -e

```

![editing crontab with nano to add moonlight](https://itsfoss.com/content/images/2024/11/editing-crontab-2.png)

Add this line at the end of the file:

```bash
@reboot moonlight-qt
```

![adding moonlight startup record in the crontab file ](https://itsfoss.com/content/images/2024/11/crontab-adding-reboot-tag.png)

Reboot your Pi to apply the changes:

```bash
sudo reboot now
```

### Step 4: Pairing Moonlight with your PC

Download and install[ Sunshine](https://app.lizardbyte.dev/Sunshine/?lng=en&ref=itsfoss.com), an open-source GameStream server, on your PC. This is essential for pairing with Moonlight.

![github release page to download the sunshine exe](https://itsfoss.com/content/images/2024/11/sunshine-github-release.png)

Once installed, it will redirect you to a browser window, where you need to set up a user first before you can access anything:

![creating a use to access sunshine](https://itsfoss.com/content/images/2024/11/sunshine-setting-up-user.png)

Once done, you are ready to launch Moonlight on your Raspberry Pi.

💡

If your PC doesn’t appear automatically, click the ****+** icon and manually enter your PC’s IP address.

![starting moonlight in raspberry pi from the main menu](https://itsfoss.com/content/images/2024/11/launching-moonlight-first-time-1.png)

You’ll be prompted with a PIN code. Enter this PIN in the Sunshine web interface on your PC to complete the pairing.

![pin prompt in moonlight](https://itsfoss.com/content/images/2024/11/moonlight-pin.png)

You need to enter this PIN here in the Sunshine web UI:

![adding the moonlight pin in the sunshine webui](https://itsfoss.com/content/images/2024/11/sunshine-adding-pin.png)

Sunshine should automatically add the desktop to stream, but you can manually use Sunshine’s web interface to add specific applications, the desktop, or games to the list of streamable apps.

![applications add or remove to access via moonlight in raspberry pi ](https://itsfoss.com/content/images/2024/11/sunshine-device-functionality.png)

### Step 5: Start Streaming!

With everything set up, you can now stream games to your Raspberry Pi. Connect your controller, choose a game from the Moonlight interface, and enjoy the magic of high-performance gaming on your Pi.

If you are wondering the input lag and poor framerate, that's all because I tested this whole setup on Wi-Fi just for the tutorial. Unlike me, you are smart and will use a wired connection.

## Final Thoughts

Running AAA games directly on a Raspberry Pi is not an ideal thought because of what it's built for. Thanks to Moonlight, you can stream games effortlessly on your Raspberry Pi, so it is always useful in one way or the other.

With a bit of preparation, your Raspberry Pi can transform into a versatile gaming client, letting you enjoy PC-quality gaming anywhere in your home.

*💭 Have questions or tips of your own? Drop them in the comments below, I’d love to hear from you!*

Happy streaming! 🎮