vaporplay

module
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2025 License: MIT

README

vaporplay

VaporPlay

Cloud-game server & client based on Linux and Pion WebRTC.

This project is originally not intended to be production-ready, it's ment to be used for reasearch and testing purpose. But all kinds of PR's are welcomed, thanks for checking out this project.

Environment & Limitations

The server can only be compiled & run on Linux using X11 and have steam installed, the client runs in browser. Currently, only transportation of game video and controller inputs is implemented. Due to the proof of concept & test bed nature of this project, other types of payload is not planned for now. The control input transportation and processing is tested on Xbox Wireless Controller. Also, for the nvenc hardware encoder to work, a nvidia graphics card and it's driver is required.

Build FFmpeg from source

This project's Makefile use a FFmpeg build from source, but doesn't handle the dependency installation and configuration for you.

Since we use nvenc, it's required to install https://github.com/FFmpeg/nv-codec-headers.

Configuration

All configurations is in config.json. Here is an explanation of what each entry in a game config means:

  • game_id: steam game ID, used to start game with command.
  • game_window_name: used to match and find the correct window using X11 library, need to be a substring of the window name to be matched.
  • game_display_name: name to shown in client.
  • game_icon: for future UI improvement, leave empty for now.
  • game_process_name: names of processes that need to be terminated after session ends.

Usage

  1. Install dependencies.
  2. Run make to build, first time running this will also fetch FFmpeg source code and build it.
  3. To start server, run ./vaporplay -config=config.json. For profiling, run ./vaporplay -config=config.json -cpuprofile=vaporplay.prof and after server exits, run go tool pprof vaporplay vaporplay.prof, and type web to see the profile.
  4. After server started, go to the address in configuration file (default to http://0.0.0.0:8080).
  5. Click next, choose a game, and start!

Other commands

  • make clean Clean build cache.
  • make clean-deps Remove installed && build artifacts (will result in next make to take longer).
Testing Input Device

vaporplay-client includes a controller testing tool at https://vaporplay-client.3drx.top/gamepad-test. vaporplay-client

It also includes the detection of codec capabilities at https://vaporplay-client.3drx.top/codec-capabilities. vaporplay-client

During development, only Xbox Wireless Controller is tested.

Acknowledgements

  1. https://github.com/pion
  2. github.com/bendahl/uinput and it's fork github.com/ThomasT75/uinput for the uinput implementation in go
  3. https://github.com/asticode/go-astiav for the FFmpeg binding
  4. FFmpeg

Directories

Path Synopsis
codec
ffmpeg
Package ffmpeg brings libavcodec's encoding capabilities to mediadevices.
Package ffmpeg brings libavcodec's encoding capabilities to mediadevices.
interceptor
cc
Package cc implements common constructs used by Congestion Controllers
Package cc implements common constructs used by Congestion Controllers
flexfec
Package flexfec implements FlexFEC to recover missing RTP packets due to packet loss.
Package flexfec implements FlexFEC to recover missing RTP packets due to packet loss.
flexfec/util
Package util implements utilities to better support Fec decoding / encoding.
Package util implements utilities to better support Fec decoding / encoding.
gcc
Package gcc implements Google Congestion Control for bandwidth estimation
Package gcc implements Google Congestion Control for bandwidth estimation
nack
Package nack provides interceptors to implement sending and receiving negative acknowledgements
Package nack provides interceptors to implement sending and receiving negative acknowledgements
ntp
Package ntp provides conversion methods between time.Time and NTP timestamps stored in uint64
Package ntp provides conversion methods between time.Time and NTP timestamps stored in uint64
rfc8888
Package rfc8888 provides an interceptor that generates congestion control feedback reports as defined by RFC 8888.
Package rfc8888 provides an interceptor that generates congestion control feedback reports as defined by RFC 8888.
rtpbuffer
Package rtpbuffer provides a buffer for storing RTP packets
Package rtpbuffer provides a buffer for storing RTP packets
sequencenumber
Package sequencenumber provides a sequence number unwrapper
Package sequencenumber provides a sequence number unwrapper
twcc
Package twcc provides interceptors to implement transport wide congestion control.
Package twcc provides interceptors to implement transport wide congestion control.
Package uinput is a pure go package that provides access to the userland input device driver uinput on linux systems.
Package uinput is a pure go package that provides access to the userland input device driver uinput on linux systems.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL