Web-based Cloud Gaming service for Retro Game
Find a file
sergystepanov 1fcf34ee02
Add new Libretro core manager module (#249)
* Add initial external configuration files support.

These external configuration files allow changing app params at the runtime without recompilation.

* Find config files with specified directory in the tests

* Add aspect ratio recalculation config

* Clean code

* Add new configuration files into the Docker container image

* Add shared core and config paths into the Libretro cores config

* Split ROM <-> Emulator mapping between workers and coordinators

* Extract coordinator config

* Add shared worker/coordinator server config

* Add explicit embedded shared worker/coordinator struct for auto-config reflection fill

* Remove default stun/turn servers from the config

* Extract and add new ice servers config structures

* Update coordinator config params

* Add auto emulation lib loader based on the runtime OS/arch

* Update configuration structures

* Remove shared config embedding

* Add missing network config params

* Add game library external config

* Remove unused config parameters

* Add WebRTC encoder external options

* Add user dir for config search

* Update config loader

* Update config

* Add generic downloader with Grab lib implementation

* Add a simple file downloader backed by the grab lib

* Add initial Libretro core repos abstractions

* Expose compression info for Libretro cores repository records

* Add pipe-based abstract file downloader

* Refactor downloader

* Refactor Libretro repos

* Add worker coresync stubs

* Add multiprocess-safe HTTP-based core manager implementation

* Remove Libretro cores from the repo

* Keep custom N64 cores in te repo for now

* Add Libretro cores repo select in the config

* Fix http manager repo switch

* Cleanup code

* Add greedy Libretro lib loader

* Don't crash when arch map is not set

* Disable dynamic recompiler for pcsx core by default since it's could cause a crash

* Use global Libretro dynalib handler

* Shorten the default Libretro cores store path

* Update zip extractor implementation

* Remove explicit fig lib field markings

* Add config note to the README file

* Add GitHub repo backend for the core downloader

* Fix GitHub repo param list in the manager factory

* Add env variables reader with CLOUD_GAME prefix

* Re-optimize ice server info struct custom marshaler
2020-12-31 13:24:27 +03:00
.github Add new Libretro core manager module (#249) 2020-12-31 13:24:27 +03:00
assets Add new Libretro core manager module (#249) 2020-12-31 13:24:27 +03:00
cmd Add new Libretro core manager module (#249) 2020-12-31 13:24:27 +03:00
configs Add new Libretro core manager module (#249) 2020-12-31 13:24:27 +03:00
docs Update Readme format (#162) 2020-04-17 03:35:49 +08:00
pkg Add new Libretro core manager module (#249) 2020-12-31 13:24:27 +03:00
tests/e2e Remove unused files (#230) 2020-10-02 00:54:14 +08:00
web Add new Libretro core manager module (#249) 2020-12-31 13:24:27 +03:00
.dockerignore Initial Docker rewrite (#190) 2020-06-09 20:38:43 +08:00
.editorconfig Add .editorconfig file for proper Markdown trailing spaces handling (#229) 2020-09-20 19:07:45 +08:00
.env Initial Docker rewrite (#190) 2020-06-09 20:38:43 +08:00
.gitattributes Update new frontend (#38) 2019-05-25 13:16:32 +08:00
.gitignore Remove unused GO vendor experiment 2020-04-20 15:29:26 +03:00
docker-compose.yml Force OpenGL compatible profile for the Docker compose config (#228) 2020-09-19 11:52:12 +08:00
Dockerfile Add new Libretro core manager module (#249) 2020-12-31 13:24:27 +03:00
go.mod Add new Libretro core manager module (#249) 2020-12-31 13:24:27 +03:00
go.sum Add new Libretro core manager module (#249) 2020-12-31 13:24:27 +03:00
LICENSE Update LICENSE 2019-04-11 02:13:48 +08:00
Makefile Add new Libretro core manager module (#249) 2020-12-31 13:24:27 +03:00
README.md Add new Libretro core manager module (#249) 2020-12-31 13:24:27 +03:00

CloudRetro

Build Latest release

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/
CloudMorph: https://github.com/giongto35/cloud-morph: My current focus on generic solution for cloudgaming

Introduction

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.

Announcement

(Currently, I'm working on CloudMorph: It offers more generic solution to run any offline games/application on browser in Cloud Gaming approach: https://github.com/giongto35/cloud-morph)

Try the service at

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
screenshot screenshot
screenshot screenshot

Feature

  1. 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.
  2. 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.
  3. Emulator agnostic: The game can be played directly without any extra effort to set up the gaming emulator or platform.
  4. 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
  5. 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.
  6. Horizontally scaled: The infrastructure is designed to be able to scale under high traffic by adding more instances.
  7. Cloud storage: Game state is storing on online storage, so you can come back and continue playing your incomplete game later.

Development environment

Install Golang https://golang.org/doc/install . Because the project uses GoModule, so it requires Go1.11 version.

Install Dependencies

# Ubuntu / Windows (WSL2)
apt-get install -y make gcc 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.

  1. Script
  • make dev.run
  • The scripts spawns 2 processes one in the background and one in foreground
  1. Manual
  • Need to run coordinator and worker separately in two session
  • go run cmd/coordinator/main.go - spawn coordinator
  • go run cmd/worker/main.go --coordinatorhost localhost:8000 - spawn workers connecting to coordinator

Additionally, you may install and configure an X Server display in order to be able to run OpenGL cores. See the docker-compose.yml file for Xvfb example config.

Run with Docker

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.

Configuration

The configuration parameters are stored in the configs/config.yaml file which is shared for all application instances on the same host system. It is possible to specify individual configuration files for each instance as well as override some parameters, for that purpose, please refer to the list of command-line options of the apps.

Technical Document

High level Worker internal
screenshot screenshot

FAQ

Crowd Play, play game together

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

Contribution

We are very much thankful to everyone who contributes to the project:

Credits

Art

Main Contributor

Sergey Stepanov
https://github.com/sergystepanov/

Author

Nguyen Huu Thanh
https://www.linkedin.com/in/huuthanhnguyen/

Tri Dang Minh
https://trich.im