Sunshine and Moonlight: Building a Self-Hosted Cloud Gaming Setup

Sunshine and Moonlight let you stream games from your own computer to a laptop, phone, or other client device. Sunshine runs on the host PC; Moonlight connects from the client. Together, they can turn a powerful desktop into a personal cloud-gaming system—or a remote desktop—with support for controllers and, on a well-tuned network, a responsive play experience.


The hardware behind the setup

This kind of streaming benefits from capable hardware and a reliable network. My main host is a Windows PC with a Ryzen 7 5800X, 32GB of RAM, an RTX 5070 with 12GB of VRAM, 3TB of NVMe storage, and a wired 2.5GbE connection. The host’s measured network speed is about 1.1Gbps. Over Wi-Fi, I see roughly 460Mbps downstream, while the host’s upload speed ranges from 35 to 45Mbps. That’s short of the 300Mbps upload I’d like, but it’s been enough for this setup.

I’ve also run Sunshine on an M2 Pro MacBook Pro with 16GB of memory and a 512GB SSD. The 10-core CPU/14-core GPU model worked well as a remote Mac, including for sending iMessages while using Windows or Linux on another device. The key was keeping the MacBook docked and running in clamshell mode, much like a Mac mini.

The clients and displays

I’ve tested Moonlight on three devices: the M2 Pro MacBook Pro with its 120Hz display, a Dell Latitude 5420 with an 11th-generation Intel Core i5 and a 60Hz, 720p panel, and an iPhone 17 Pro Max with an OLED 120Hz display.

Refresh rate matters because a display can’t show more frames per second than its refresh rate. A 60Hz screen is a natural fit for gaming at up to 60fps; to see the benefit of 120fps or 144fps, you’ll need a display that supports those refresh rates. Streaming at a higher frame rate than the display can show won’t make the experience look smoother, and can contribute to visual artifacts.

My desktop setup includes a 4K, 160Hz display that can reach 320Hz at 1080p, as well as a 1440p, 240Hz panel. The RTX 5070 can run games at 4K, but high frame rates depend on the title and settings. Battlefield 6 is the one game where I’ve managed to exceed 100fps at 4K, using DLSS. In my experience, I prefer DLSS to AMD’s FSR, though image quality can vary by game and settings.

DLSS renders a game internally at a lower resolution, then uses upscaling to produce an image at the selected output resolution. Some DLSS modes can also generate additional frames. The result can be a smoother, higher-resolution presentation than the GPU could manage by rendering every frame natively.

Streaming around the house

With Sunshine configured, I can connect any of my three Moonlight clients to the RTX 5070 PC in my office. Both laptops have HDMI 2.0 output and work with my 4K, 60Hz Samsung TV. At 70 inches, it’s a great option for single-player, story-driven games.

The MacBook and iPhone can receive streams at up to 120fps over my local network. With the host wired and the client devices on Wi-Fi 6, I haven’t noticed meaningful lag or latency. The iPhone can handle a 4K, 120fps stream, although 1440p at 120fps performs better in my testing.

Controllers

I use three GameSir controllers, each connected a different way: the G7 Pro connects via its USB dongle to Windows or Linux; the G8 Galileo connects to my iPhone over USB-C; and the G8 Plus pairs with my MacBook Pro over Bluetooth.

The Settings

The Settings

The first time you open Sunshine’s web interface, you’ll create a username and password. Once you sign in, six tabs run across the top of the page. From left to right, they’re Home, PIN, Applications, Featured Apps, Configuration, and Troubleshooting.

Home - Sunshine’s landing page shows the installed version, links to the LizardByte website, documentation, Discord, and GitHub Discussions, and includes legal notices.

PIN - This is where you pair a new Moonlight client. Select your host PC in Moonlight to get a four-digit PIN, then open the PIN tab in Sunshine, enter the code, and give the device a name. Sunshine displays a success message once the client is paired.

Applications - This tab controls what appears in Moonlight’s launcher. My setup has three entries. Desktop streams my Windows 11 desktop, Playnite brings my games together in one library, and my Steam entry opens Big Picture mode so I can browse and launch Steam games with a controller.

Featured Apps - This tab links to Moonlight clients and other tools you can use with Sunshine.

Configuration - This is where you tune everything from controller input to video encoding. The search bar helps you jump to a specific setting.

Troubleshooting - Start here when a stream misbehaves. Sunshine’s logs give you a place to look for warnings and errors.

Configuration Setup

General

Locale: English
Sunshine Name: Your server’s name
Log Level: Info

Input

Enable Gamepad Input: Checked
Windows Gamepad Drivers: All Available Drivers
Emulated Gamepad Type: Automatic
Next four options: Checked
Home/Guide Button Timeout: -1
Enable Keyboard Input: Checked
Key Repeat Delay: 500
Key Repeat Frequency: 24.9
Next two options: Checked
Last three options: Checked

Audio/Video

Audio Sink: Default
Virtual Sink: Default
Install Steam Audio Drivers: Checked
Stream Audio: Checked

Adapter Name: Blank (automatic selection). Sunshine uses the default graphics adapter when this field is blank. Radeon RX 580 is the example name, which explains why I see it here with an RTX 5070 installed.
Display ID: Default

Advanced Display Options:
Device Configuration: Activate the display automatically
Resolution: Use resolution provided by the client (default)
Refresh rate: Use FPS value provided by the client (default)
HDR: Switch on/off the HDR mode as requested by the client (default)
High-contrast workaround for HDR: 0
Config revert delay: 3000
Config revert on disconnect: Unchecked

Maximum Bitrate
150,000 Kbps

Minimum FPS Target
120

Letting Moonlight request the resolution and refresh rate gives each client its own settings. I use a lower resolution on my iPhone than on my MacBook Pro, and I go below 1920 × 1080 on my Linux client. Sunshine can switch the Windows host display to a supported mode for each session. For automatic resolution switching, enable Optimize game settings in Moonlight.

I set Sunshine’s maximum bitrate to 150 Mbps and request 80–100 Mbps in Moonlight for 1440p at 120 fps at home. I dial that back for lower-resolution streams. Sunshine’s setting is a ceiling. Moonlight sets the requested bitrate. For streaming at home, the connection between the host and client matters more than my 1.1 Gbps internet plan. Fast.com measures internet speed. To see how the local connection handles an actual stream, check Moonlight’s performance statistics for frames dropped by the network. When streaming away from home, the host’s upload speed also matters.

I set the minimum FPS target to 120 on my setup. This controls how often Sunshine sends frames when the picture is static or the game is rendering slowly. Sunshine can repeat frames to keep the stream cadence up. If you mainly stream at 60 fps, you can set the target to 60 or leave it at the default of 0, which targets half the frame rate requested by Moonlight.

Network

I leave this tab at its defaults.

Config Files

I leave this tab alone.

Advanced

FEC Percentage: 20
Quantization Parameter: 28
Minimum CPU Thread Count: 6

  • My CPU has 8 cores and 16 threads. The value above applies to CPU-based encoding. My RTX 5070 handles encoding through NVENC.
    HEVC Support: Sunshine advertises HEVC support based on encoder capabilities (recommended)
    AV1 Support: Sunshine advertises AV1 support based on encoder capabilities (recommended)
    Force a Specific Capture Method: Autodetect
    Force a Specific Encoder: Autodetect
  • If you’re using software encoding, CPUID’s free CPU-Z utility can help you check your processor’s core and thread counts. Start with Sunshine’s default of two encoding threads and increase it only if your CPU struggles to keep up at your chosen streaming settings.

Encoders

Nvidia Encoder

My GeForce RTX 5070 uses NVIDIA’s NVENC hardware encoder, so this is the encoder tab I tune. I use P5, which trades some encoding speed for better compression at a given bitrate.

Performance Preset: P5
Split Frame Encoding: Driver decides (default)
Two-Pass Mode: Quarter resolution (faster, default)
Spatial AQ: Unchecked
Single-Frame VBV/HRD Percentage Increase: 0

VBV/HRD - Miscellaneous options

On my setup, I check the first three boxes and leave the fourth unchecked.

Sunshine also offers these encoder options.

Intel Quick Sync Encoder: Hardware encoding for compatible Intel graphics

AMD AMF Encoder: Hardware encoding for compatible AMD graphics

Software Encoder: CPU-based encoding when hardware encoding is unavailable

Sunshine and Moonlight make a good case for running your own gaming cloud, especially if you already have a capable PC. You’ll do some of the work a hosted service would handle for you, from pairing devices to finding the bitrate your network can sustain. In return, you get to stream the library you’ve built on the hardware you already own. My experience makes the strongest case for streaming at home, where a wired host and a good Wi-Fi connection gave me responsive play. Away from home, my 35–45 Mbps upload connection sets a tighter limit on what I can stream.

What sold me on the setup was how quickly the novelty wore off. The old Dell, the iPhone, and the living-room TV each gave me a different way to play, and after a while I stopped thinking of any of them as streaming clients. They were just places I could play my PC games. The desktop stayed in the office. My library went with me.

Comments