Gaming
Desktop computers
Software
PC & Mobile technology
Tricks and tips
Lifestyle
18.01.2025 08:00

Share with others:

Share

How can you play games remotely with Moonlight and Sunshine?

Whether you play games on your console, PC, phone, or one of the newer handhelds like the Steam Deck or ROG Ally, why would you even consider remote gaming?
How can you play games remotely with Moonlight and Sunshine?

The simplest answer is because it's convenient and, in some cases, a much better experience. What's the biggest concern when playing games on your phone? Battery. If you're serious about mobile gaming, meaning you play them for at least an hour or two every day, then you know how quickly some games can drain your battery. It's even worse if you're running an emulator to play Switch, PlayStation, or similar games. There's no magic trick to extending your battery life while gaming. All you can do is lower the resolution, refresh rate, and other graphics settings. And that's just a patch.

You've heard of cloud gaming. You sign up for one of the subscriptions and let remote servers/computers do the heavy lifting for your device. In the case of phones, this means you don't have to worry about battery life because their only job is to display the image. If you have an old computer that hasn't been able to run newer games for a while and you don't have the money or the will to upgrade, cloud gaming is a good way to save money and still enjoy new games.

What if you want to take advantage of the portfolio of games you already own? That's possible too, and it's completely free. Moonlight and Sunshine are two open source applications that let you play your game collection anywhere, anytime, on any device. I'll use a computer and a phone as an example, but you can do the same on a TV, handheld (Steam Deck, ASUS ROG Ally, etc.), tablet, or similar device.

The apps can also be used for work, but they are designed for gaming by default. For work, I recommend checking out Parsec. A good alternative to Sunshine is Apollo, which even makes it easier to configure the resolution on different devices.

First we need to set up Sunshine

Sunshine is an open source application and one piece of the puzzle we'll need to configure remote gaming. It allows us to turn our computer into a server that will render games and stream them to any connected client. Configuration is easy if you follow the instructions.

  1. Go to the official Sunshine GitHub page and download the latest version. I used the portable version for this example (the app name is sunshine-windows-portable), but you can also use the desktop version.
  2. Extract the files from the folder and run sunshine.exe as an administrator.
  3. A command window will appear, at the very end of which you will find a link to the Sunshine user interface (see image).
  4. Copy the link (https://localhost:47990) into your browser, where you will create a username and password.
  5. The Sunshine app login and setup is complete.
    • If you are going to play with a controller, you will also need to install the ViGEmBus drivers.

If you forget your username and password, close all Sunshine processes. Go to the folder where you extracted Sunshine → Config → delete the sunshine_state.json file. This will also delete all connected devices and you will have to repeat the process from the beginning.

Alternatively, you can run cmd as administrator and type:

cd [location where Sunshine is located]

sunshine.exe –creds [new username] [new password]

Setting up the Moonlight app

We have now set up the host (computer), and with the Moonlight application we will be able to connect other devices (phone, TV, etc.) to the Sunshine server.

  1. You can download the Moonlight application from the GitHub page.
  2. For example, we have again downloaded the portable x86 version, but you can also choose the desktop version. An application for ARM systems is also available.
  3. Run it Moonlight.exe as an administrator. If the device where you have Moonlight installed and the Sunshine server (in this case, a computer) are on the same network, the server will automatically appear within Moonlight.

Now we need to connect the Moonlight and Sunshine applications via LAN or Wi-Fi.

  1. Inside the Moonlight application, click on the Sunshine server, which will be named as “DESKTOP-…”.
  2. You will get a notification where you will see a PIN code. Remember it and go back to the browser where you are connected to Sunshine. In the taskbar, click on the PIN section and type in the PIN code you received in the Moonlight application.
  3. Name the device and pair it with the Sunshine server. The lock symbol in Moonlight should now disappear.

Do the same on any device you want to play games on remotely. For our example, we installed Moonlight on a computer. If you want to install Moonlight on your phone, go to the Google Play Store (or any other store) and search for the Moonlight app. After downloading, you will be given a PIN code again, which you will enter in Sunshine to pair with the new device. On TVs, you will usually need to install the Moonlight app from a third-party source, and in some cases, you will also need to enable developer mode.

How to optimize settings for the best experience?

Now that you have Sunshine and Moonlight set up properly, we can start playing around with the settings. Connect to a remote server (your computer) through Moonlight and see how the default settings work.

If you are not satisfied with them or notice higher latency, go to the settings within the Moonlight app. You can change the resolution and refresh rate as desired, but be aware of the capabilities of your device and internet connection. You can also use the slider to adjust the video bitrate.

The next step is not necessary, but I recommend that you combine all your games into a single view. You usually have games installed across different platforms (Epic Games, Steam, GOG, Battle.net, EA, etc.) and accessing each platform can be unnecessarily cumbersome, especially remotely.

Download Playnite or a similar game management program (GOG Galaxy, etc.) and follow the installation instructions. During the installation process, you will be asked if you want to integrate popular gaming platforms (Steam, Epic Games, etc.) into the program. If you use them, connect your accounts. You can manually add games that you have installed outside of these platforms to Playnite.

Once you have your entire game collection integrated into Playnite, it's time to connect the program to Sunshine and Moonlight. Go back to Sunshine's settings and click on the section Applications and add a new program. Name it and set the location to launch Playnite (see image). I recommend choosing a program that will launch in full screen mode for better visibility.

When you're done, save your settings and Playnite will now be visible in Moonlight.

Would you like to play outside your home network?

Up until this point, we've limited our gaming to our home network, but I mentioned at the beginning that you can play games anywhere. Sunshine allows for this as well, but instead of using the settings provided by Sunshine, we'll use a VPN/SDN program, which is a more secure option.

I use ZeroTier, a good alternative is Tailscale. Download ZeroTier and install it on all devices where you will use Moonlight.

  1. Run the program and click on Join new networkA new window will appear, but leave it aside for a moment.
  2. Go to your browser and log in to your ZeroTier profile (my.zerotier.com) and create a new network.
  3. Click on the newly created network and select the option 10.147.17. Under the IPv6 section, uncheck all the boxes.
  4. Copy the network ID into the window that appeared at the beginning and connect. Do the same on the device you will be playing games on remotely.
  5. Go back to ZeroTier settings and authorize all connected devices on the network. Copy the number in the column Managed IPs and go to Moonlight. Manually add a new computer and paste the IP you copied.
  6. Now you can access your computer anywhere, even outside your home network.

If you would like to "lend" your server to others, such as a brother, sister, or friend, give them your IP and authorize their device in the ZeroTier settings.

Moonlight and Sunshine provide a completely different gaming experience

We often put games in fixed frames, but Moonlight and Sunshine break those frames. They allow you to create your own server and act as a kind of cloud gaming platform that only you own.

I've been using them for quite some time now and rarely have any problems. If you have a good internet connection, you'll have low latency and a stable connection at all times.


Interested in more from this topic?
Video games


What are others reading?