RealtimeMultiplayerNodeJS is a framework specifically for building HTML5 multiplayer games with the Client / Server model. In this model, connected users send only input and the game itself runs on the server.
Clients are interpolate between two known world snapshots based on the current synchronized time.

How to use

  1. Download this repo
  2. In the terminal type “node js/DemoHelloWorld/server.js”
  3. Browse to “/DemoHelloWorld.html”


RealtimeMultiplayerNodeJS comes with 3 demos


The most basic interesting working demo I could come up with. Objects move from left to right


A demonstration of the engine’s simple CircleCollision engine, which can provide you with simple collision information and fires an event when two objects collide with the two objects.
This demo also shows one implementation of having a special kind of entity which is controlled by the keyboard from a connected user. A character controlled entity


This demo uses a Box2D.js implementation to create a world, and show’s off the idea of synchronized physics, and taking advantage that all the simulation happens on the server.
It also shows synchronized interaction between multiple users, and an example of sending a message to the server which it interprets back into the game

“Using JS.Class” or “Sharing a Class Between Node.JS and the Browser Part 2”

Just a quick snippet, but this is a much better way of sharing a class between Node.js and the browser. I also like this psuedo Class implementation much better than the Class.js thing, it always seemed a bit ghetto how you had to say.

The ugly way (i was using this before but it felt wrong)

var ServerGame = require('./ServerGame.js').Class;

var myInstance = new ServerGame();

There’s a better way!

 * Animal.js
 * This is an example I created for us JS.Class
 * Mario Gonzalez |
var init = function()
	return new JS.Class(
		initialize: function(name) { = name;
			console.log( 'Animal::initialize - ', name);

		 * Cause the Animal to tell you what it likes (Testing JavaDoc)
		 * @param things What the animal likes
		speak: function(things) {
			return 'My name is ' + + ' and I like ' + things;

// Handle Node.JS and browser
if (typeof window === 'undefined') {
	Animal = init();
} else {
	define(['lib/jsclass/core'], init);

Ok, but now to use it in another file!

// Testing JS.Class

// bring it in

// use it
var animal = new Animal('Rex');
console.log('Animal', animal.speak("YELLING!!!") ); // Should output: Animal My name is Max and I like BARKING!!!

There you have it – so simple and soooo much cleaner!!