简书链接:unrealengine开启像素流笔记
文章字数:806,阅读全文大约需要3分钟
本教程忽略了一些细节,但是不重要,需要详细教程参考
https://docs.unrealengine.com/5.2/zh-CN/getting-started-with-pixel-streaming-in-unreal-engine/

1.启用像素流插件Pixel Streaming

2.编辑器偏好设置
关卡编辑器-播放添加额外启动参数
image.png

-AudioMixer -PixelStreamingIP=localhost -PixelStreamingPort=8888
对于打包的参数,玩法和其他的类似。

3.(先确保安装了node.js)
进入D:\MyEpic\Epic Games\UE_5.2\Engine\Plugins\Media\PixelStreaming\Resources\WebServers
打开get_ps_server.bat下载SignallingWebServer
image.png

或者直接下载到本地git clone --branch UE5.2 https://github.com/EpicGames/PixelStreamingInfrastructure.git
然后打开里面的SignallingWebServer
因为,上面这个文件的方法进行下载多次执行反而会导致删文件,无语死了
再打开

1
原理是:

pushd %~dp0....
call platform_scripts\cmd\node\npm install –no-save

1
2
3
4
5
6
7
8
9
10
11
12
可以手动在package.json目录输入```>npm install --registry=https://registry.npm.taobao.org```
第三方镜像有时候垃圾试试```npm set registry https://registry.npmjs.org/```官方镜像
![image.png](https://upload-images.jianshu.io/upload_images/2815884-340664e5f14da4e5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

4.powershell执行```set-executionpolicy remotesigned```打开执行ps1权限,避免提示执行权限错误
__启动信令服务器__
之后powershell 在这个目录执行./Start_SignallingServer.ps1

![image.png](https://upload-images.jianshu.io/upload_images/2815884-c8a29839dd43367f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
5.
打开编辑器或者编译好的程序带参数打开应该可以进行测试了。
6.这是参数

Running: platform_scripts\cmd\node\node.exe cirrus –peerConnectionOptions=”{ "iceServers": [{"urls": ["stun:stun.l.google.com:19302"]}] }” –PublicIp=219.133.101.191
10:18:13.662 configFile D:\UnrealProjects\PixelStreamingInfrastructure\SignallingWebServer\config.json
10:18:13.682 Config file is readonly, skipping writing config…
10:18:13.683 Config: {
“UseFrontend”: false,
“UseMatchmaker”: false,
“UseHTTPS”: false,
“HTTPSCertFile”: “./certificates/client-cert.pem”,
“HTTPSKeyFile”: “./certificates/client-key.pem”,
“UseAuthentication”: false,
“LogToFile”: true,
“LogVerbose”: true,
“HomepageFile”: “player.html”,
“AdditionalRoutes”: {},
“EnableWebserver”: true,
“MatchmakerAddress”: “”,
“MatchmakerPort”: 9999,
“PublicIp”: “219.133.101.191”,
“HttpPort”: 80,
“HttpsPort”: 443,
“StreamerPort”: 8888,
“SFUPort”: 8889,
“MaxPlayerCount”: -1,
“DisableSSLCert”: true,
“peerConnectionOptions”: “{ "iceServers": [{"urls": ["stun:stun.l.google.com:19302"]}] }”
}

1
2
7.修改端口
在服务器目录打开config.json

{
“UseFrontend”: false,
“UseMatchmaker”: false,
“UseHTTPS”: false,
“UseAuthentication”: false,
“LogToFile”: true,
“LogVerbose”: true,
“HomepageFile”: “player.html”,
“AdditionalRoutes”: {},
“EnableWebserver”: true,
“MatchmakerAddress”: “”,
“MatchmakerPort”: 9999,
“PublicIp”: “localhost”,
“HttpPort”: 81,
“HttpsPort”: 443,
“StreamerPort”: 8888,
“SFUPort”: 8889,
“MaxPlayerCount”: -1
}

8.用开发工具运行
![image.png](https://upload-images.jianshu.io/upload_images/2815884-5251f836ccd79e67.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
不过实际上还是执行这些平台脚本,window下没有Start_SignalServer.bat执行后报错。

9.关于在关卡编辑器中测试的办法
直接勾选使用远程信令服务器,然后stream 推送必须选,我这里选择推送关卡编辑器,而非完整关卡编辑器。
测试发现ui不见了,也不能进行交互,因此还是选择完整的吧。
![image.png](https://upload-images.jianshu.io/upload_images/2815884-903d3ad854ed17da.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)