Turbo architecture

Turbo - is a cloud gaming (streaming) service. You can use it to play DOS games.
This topic describe architecture of Turbo.

Browser part

On a browser side everything is managed by JS-DOS Janus.
Basically it’s just a wrapper over janus js api.

Server part

Server actors are dosbox, ffmpeg and Janus server. They are packed together in single docker image.

Latest dosbox is used, and compiled with dynamic core support for best performance.
ffmpeg is compiled in minimal configuration that supports vp9 and opus codecs.
Janus is compiled from the master branch and has a special extension (read below).

Audio & Video streaming

When dosbox started it continuously produced frames and audio samples. These data are redirected to ffmpeg to create two RTP streams (audio, video). Janus streaming plugin listens to these streams and produces web-rtc data for the browser.

{dosbox} --> {ffmpeg} --> {janus streaming plugin} --> {browser}

Keyboard support

To handle game actions (key up, key down) web-rtc data channels are used. Each time when you press some key, the keyboard listener is triggered. It sends web-rtc text data to janus server.

  • pipe kdown - when key is pressed
  • pipe kup - when key is released

This data is captured by janus extension (source). This extension creates a named pipe and writes the text above commands to it. On the other side, dosbox continuously reads this pipe and pushes these keys to the event queue.

{browser} --> {janus data text channel} --> {pipe} --> {dosbox}

Data channel is started in ordered mode with 16 ms life-time for the packet. Keys will be pushed in the same order as the client pressed them.

Infrastructure

Streaming services are runned on Amazon platform. For each client a new Fargate instance is allocated. Runned instances obtain public ip that is pushed to the browser. Browser connects to the janus server using this ip. When emulation is stopped, the instance is stopped. There are no limits for the amount of instances.


{browser} --> {+fargate} --> {ip} --> {browser}
...
{browser} --> {stop} --> {-fargate}

Service is not binded for a specific region, it can be changed in user preferences.

Live Demo

Want to try? Follow DOS Cloud Gaming (aka Turbo).