mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-26 19:47:25 +00:00
Merge branch 'master' of github.com:giongto35/cloud-game
This commit is contained in:
commit
1c55c07506
5 changed files with 59 additions and 29 deletions
68
README.md
vendored
68
README.md
vendored
|
|
@ -1,18 +1,11 @@
|
|||
# Cloud Gaming Service Lite
|
||||
# Web-based Cloud Gaming Service
|
||||
SEA: [http://cloud.webgame2d.com](http://cloud.webgame2d.com) | US West: [http://us.cloud.webgame2d.com](http://us.cloud.webgame2d.com) | US East: [http://use.nes.webgame2d.com](http://use.nes.webgame2d.com) | Europe: [http://eu.nes.playcloud.games](http://eu.nes.playcloud.games)
|
||||
|
||||
Cloud Gaming Service Lite is an open source Cloud Gaming Service building on [WebRTC](https://github.com/pion).
|
||||
Web-based Cloud Gaming Service is an open source Cloud Gaming Service building on [WebRTC](https://github.com/pion) using browser as the main platform.
|
||||
|
||||
With cloud gaming, you can play any of your favourite NES games directly on your browser without installing it. It also brings modern online multiplayer gaming experience to classic NES game, so two people can play the game together.
|
||||
.. aims to bring the most convenient gaming experience to gamer. You can play any games on your browser directly, which is fully compatible on multi-platform like Desktop, Android, IOS. This flexibility enables modern online gaming experience to retro games starting with NES in this current release.
|
||||
|
||||

|
||||
|
||||
## Feature
|
||||
1. Can play NES games directly from browser.
|
||||
2. Immediately startup, no need to install.
|
||||
2. Can multiplayer over internet. A person host a game and the other person can join the same game as 1st or 2nd player.
|
||||
3. Save (S) and Load (L) at any point in time.
|
||||
4. If you save the roomID, next time you can come back to continue play in that room.
|
||||
5. The game can be hosted on local and your game session can be accessed over internet.
|
||||

|
||||
|
||||
## Demo
|
||||
https://www.youtube.com/watch?v=qkjV2VIwVIo
|
||||
|
|
@ -20,6 +13,7 @@ https://www.youtube.com/watch?v=qkjV2VIwVIo
|
|||
## Try the game
|
||||
|
||||
For the best gaming experience, please select the closest region to you.
|
||||
Note: The current state of cloud gaming service lite are not optimized for production. The service will still experience lag in the case of heavy traffic. You can try hosting your own service following the instruction in the next session.
|
||||
|
||||
Southeast Asia:
|
||||
* [http://nes.webgame2d.com](http://nes.webgame2d.com)
|
||||
|
|
@ -37,13 +31,17 @@ Europe: (Haven't hosted)
|
|||
* [http://eu.nes.webgame2d.com](http://eu.nes.webgame2d.com)
|
||||
* [http://eu.nes.playcloud.games](http://eu.nes.playcloud.games)
|
||||
|
||||
Note: The current state of cloud gaming service lite are not optimized for production. The service will still experience lag in the case of heavy traffic. You can try hosting your own service following the instruction in the next session.
|
||||
## Feature
|
||||
1. Cloud gaming: Game logic is handled in server and streamed to user.
|
||||
2. Cross-platform compatibility: The game is run on webbrowser, the most universal builtin app. No console, external app or devices are need.
|
||||
3. Verially scaled: Services are distributed. The closest server with highest free resource will be assigned to user. (In progress)
|
||||
4. Collaborative hosting: this is our invented term refering to the whole community can contribute to host the platform. Whenever the server is hosted and able to connect to the coordinator, it can join the cloud-gaming network and Collaboratively serve prod traffic.
|
||||
5. Local streaming: If you host a server on your local machine and play game on other device close to that, the game will automatically detect running local server and serve the traffic.
|
||||
6. Cloud storage: Game state is storing on an online storage, so you can come back to continue playing in a game.
|
||||
|
||||
## Run on local
|
||||
## Run on local by Docker
|
||||
|
||||
You can host the server yourself by running `./run_local.sh`. It will spawn a docker environment and you can access the emulator on `localhost:8000`.
|
||||
|
||||
Given the roomID, the game session on your local can be accessed over ethernet. The server will bypass NAT and set up a peer connection from remote service to local.
|
||||
You try hosting the server yourself by running `./run_local_docker.sh`. It will spawn a docker environment and you can access the emulator on `localhost:8000`.
|
||||
|
||||
## Development environment
|
||||
|
||||
|
|
@ -62,33 +60,45 @@ brew install libvpx pkg-config
|
|||
# Windows
|
||||
...
|
||||
```
|
||||
And golang dependencies
|
||||
* `go get github.com/pion/webrtc/`
|
||||
* `go get github.com/gorilla/websocket`
|
||||
* `go get gopkg.in/hraban/opus.v2`
|
||||
* `go get github.com/satori/go.uuid`
|
||||
* `go get cloud.google.com/go/storage`
|
||||
|
||||
And run
|
||||
* `./run_local.sh`
|
||||
|
||||
Then we can run the main directly
|
||||
* `go run cmd/main.go -debug` - for debug UI
|
||||
* `go run cmd/main.go` - for gameboy UI
|
||||
## Collaborative hosting
|
||||
* `go run cmd/main.go -overlordhost ...` - start game workers (in charge of peerconnection) connecting to cloud-game network
|
||||
|
||||
## Design Doc
|
||||

|
||||
|
||||
## Code structure
|
||||
|
||||
```
|
||||
.
|
||||
├── cmd
|
||||
│ ├── main.go
|
||||
│ └── main_test.go
|
||||
├── emulator: emulator internal
|
||||
│ ├── director.go: coordinator of views
|
||||
│ └── gameview.go: in game logic
|
||||
├── overlord: coordinator of workers
|
||||
├── games: roms list, no code logic
|
||||
├── nes: emulator internal
|
||||
├── static: static file for front end
|
||||
│ ├── js
|
||||
│ │ └── ws.js: client logic
|
||||
│ ├── gameboy.html: frontend with gameboy ui
|
||||
│ └── index_ws.html: raw frontend without ui
|
||||
├── ui
|
||||
│ ├── director.go: coordinator of views
|
||||
│ └── gameview.go: in game logic
|
||||
├── vpx-encoder: vp8 encoding images -> video track
|
||||
├── webrtc: peer to peer communication
|
||||
├── main.go: integration between emulator + webrtc (communication) + websocket (signalling)
|
||||
└── run_local.sh
|
||||
├── cws
|
||||
│ └── cws.go: socket multiplexer library, used for signalling
|
||||
├── webrtc
|
||||
└── worker: integration between emulator + webrtc (communication)
|
||||
```
|
||||
|
||||
|
||||
## Follow up
|
||||
|
||||
This project demos the simplest cloud game with NES. Integrating with other emulator like GBA, NDS will also be possible. I'm welcome for the contribution.
|
||||
|
|
|
|||
20
document/designdoc/README.md
vendored
Normal file
20
document/designdoc/README.md
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Web-based Cloud Gaming Service Design Doc
|
||||
|
||||
Web-based Cloud Gaming Service contains multiple workers for gaming streaming and a coordinator (Overlord) for distributing traffic and setup connection.
|
||||
|
||||
## Worker
|
||||
|
||||
Worker is responsible for streaming game to frontend
|
||||

|
||||
|
||||
## Overlord
|
||||
|
||||
Overlord is in charge of picking the most suitable workers for a user. Everytime a user connects to overlord, it will collect all the metric from all workers, i.e free CPU resources and latency from worker to user. Overlord will decide the best candidate based on the metric and setup peer-to-peer connection between worker and user based on WebRTC protocol
|
||||
|
||||

|
||||
|
||||
1. A user connected to overlord .
|
||||
2. Overlord will find the most suitable worker to server the user.
|
||||
3. Overlord collects all latencies from workers to user as well as CPU usage on each machine .
|
||||
4. Overlord setup peer-to-peer handshake between worker and user by exchanging Session Description Protocol .
|
||||
5. A game is hosted on worker and streamed to user .
|
||||
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
BIN
document/img/overlord.png
vendored
Normal file
BIN
document/img/overlord.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
BIN
document/img/worker.png
vendored
Normal file
BIN
document/img/worker.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
Loading…
Add table
Add a link
Reference in a new issue