一、UE4.27 linux 像素流示例项目

     按照官方像素流示例演示 https://github.com/EpicGames/UnrealEngine/tree/release/Engine/Extras/Containers/Examples/PixelStreaming

     

        访问UE github 源码容器内容更新较慢,缺少一些配置文件 ,通过开发容器可以复制出最新的文件

docker ps
CONTAINER ID   IMAGE                                                             COMMAND   CREATED          STATUS          PORTS     NAMES
6201ee56eb81   registry.cn-shenzhen.aliyuncs.com/nailcloud/ue4:dev-slim-4.27.1   "bash"    48 minutes ago   Up 48 minutes             boring_wiles

docker cp 6201ee56eb81:/home/ue4/UnrealEngine/Engine/Extras/Containers /home/ue4/Containers

root@iZwz95g7tyywrrkk6z5sh1Z:~# ls /home/ue4/Containers/Examples/PixelStreaming/
docker-compose.yml  project  run.sh

      docker-compose.yml  信令服务器更改成阿里云分享的镜像

root@iZwz95g7tyywrrkk6z5sh1Z:/home/ue4/Containers/Examples/PixelStreaming# cat docker-compose.yml
services:

  # The WebRTC TURN server (note that you will need TCP and UDP ports 3478 and 49152-65535 exposed for TURN relaying to function correctly)
  turnserver:
    image: "coturn/coturn:4.5.2"
    init: true
    network_mode: "host"
    command: ["-a", "-v", "-n", "-u", "user:password", "-p", "3478", "-r", "default-realm", "--no-dtls", "--no-tls"]

  # The Cirrus signalling server
  signalling:
    image: "registry.cn-shenzhen.aliyuncs.com/nailcloud/ue4:pixel-streaming-signalling-server-4.27"
    init: true
    network_mode: "host"
    command:
      - "--publicIp=${PUBLIC_IP}"
      - >-
        --peerConnectionOptions={
            "iceServers":[
              {
                "urls": ["stun:stun.l.google.com:19302"]
              },
              {
                "urls": ["turn:${PUBLIC_IP}:3478"],
                "username": "user",
                "credential": "password"
              }
            ]
            ${EXTRA_PEERCONNECTION_OPTIONS}
          }
    depends_on:
      - turnserver

  # The Pixel Streaming demo project
  project:
    image: "pixel-streaming-example/project"
    build:
      context: project
      args:
        RELEASE: "${UNREAL_ENGINE_RELEASE}"
    network_mode: "host"

    depends_on:
      - signalling

    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            capabilities: [gpu]
            count: 1

        /project/Dockfile    开发镜像和运行时镜像更改成阿里云分享的镜像

root@iZwz95g7tyywrrkk6z5sh1Z:/home/ue4/Containers/Examples/PixelStreaming/project# cat Dockerfile
ARG RELEASE
FROM registry.cn-shenzhen.aliyuncs.com/nailcloud/ue4:dev-slim-4.27.1 as builder

# Clone the source code for the example Unreal project
RUN git clone --progress --depth=1 'https://gitlab.com/ue4-test-projects/4.26/firstpersoncxx.git' /tmp/project

# Enable the Pixel Streaming plugin in the example Unreal project
RUN sed -i 's|"Modules"|"Plugins": [{"Name": "PixelStreaming", "Enabled": true}],\n\t"Modules"|' /tmp/project/FirstPersonCxx.uproject

# Package the example Unreal project
RUN /home/ue4/UnrealEngine/Engine/Build/BatchFiles/RunUAT.sh BuildCookRun \
        -clientconfig=Development -serverconfig=Development \
        -project=/tmp/project/FirstPersonCxx.uproject \
        -utf8output -nodebuginfo -allmaps -noP4 -cook -build -stage -prereqs -pak -archive \
        -archivedirectory=/tmp/project/dist \
        -platform=Linux

# Copy the packaged project into the Pixel Streaming runtime image
FROM registry.cn-shenzhen.aliyuncs.com/nailcloud/ue4:runtime-pixel-streaming-4.27
COPY --from=builder --chown=ue4:ue4 /tmp/project/dist/LinuxNoEditor /home/ue4/project

# Set the project as the container's entrypoint
ENTRYPOINT ["/home/ue4/project/FirstPersonCxx.sh", "-RenderOffscreen", "-Windowed", "-ForceRes", "-ResX=1920", "-ResY=1080", "-PixelStreamingIP=127.0.0.1", "-PixelStreamingPort=8888"]

      执行./sh,显示像素流启动正常

      Google Chrome 访问公网ip+端口测试网页访问是否正常

 

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐