Rubylight Download 7.0.3
On this page
  1. Quick start
  2. Background streams
  3. Installing Nucleus Co-op
  4. How a session starts
  5. Playing co-op
  6. Limits

Co-op and background streaming #

Rubylight docs › Play together · Background streaming · Features

Rubylight can run a game through Nucleus Co-op, the split-screen launcher. Nucleus Co-op starts a separate instance of the game for each player, and Rubylight streams each instance's window, sound and controller to its own device. This enables two modes:

Quick start #

  1. At the PC, as an administrator: download Nucleus Co-op 2.4.2, unblock the zip (right-click it, Properties, tick Unblock) and unpack it into a folder under C:\Program Files (Windows asks once for administrator rights). In the console, open Games, select the game and, under Play together, choose that folder and select Use this folder. Rubylight checks it and downloads nothing itself.
  2. If the game has no Nucleus Co-op handler yet, the panel offers Open Nucleus Co-op on this PC. Search the handler hub for the game there, download the handler and add the game; the panel moves on by itself once the handler is present.
  3. When the panel shows how many players the game seats, start the game's (Co-op) entry from Nightjar or Moonlight on each device. Each device that starts it joins as the next player.
  4. Home shows the running session: who plays in which slot, a player who stepped away and keeps the slot for two minutes, and a Let … join button for each paired device that may not join yet.

The Play together panel once co-op is ready: up to 2 players, start the game's Co-op entry from Nightjar or Moonlight, and a switch that shows the entry in the library.

A running co-op game on Home: Player 1 on Living room PC playing, Player 2 on Retroid Pocket 5 away and keeping the slot for 1:24, two free slots, and Let Bedroom TV join.

Co-op and background streams need the host to run as the Windows service (the installer's default), because Nucleus Co-op runs as the signed-in user; a portable host refuses these launches and says why. They accept controllers only. Co-op, hub handlers and games that need administrator rights also need a Windows administrator account that Windows elevates; Without administrator rights lists what runs on other accounts. When a device takes a seat (a background stream or a co-op slot), the PC shows a notice, "<device> started playing <app>.", once per seat: a reconnect to the same seat shows nothing. The sections below describe each step in detail, and the hardware matrix records the tested configurations.

Background streams #

Nucleus Co-op is the only background mode: there is nothing to choose. A device asks for a background stream as before: Devices → (device) → Play in the background (background_stream) or Games → (game) → Behavior → Stream in the background (background-stream). Either one runs the app as a Nucleus Co-op session of its own with one player, and the host log says once that background streams run through Nucleus Co-op. Only the device that started it can return to it; nobody else can join a background stream.

The stream carries only the game's sound (Game-only audio). The game plays on a virtual playback device, so it stays off the PC's speakers even when the device asks to play audio on the PC; that setting still applies to the device's normal streams. Without a virtual playback device the game stays audible on the PC and the stream warns.

Quitting the game on the device ends the background stream, also after its stream already ended: Moonlight's Quit (/cancel) and Nightjar's Quit (Close game where the device has host control) stop Nucleus Co-op and the game instead of keeping its slot for 120 s. A device that returns to a background stream whose game window doesn't come back within 90 s (the game minimised or lost it) gets the reason, and the session ends, so the next background launch isn't refused while the game runs on unseen.

A background launch that Nucleus Co-op cannot run is refused with the reason, for example "Store Game can't stream in the background: Nucleus Co-op starts games by their .exe, and Store Game does not name one: set the app's command to the game's .exe". It never falls back to streaming the PC's monitors.

Games without a handler #

A background stream needs no handler from the hub. A game you added at that exact path with a hub handler always uses it, and co-op still needs one. Otherwise, in Nucleus Co-op's folder, the host writes its own one-player handler into Nucleus Co-op's handlers folder (Rubylight-<game>-<hash>.js) and adds the game to Nucleus Co-op's game list (content\userprofile.json in its folder, the only one 2.4.2 reads), as Nucleus' own "add game" would, and to the game list of the user's own copy when the game runs from there (Without administrator rights). It does that only while Nucleus Co-op isn't running, and never over a file it did not write. Earlier Rubylight versions added the game to %APPDATA%\Nucleus Coop\userprofile.json instead, which Nucleus Co-op never reads, so it showed no game and the stream hung at its start (#59); the host removes those entries, and only those, from that file.

Installing a hub handler for the same .exe doesn't remove the host's handler right away: the next Nucleus Co-op session of another game removes it and its entry, so Nucleus Co-op lets you add the game with the hub's handler. That session also removes a handler the host wrote for you that no game in your list uses. The handlers folder is shared by every Windows account and each account's list is its own, so a handler written for another account, or by an earlier version, stays. The host only ever removes its own files and entries. One it can't remove shows as a warning on the stream and is tried again next time; an entry whose handler is gone does no harm, as Nucleus Co-op leaves it out when it loads the list. Another game with an .exe of the same name (Portal's and Half-Life 2's hl2.exe) still streams with the host's handler, written again for each of its sessions.

The game runs from its own folder: nothing is copied, linked or written there, and Nucleus Co-op needs no extra tools for it. Its window keeps running and reading the pad without focus. It doesn't move the PC's cursor, and its window messages carry no keys, clicks, wheel or cursor positions from the PC's keyboard and mouse, even when it comes to the front. A game whose .exe imports DirectInput (dinput8.dll or dinput.dll, read as the signed-in user), which reads the keyboard through raw input, gets its raw input from ProtoInput, which passes on only the slot's keyboard and mouse, and a pad's slot has none. Other games keep their raw input: ProtoInput would pass on no pad's raw input either, and a game reading its pad that way (SDL, Rewired) would lose it, so such a game can still see the PC's keyboard through raw input. The host still keeps the window off the PC's monitors. An Unreal Engine game (its .exe in <Project>\Binaries\Win64, Win32 or WinGDK) starts with -windowed at the stream's resolution (-ResX, -ResY, and -ForceRes so a window larger than the PC's monitor keeps its size), unless the app's arguments already choose a mode or a resolution, so it stays in its window beside the desktop instead of covering the PC's monitor and fills the client's screen. A game window with a title bar or sizing border loses it, so the stream shows the game alone; a window that doesn't respond keeps it until it does.

Nucleus Co-op ends a game it can't inject ProtoInput's input hooks into. A game that refuses them gets them another way at its next start: into the running game first, then as Nucleus Co-op starts it, then from one of the game's own threads, and last none at all. Without hooks a keyboard, mouse or controller on the PC can reach the game too, and the host log says so. The host keeps which way each game gets in Rubylight-injection-2.json in Nucleus Co-op's folder; if that file can't be read, the launch says so: delete it to start over.

Without administrator rights #

A background stream with Rubylight's own handler runs Nucleus Co-op as the signed-in user, without administrator rights, unless the game needs them. That holds on an administrator account too. It runs from the user's own copy of Nucleus Co-op in a folder below C:\ProgramData\Butterpollo\nucleus-user\<SID>, which the host copies from Nucleus Co-op's folder, once Nucleus Co-op is closed, without its settings, logs, game list and game data, and copies again, into a new folder, when a program file changes on either side. Only the files of the pinned 2.4.2 release are copied; anything else in that folder stays there. The copy is needed because the folder Nucleus Co-op runs from elevated may only be changed by administrators, and the user's Nucleus Co-op writes its settings and logs next to its program. The copy starts from Nucleus Co-op's own default settings, never another account's nicknames or Steam IDs. Its handlers are the elevated one's hub handlers and Rubylight's handler for the game launched, never Rubylight's handlers for other games or other accounts. The host starts it only as the account whose copy it checked, and an elevated Nucleus Co-op only as the signed-in account itself, never as the separate administrator of Windows' Administrator protection. Everything Rubylight writes in the copy (its game list, its Settings.ini and the session's profile) it writes as the user, and the copy keeps the session's settings: nothing there is put back as SYSTEM. Only SYSTEM and Administrators can change the folders above it; the user can only list <SID>, and can change only what is inside their own copy, never move or delete the copy's folder. While Nucleus Co-op starts, the host holds the copy's folder and NucleusCoop.exe open so neither can be made a link or replaced, and starts it only when the program opened in that folder.

A game needs administrator rights when:

Such a game runs elevated, as before. So do hub handlers and co-op, always. The Play together panel says which way a background stream of the game runs.

On a standard account, or with Windows' Administrator protection on, a game that needs none of that now streams in the background. A game that needs administrator rights is still refused there, and so is a game with a hub handler, for co-op and background streams alike: the Play together panel says so before you launch. On a standard account it says to sign in to Windows on this PC as an administrator. Under Administrator protection it says that the protection keeps administrator rights from Rubylight, so the game can't run on this PC, and that games Rubylight adds itself still stream if they need no administrator rights. Rubylight never asks you to turn a Windows security feature off. It tells the two apart by the signed-in user's token: Administrator protection elevates an administrator only into a separate account, which Rubylight never starts Nucleus Co-op as. Open Nucleus Co-op on this PC also needs an account Windows elevates; the panel says so before you press it, in the same words.

A background_mode line that an earlier build wrote (auto, child_session or virtual_display) becomes nucleus, and the host log says so once. A value that is no mode at all refuses background launches and says why.

Background streaming in a Windows child session was removed: Windows signs a child session in only with a Windows password, and a Microsoft account that uses only Windows Hello has none. On a PC where a development build set it up, the host puts the Windows settings back at its start and deletes the password that build saved; if that fails, Troubleshoot (under Advanced in the console's sidebar) says why and offers Restore again.

Installing Nucleus Co-op #

Rubylight downloads nothing. Download Nucleus Co-op 2.4.2 (NucleusApp.zip) from its release page, which a game's Play together panel and the Nucleus Co-op panel under Advanced → Troubleshoot link to. Setting it up needs an administrator at the PC:

  1. Unblock the zip before extracting it: right-click NucleusApp.zip, choose Properties, tick Unblock and select OK. Files unpacked from a zip that still carries the browser's Mark of the Web are refused.
  2. Unpack it into a folder under C:\Program Files. Windows asks once for administrator rights (one UAC prompt) to write there.
  3. Choose that folder on either panel (type it or Browse) and select Use this folder.

The host checks the folder before it keeps it as nucleus_path, and refuses it with the reason, saving nothing, when:

Forget this folder on either panel clears nucleus_path. Neither it nor Use this folder works while a co-op or background session runs: end the session first.

The panels show the state with the host's reason. Saving the folder under Settings checks it the same way and refuses the whole save with the reason. A nucleus_path written into sunshine.conf by hand is checked at each launch: while Nucleus Co-op isn't set up, or its folder is refused, co-op and background launches answer 503 and Open Nucleus Co-op on this PC is refused, each with the reason. Sessions turn Nucleus Co-op's own folder check off, but the window Open Nucleus Co-op on this PC opens may warn about a folder under C:\Program Files; that warning doesn't apply here.

Earlier Rubylight versions downloaded Nucleus Co-op into C:\ProgramData\Butterpollo\nucleus\2.4.2. With no folder chosen, that install keeps working (the Nucleus Co-op panel under Advanced → Troubleshoot shows it as Earlier install); choosing a folder takes over from it. A folder kept as nucleus_path that isn't 2.4.2 (one an earlier version allowed) falls back to that install while it exists: the panels say so and offer to choose another folder. Games added in Nucleus Co-op stay in the copy they were added in, so add them again after moving to a new folder. Nucleus Co-op's handler hub view is a WebView2 browser, which runs without administrator rights, so its data lives in the signed-in user's AppData\Local\Butterpollo\nucleus-webview.

Nucleus Co-op launches a game through its handler for that game. Handlers come from Nucleus Co-op's handler hub and are your own content: Rubylight ships none. When a game has none, its Play together panel says so: Open Nucleus Co-op on this PC opens Nucleus Co-op on the PC's screen, where you search its handler hub for the game, download the handler and add the game. The panel moves on by itself once the handler is there. Close Nucleus Co-op beside it closes that window again, and the next co-op or background stream closes it by itself first; if it won't close (it is asking you something), the stream is refused until you answer it at the PC. Only Nucleus Co-op itself is closed: what it started (a browser, a game) is left alone. A Nucleus Co-op you started yourself is never closed: Open and launches are refused while it runs. Co-op in a game without a handler is refused with "No Nucleus Co-op handler for <exe>: add one in Nucleus Co-op's handler hub"; a background stream of it uses Rubylight's own handler (Games without a handler).

How a session starts #

Rubylight writes a Nucleus profile named Rubylight for each session and loads it. For that it sets a few of Nucleus Co-op's settings: pads by XInput index and game profiles on, which stay, and, for the session only, no install-folder check at its start (it warns about a Documents folder in OneDrive), no reminder of the End key, and no favourites-only or game-type filter on its list. In the user's own copy (Without administrator rights) the session's values stay. Otherwise your own values of those come back when the session ends, or after a host crash when the service starts it again; a value you or Nucleus Co-op changed meanwhile stays, and a Settings.ini deleted meanwhile has nothing to put back. While a session starts or runs, the service leaves its values alone. Keys missing from Settings.ini, or the whole file, are filled in from Nucleus Co-op 2.4.2's own defaults. A Settings.ini saved as UTF-16 (Unicode) text is never edited: the launch says to save it as ANSI or delete it.

A start that times out says what Nucleus Co-op shows instead: a message on the PC's screen, from Nucleus Co-op or from Windows on its behalf, before or after the click on the profile (answer or fix it there; a box Windows showed for another program before the launch doesn't count), that it doesn't list the game (naming the game list it reads), no profile Rubylight (open Nucleus Co-op and load the profile Rubylight once, then launch again), that it still shows its setup screen with the profile Rubylight (Nucleus Co-op shows Play, or with auto-play starts the game, once every player has a controller there), that the press of Play failed (and why, such as a window that kept covering it) or started nothing, or no window at all, with the last error from its crashlog.txt if it wrote one (in the user's own copy, read as the user). The host clicks the profile without moving the mouse or taking the focus. Nucleus Co-op only takes a click on the window it shows at that point, so when another window covers its list (your game, or a game you stream), the host raises Nucleus Co-op above every window for the click, never activating it, and puts it back below that window right after; a window that stays on top even then fails the click, and the start says so. Nucleus Co-op 2.4.2 finds the PC's screens for its setup screen on a 3 s timer, and a click before that fails with "The profile can't be loaded", so the first click waits until it has listed the profile for 3.5 s. That message comes in Nucleus Co-op's own untitled box, which draws its text (so the log can only name it, not quote it) and blocks its window until someone closes it. So after the click, until a game instance runs, the host closes a box like that (logging what it says) and clicks the profile again every 5 seconds while Nucleus Co-op still lists it and shows no message box. Once Nucleus Co-op hides the list to play the profile, it is never clicked again. When the last click ends in such a box, the start fails saying so.

The host then presses Nucleus Co-op's Play once, without moving the mouse and in the same way as the click on the profile. The profile has Nucleus Co-op's auto-play off, because auto-play runs from the setup screen's paint and can start the game a second time during a start, which kills the first one (#59). Nucleus Co-op shows Play only once every player of the profile has a controller, on the options step if the handler has options, so the press waits until Play is shown and enabled. A handler with steps of its own (Game.ShowOptionAsStep, Game.CustomSteps) shows no Play until someone answers them, so its profile keeps auto-play and can still start twice.

Playing co-op #

Each app whose game has a handler gets a second library entry, <app> (Co-op), which sorts next to the game. The game's Play together panel says how many players it seats and can hide the entry (Show "<app> (Co-op)" in the library, the app setting coop-entry). The first device that launches it starts a session with one slot per player: the handler's maximum, capped at 4 and at nucleus_coop_players (1 to 4, 4 by default). Every other device that launches the same entry joins the running session in a free slot. Any Moonlight client can join this way.

Joining a session that someone else started needs Can join co-op games (coop_join) on the device's page in the console. A device that never set it follows Launch apps, so every device with Play games joins. Joining launches the co-op entry, so a device without Launch apps (Watch only) never joins, and the console keeps the switch off for it and leaves it out of the invite list. An explicit off refuses the join with "This device may not join co-op games: turn on “Can join co-op games” for it in the Rubylight console". A device that holds a slot can go back to it while it may join; turning it off ends the device's stream and keeps it out. The device that started the session needs no permission to return. When a device's stream ends, its slot is held for 120 s so it can come back. A player's Quit ends only its own stream: the other players keep playing. Sessions list who plays only to devices that may join.

Home in the console shows each running co-op game as a card: its players, an away device's remaining 120 s, Remove (asks first) and End co-op (asks first). While a slot is free, the card lists the paired devices with Let <device> join for one that may not yet; a removed device is not offered again. A background stream gets a card too, with End stream only.

Nightjar lists the running co-op sessions on a PC with their free slots and this device's own seat: on Android under Join co-op in the PC's menu, on the desktop on the PC's details page. Join (or returning to your own seat) takes the slot and starts the stream. A refusal is shown with the PC's own words.

Ending a session stops Nucleus Co-op and every instance, and ends each player's stream. A session also ends when every player has left, when an instance crashes, or when its start fails. For a minute after, Home says which ended last and why, and the log keeps it. Nucleus Co-op's folder and why it can't run from it are in the Nucleus Co-op panel under Advanced → Troubleshoot.

Limits #

View this page on GitHub