Giter Site home page Giter Site logo

rhubarb's Introduction

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

To run the demo.

  1. Clone the repository
  2. npm install
  3. npm run exampleGame
  4. With another terminal instance go to /examples/exampleGame/ folder and node exampleGameServer.js
  5. Using your favorite browser, go to localhost:8086
  6. Try with multiple browsers.

Licence

Rhubarb uses MIT license.

rhubarb's People

Contributors

oguzeroglu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.