Open-source Cloud Gaming Service For Retro Games
Video demo: https://www.youtube.com/watch?v=GUBrJGAxZZg
Technical wrapup: https://webrtchacks.com/open-source-cloud-gaming-with-webrtc/
CloudRetro provides an open-source cloud gaming platform for retro games. It started as an experiment for testing cloud gaming performance with WebRTC and libretro, and now it aims to deliver the most modern and convenient gaming experience through the technology.
Theoretically, in cloud gaming, games are run on remote servers and media are streamed to the player optimally to ensure the most comfortable user interaction. It opens the ability to play any retro games on web-browser directly, which are fully compatible with multi-platform like Desktop, Android, IOS.
Single play: http://cloudretro.io
Direct play an existing game: Pokemon Emerald
*In ideal network condition and less resource contention on servers, the game will run smoothly as in the video demo. Because I only hosted the platform on limited servers in US East, US West, Eu, Singapore, you may experience some latency issues + connection problem. You can try hosting the service following the instruction the next section to have a better sense of performance.
Screenshot | Screenshot |
---|---|
- Cloud gaming: Game logic and storage is hosted on cloud service. It reduces the cumbersome of game initialization. Images and audio are streamed to user in the most optimal way using advanced encoding technology.
- Cross-platform compatibility: The game is run on web browser, the most universal built-in app. No console, plugin, external app or devices are needed.
- Emulator agnostic: The game can be played directly without any extra effort to set up the gaming emulator or platform.
- Collaborate gameplay: Follow the idea of crowdplay(TwitchPlaysPokemon), multiple players can play the same game together by addressing the same deeplink. The game experience is powered by cloud-gaming, so the game is much smoother. Check CrowdPlay section
- Online multiplayer: The first time in history, you can play multiplayer on Retro games online. You can try Samurai Showndown with 2 players for fighting game example.
- Horizontally scaled: The infrastructure is designed to be able to scale under high traffic by adding more instances.
- Cloud storage: Game state is storing on online storage, so you can come back and continue playing your incomplete game later.
Install Golang https://golang.org/doc/install . Because the project uses GoModule, so it requires Go1.11 version.
- Install libvpx, libopus, pkg-config, sdl2
# Ubuntu / Windows (WSL2)
apt-get install -y pkg-config libvpx-dev libopus-dev libopusfile-dev libsdl2-dev
# MacOS
brew install libvpx pkg-config opus opusfile sdl2
# Windows (MSYS2)
pacman -Sy --noconfirm --needed git make mingw-w64-x86_64-{gcc,pkg-config,dlfcn,libvpx,opusfile,SDL2}
Because the coordinator and workers need to run simultaneously. Workers connect to the coordinator.
- Script
make dev.run
- The scripts spawns 2 processes one in the background and one in foreground
- Manual
- Need to run coordinator and worker separately in two session
go run cmd/coordinator/main.go
- spawn coordinatorgo run cmd/worker/main.go --coordinatorhost localhost:8000
- spawn workers connecting to coordinator
In case if you want to run the app as a Docker container,
use docker-compose up --build
(CLOUD_GAME_GAMES_PATH
is env variable for games on your host).
It will spawn a docker environment and you can access the service on localhost:8000
.
Note. Docker for Windows is not supposed to work with provided configuration, use WSL2 instead.
High level | Worker internal |
---|---|
By clicking these deep link, you can join the game directly and play it together with other people.
And you can host the new game by yourself by accessing cloudretro.io and click "share" button to generate a deeplink to your current game.
Synchronize a game session on multiple devices
We are very much thankful to everyone who contributes to the project:
- Pion Webrtc team for the incredible Golang Webrtc library and their supports https://github.com/pion/webrtc/.
- libretro/kivutar Golang libretro https://github.com/libretro/go-nanoarch and https://www.libretro.com/.
- gen2brain for the h264 go encoder https://github.com/gen2brain/x264-go
- poi5305 for the video encoding https://github.com/poi5305/go-yuv2webRTC.
- fogleman for the NES emulator https://github.com/fogleman/nes.
Nguyen Huu Thanh
https://www.linkedin.com/in/huuthanhnguyen/
Tri Dang Minh
https://trich.im