Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #361 from MWillWallT/master
Browse files Browse the repository at this point in the history
Shift of Matchmaker and SFU pages to Infra
  • Loading branch information
mcottontensor committed Sep 13, 2023
2 parents 292b75e + d6b55fc commit 6b8f4f6
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Matchmaker/Docs/Setting up Matchmaker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## Multiple Full Stacks with Matchmaking

Instead of having all users connect to the same stream, you may want each person to end up in their own interactive experiences. To do this, you can run a separate stack of Pixel Streaming components for each user, and direct each user to a separate Signaling and Web Server to start a connection.

You can set up each stack of Pixel Streaming components on a separate host, or you can put more than one stack on the same host as long as you configure the port settings for the components within each stack so that they all communicate over different ports. See the [Pixel Streaming Reference](https://docs.unrealengine.com/5.3/en-US/unreal-engine-pixel-streaming-reference/) for details on these port settings.

**Note:** If you plan to run multiple instances of the Unreal Engine using Pixel Streaming on the same computer, remember many consumer-level graphics cards such as the NVIDIA GeForce line can only run a maximum of three encoders at the same time. Professional-grade cards such as the Quadro and Tesla do not have the same limitation.

To help set up this kind of configuration, the Pixel Streaming system can use a matchmaker server that tracks which Signaling and Web Servers are available, and whether they are being used by a client connection.

![Multiple full stacks with a Matchmaker Server](images/MatchmakerDiagram.png)

Instead of each client needing to connect to its own Signaling and Web Server URL, they first connect to the Matchmaker Server. The Matchmaker takes care of redirecting each requester to its own Signaling and Web Server, which sets up the peer-to-peer connection between the client and its UE5 application. As long as that connection is active, the Matchmaker Server will not redirect any new incoming browser connections to the same Signaling and Web Server.

The Pixel Streaming system includes a reference implementation for a Matchmaker Server, under the `Samples/PixelStreaming/WebServers/Matchmaker` folder. You can use this server as-is; or, you can customize the `matchmaker.js` file to fit your needs, as long as you handle the same messages from the Signaling and Web Server.

To set up the Matchmaker Server:

1. Before you start your Signalling and Web Server, start the Matchmaker Server by running its `run.bat` file. By default, the server listens for HTTP connections from clients on port **90**, and it listens for connections from Signalling and Web Servers on port **9999**. You can override those settings by providing the following configuration parameters on the command line:

| Parameter | Description |
| --- | --- |
| **--HttpPort** | Defines the port the Matchmaker Server listens to for incoming HTTP connections from browsers. |
| **--MatchmakerPort** | Defines the port the Matchmaker Server listens to for incoming status messages from Signaling and Web Servers. |

For example:

\> Start_SignallingServer.ps1 --HttpPort 88 --MatchmakerPort 9988

2. Set the following configuration parameters for the Signalling and Web Server:

| Parameter | Description |
| --- | --- |
| **--UseMatchmaker** | Set this parameter to `true` to make the Signalling Web Server send its current status to the Matchmaker Server. |
| **--MatchmakerAddress** | The IP address of the Matchmaker Server this Signalling and Web Server will connect to. |
| **--MatchmakerPort** | The port this Signalling and Web Server will use when it needs to send messages to the Matchmaker Server. Make sure this value matches the **--MatchmakerPort** value you set for the Matchmaker Server. |
| **--PublicIp** | The publicly visible IP address of the Signalling and Web Server. When the Matchmaker Server redirects a user to this Signalling and Web Server, it sends them to this IP address. Therefore, it has to be visible to the connecting browser. |
| **--HttpPort** | The port that the Signalling and Web Server listens to for HTTP connections. When the Matchmaker Server redirects a user to this Signalling and Web Server, it sends them to this port. |

For instructions on how you can set these parameters, see the [Pixel Streaming Reference](https://docs.unrealengine.com/5.3/en-US/unreal-engine-pixel-streaming-reference/)
Binary file added Matchmaker/Docs/images/MatchmakerDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions SFU/Docs/What is the SFU.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## What is the SFU?

A Selective Forwarding Unit (SFU) is a server which intelligently routes media streams between participants. In Pixel Streaming the role of the SFU is to receive stream data from the Unreal Engine application and deliver it to the recipients peers (typically connected web browsers), optionally subsetting the data to adapt to the prevailing network conditions of each recipient peer.

When using the SFU Pixel Streaming implements the simulcast strategy for adapting stream bandwidth. In the simulcast strategy, the Unreal Instance generates multiple streams at different resolutions. The SFU then selects which quality variant of the stream to transmit to the recipient based on the recipient's network conditions.


**Note:** At this time the SFU feature of Pixel Streaming is experimental.


![SFUSetup](images/SFUDiagram.PNG)

## When to Use an SFU
An SFU enables a one-to-many stream where there can be more peers connected than would be typically available if all the peers were connected to the Pixel Streaming application in a peer-to-peer fashion. The use of an SFU is often appropriate when your Pixel Streaming application requires multiple connected recipients and those recipients are in varying network conditions that call for different quality stream quality levels (for example, lower bitrates, resolutions, or framerates).

## SFU Configuration
Configuration of the SFU can be achieved by modifying the `config.js` file found in `Samples/PixelStreaming/WebServers/SFU`.

The SFU is configured by default to provide two quality levels. One full resolution stream and one half resolution stream. This configuration can be changed using `-SimulcastParameters=` (See [Pixel Streaming Reference](https://docs.unrealengine.com/5.3/en-US/unreal-engine-pixel-streaming-reference/) for details).


**Note:** If you are create more than three simulcast streams you may hit up against limits when using the H.264 hardware encoders on consumer GPUs that often have a limit of three encoding sessions.

## Creating a SFU Layer Toggle

To best test the layer-switching functionality of the SFU, we’ve added the blueprints required to force the stream to switch between the available layers of your SFU.

![SFULayerBP](images/SFULayerBP.PNG)

Adding the above to your level blueprint lets you use the assigned key as a connected peer to switch layers.

**Note:** The SFU is designed to automatically switch peers between layers based on their connection, so using this blueprint isn’t required for actual deployments.


![Layer1](images/Layer1.png) Layer 1

![Layer2](images/Layer2.png) Layer 2

![Layer3](images/Layer3.png) Layer 3
Binary file added SFU/Docs/images/Layer1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SFU/Docs/images/Layer2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SFU/Docs/images/Layer3.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SFU/Docs/images/SFUDiagram.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SFU/Docs/images/SFULayerBP.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6b8f4f6

Please sign in to comment.