Although you could upload your game through the PureWeb console immediately after completing the steps in Preparing Your Unreal Project or Preparing Your Unity Project, it’s strongly recommended that you do some local testing first.

Don’t forget that in addition to your packaged game you’ll also need the following installed:

Create a Project in the PureWeb Console

You’ll need a projectId from the PureWeb console before you can begin testing locally.

Open your web browser and go to https://console.pureweb.io. Log into your account, and if you don’t already have a project, create one by clicking on the [+] icon in the header bar.

Give your project a name in the popup window and click “Create.” Your project should now show up in the dropdown list.

Configure the Platform Streaming Agent

The PureWeb platform streaming agent enables your game to communicate and stream through the PureWeb Platform. You’ll need to install the PureWeb Command Line Interface (CLI) and the PureWeb Streaming Agent.

In your command prompt, there are two command to run.

Using yarn:

yarn global add @pureweb/platform-cli
yarn global add @pureweb/platform-streaming-agent

Using npm:

npm install -g @pureweb/platform-cli
npm install -g @pureweb/platform-streaming-agent
Note: This package currently requires the use of npm 6. Newer versions of npm will be supported in the near future.

Setup CLI credentials

In the PureWeb console, click the gear icon from the top menu to access project properties.

  1. In the Details tab, enable Anonymous Access at the bottom.
  2. In the Platform CLI tab, copy each of the commands there and run them in your command prompt window.

Create a Local Environment for Testing

You’ll use your local machine to emulate the streaming environment.

  1. In the PureWeb console, copy the Default Environment from the Project Properties dialog.
  2. In your command prompt window, use the cli to request an agent token with the following command, inserting the Default Environment value from the console:
pw agent create --environmentId <Default Environment>

The command will return an output message that will include an access_token, needed in step 3.

pw agent create --environmentId 

12345-6789-1234-5678-123456733212389
{
	"access_token": "ey...iw8rq2Wk",  
    "expires_in": 86400,  
    "token_type": "Bearer"
}

3. Set the PUREWEB_AGENT_TOKEN environment variable. This will vary between operating systems and shells.

  • Windows PowerShell: $env:PUREWEB_AGENT_TOKEN="<access_token>"
  • Windows Command: set PUREWEB_AGENT_TOKEN=<access_token>
  • OSX / Linux Bash: export PUREWEB_AGENT_TOKEN=<access_token>

4. Set PUREWEB_STREAMER_PORT environment variable

For Unity, you should set the default port to 9210.

  • Windows PowerShell: $env:PUREWEB_STREAMER_PORT=9210
  • Windows Command: set PUREWEB_STREAMER_PORT=9210
  • OSX / Linux Bash: export PUREWEB_STREAMER_PORT=9210

(For Unreal, you can skip this step. )

Run the Streaming Agent

To stream your game locally you must start the streaming agent. In your command prompt window start the streaming-agent.

streaming-agent
┌──────────────────────────────────────────────────────────┐
│                                                          │
│   PureWeb Streaming Agent 2.2.1                          │
│                                                          │
│   Agent id:       e5b1b35a-c60b-45fb-89a4-dd2788620644   │
│   Project id:     bea3c4cb-efa5-4041-9485-6e7a2b49e6d3   │
│   Environment id: 12345-6789-1234-5678-123456733212389   │
│                                                          │
│   Streamer Port:   8888                                  │
│   Leasing Enabled: NO                                    │
│   Sidecar Port:    NO                                    │
│                                                          │
│   Timeouts                                               │
│                                                          │
│     Rendezvous:    NO                                    │
│     Linger:        NO                                    │
│                                                          │
│                                                          │
└──────────────────────────────────────────────────────────┘

Stream, View and Share Your Game

With the local streaming agent running you’re almost finished!

In another command prompt window, navigate to the folder with your packaged game executable and start the game with local streaming.

//Unreal Engine
game.exe -PixelStreamingPort=8888 -PixelStreamingIP=127.0.0.1

//Unity
game.exe

While your game is running, you can use a web browser to view your application in the PureWeb preview client. Enter the following URL in your browser, including the projectID from the PureWeb console (found in the Project Settings tab), and the environmentID you generated locally in the Create a Local Environment for Testing step.

https://preview.pureweb.io/<project id>?environmentId=<environment id>&local=true

You can share the URL with others as well to collect feedback and test the behaviour on other browsers and devices.

You can also test a local stream with your local web client running by accessing the following URL

http://localhost:3000/?environmentId=[environment-id]&launchType=local

To stop streaming your game:

  1. Press CTRL+C in the command prompt window running the streaming agent.
  2. Close the game window to exit the game.

Next Steps

After you’ve ensured your game package is optimized and ready, you’ll want to share it with your customers / guests!

References:

  1. https://www.npmjs.com/package/@pureweb/cra-template-pureweb-client
  2. https://www.npmjs.com/package/@pureweb/platform-streaming-agent