mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-22 09:37:09 +00:00
300th commit: Update REAME + ice timeout
This commit is contained in:
parent
34995a5d1d
commit
a9b4e310a6
26 changed files with 68 additions and 36 deletions
40
document/implementation/README.md
vendored
40
document/implementation/README.md
vendored
|
|
@ -3,21 +3,41 @@
|
|||
## Code structure
|
||||
```
|
||||
.
|
||||
├── cmd
|
||||
│ ├── main.go
|
||||
├── cmd: service entrypoint
|
||||
│ ├── main.go: Spawn overlord or worker based on flag
|
||||
│ └── 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
|
||||
├── static: static file for front end
|
||||
│ ├── js
|
||||
│ │ └── ws.js: client logic
|
||||
│ ├── game.html: frontend with gameboy ui
|
||||
│ └── index_ws.html: raw frontend without ui
|
||||
├── overlord: coordinator
|
||||
│ ├── handlers.go: coordinator entrypoint
|
||||
│ ├── browser.go: router listening to browser
|
||||
│ └── worker.go: router listening to worker
|
||||
├── games: roms list, no code logic
|
||||
├── worker: integration between emulator + webrtc (communication)
|
||||
│ ├── room:
|
||||
│ │ ├── room.go: room logic
|
||||
│ │ └── media.go: video + audio encoding
|
||||
│ ├── handlers.go: worker entrypoint
|
||||
│ └── overlord.go: router listening to overlord
|
||||
├── emulator: emulator internal
|
||||
│ ├── nes: NES device internal
|
||||
│ ├── director.go: coordinator of views
|
||||
│ └── gameview.go: in game logic
|
||||
├── cws
|
||||
│ └── cws.go: socket multiplexer library, used for signalling
|
||||
├── webrtc: webrtc streaming logic
|
||||
└── worker: integration between emulator + webrtc (communication)
|
||||
│ └── cws.go: socket multiplexer library, used for signaling
|
||||
└── webrtc: webrtc streaming logic
|
||||
```
|
||||
|
||||
## Room
|
||||
Room is a fundamental part of the system. Each user session will spawn a room with a game running inside. There is a pipeline to encode images and audio and stream them out from emulator to user. The pipeline also listens to all input and streams to the emulator.
|
||||
|
||||
## Worker
|
||||
Worker is an instance that can be provisioned to scale up the traffic. There are multiple rooms inside a worker. Worker will listen to overlord events in `overlord.go`.
|
||||
|
||||
## Overlord
|
||||
Overlord is the coordinator, which handles all communication with workers and frontend.
|
||||
Overlord will pair up a worker and a user for peer streaming. In WebRTC handshaking, two peers need to exchange their signature (Session Description Protocol) to initiate a peerconnection.
|
||||
Events come from frontend will be handled in `overlord/browser.go`. Events come from worker will be handled in `overlord/worker.go`. Overlord stays in the middle and relays handshake packages between workers and user.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue