Skip to content
A WebSocket library optimized for multiplayer JS games, works on WebWorkers with binary data.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build remove callback functions on destroy Jan 1, 2020
examples Protocol onValuesReceived fix Jan 1, 2020
js
.babelrc
.eslintrc
.gitignore
LICENSE
README.md
package-lock.json
package.json v1.3.1 Jan 1, 2020
rhubarb.gif add GIF to README Dec 31, 2019
rollup.config.js
rollup.config.worker.js compile worker separately Dec 29, 2019
webpack.config.chatRoom.js Protocol onValuesReceived fix Jan 1, 2020
webpack.config.exampleGame.js

README.md

Rhubarb

See Wiki page

Rhubarb is a lightweight WebSocket library for multiplayer HTML5 games. It is originally designed to be used by the ROYGBIV Engine. However it can be used outside of ROYGBIV as well.

Rhubarb is named after this Aphex Twin track.

Rhubarb works both on browsers and NodeJS.

Philosophy

Javascript is slow, therefore we want to have as much main-process-power as we can in order to do game related calculations, graphics rendering and achieving 60 FPS.

For multiplayer games achieving 60 FPS gets even more complicated given that transferring data over WebSockets is a slow operation. It also triggers GC activity by copying the transferred data (if JSON is the preferred way), which eventually slows down the main thread as well.

Rhubarb is designed to overcome these problems by:

  1. Using WebWorkers to handle networking out of main thread -> More time left for rendering in main thread
  2. Using transferables between the main thread and the worker to prevent GC activity (zero copy)
  3. Redefining/compressing and sending protocols using Float32Arrays -> Much less bandwidth consumption than JSON.stringify.
  4. Allowing users to define their protocols in a high-level way and taking care of all the dirty bitwise operations internally.
  5. Allowing sharing same protocol definitions between server/client.
  6. Allocating objects only when being initialized. Reusing everything to prevent GC activity (That means mutating things, yeah get over it.)

Installation

For clients: <script src="PATH_TO_Rhubarb.min.js"> </script>

For servers: npm install rhubarb-js

Usage

See this tutorial to see how to use Rhubarb.

See here for the API reference.

Demo

See here

Licence

Rhubarb uses MIT license.

You can’t perform that action at this time.