← How-Tos
raspberry-pi 3 hr ago ◯ 4 min read

Streaming PC Games to a Raspberry Pi with Sunshine and Moonlight

Raspberry PiSunshineMoonlightgame streamingNVIDIA GameStream alternativelow-latency streamingHDMIremote play

This site's retro emulation guide covers running games directly on a Raspberry Pi with Batocera and RetroPie, which is the right approach for classic systems the Pi itself is powerful enough to emulate. Game streaming is a completely different idea aimed at a completely different problem: instead of emulating anything, a beefy gaming PC somewhere on the network does all the actual rendering, and the Pi just decodes an incoming video stream and forwards controller input back — effectively turning any TV with an HDMI port into a thin client for games the Pi could never run on its own, from modern AAA titles to full PC game libraries.

Sunshine and Moonlight, Not GeForce Experience

NVIDIA's GameStream service (the original host-side half of this idea) was discontinued, which is why the self-hosted combination of Sunshine (an open-source host that runs on the gaming PC) and Moonlight (the open-source client, available for the Pi, Android, iOS, and more) has become the standard way to do this without relying on a vendor's cloud service. Sunshine captures the PC's display and encodes it — ideally using the PC's GPU hardware encoder (NVENC on NVIDIA, AMF on AMD, Quick Sync on Intel) rather than software encoding, which keeps CPU load low and latency down — while Moonlight on the receiving end decodes the stream and sends back gamepad, keyboard, and mouse input over the same local network connection.

Setting Up the Host PC

Install Sunshine on the gaming PC (Windows or Linux both work; Windows has the most mature support) and run through its setup wizard, which generates a pairing PIN system for clients to connect securely. Confirm your GPU driver supports hardware encoding — virtually any GPU from the last several generations does — and set Sunshine's encoder preference explicitly to your GPU vendor's hardware path rather than leaving it on software/CPU encoding, since that's the difference between single-digit-millisecond encode latency and encode times that visibly add input lag. Wired Ethernet on the host PC is strongly preferred over Wi-Fi; a streaming session is sending a continuous high-bitrate video feed, and even a good Wi-Fi link introduces jitter that software-encoded or CPU-starved streams tolerate far worse than a clean wired connection.

Setting Up the Raspberry Pi Client

Moonlight has an official Raspberry Pi build (available via apt on recent Raspberry Pi OS, or as a Snap/Flatpak) that takes advantage of the Pi's hardware video decoder — this matters just as much on the receiving end as GPU encoding matters on the host, since a Pi trying to software-decode a 1080p60 or 4K stream will introduce its own latency and dropped frames. Pair the Pi with the host using the PIN shown in Sunshine's web interface, then connect a USB or Bluetooth game controller to the Pi directly; Moonlight forwards standard gamepad input transparently to most Windows games without additional configuration.

ComponentRoleHardware Requirement Host PCRuns Sunshine, does all actual game renderingGaming-capable GPU with hardware encoder (NVENC/AMF/QuickSync) Raspberry PiRuns Moonlight, decodes stream, forwards inputPi 4 or newer recommended for 1080p60; wired Ethernet strongly preferred NetworkCarries video stream + input, both directionsGigabit LAN ideal; Wi-Fi workable but adds jitter and latency variance ControllerInput device at the Pi endUSB or Bluetooth gamepad, most standard controllers supported

Tuning for Latency

Most of the "why does this feel laggy" complaints trace back to one of three things: software encoding on the host (fix by forcing hardware encode in Sunshine's config), a Wi-Fi hop somewhere in the path (fix with Ethernet, or at minimum a dedicated 5GHz/6GHz link with nothing else saturating it), or a bitrate setting mismatched to the actual network capacity, which causes the encoder to either starve detail or introduce encode delay compensating for dropped packets. Moonlight's in-session overlay (triggered by a key combo, documented per-platform) shows live decode time, network latency, and frame loss, which is the fastest way to tell which of those three is actually the bottleneck on a given setup rather than guessing.

Done well, this setup is close to indistinguishable from playing locally on a good network, and it turns a Raspberry Pi sitting under a TV into a window onto a full gaming PC's library without needing a console, a second gaming rig, or anything more powerful than what the Pi was already doing as a quiet, low-power media box.