NPM install from branch on private repo

Something you need a specific branch of a repository that has not been published yet.


For example:

// this URL

// becomes in your package.json

// If that doesn't work, try:
npm install --save git+ssh://

Swap HTTP for HTTPS, depending on your repo location

Creating Realtime Multiplayer Games using Node JS

A few months ago at work, we decided to build a realtime multiplayer game for the web, and we chose to go with Node.js for our multiplayer server.
It was a pretty strong success, and was up running for several months without a single crash or restart of the Node.js process.

We decided to write our game in Node.js because we had heard of this cool platform and had been itching to use it for a while. This turned out to be a blessing because it was very easy to get into, and many interesting Node.js libraries exist to help accomplish various task. A side benefit of using node is that javascript itself is very easy to use. This allowed us to focus on the problems all realtime network games face with less fussing with the constraints or compile times of less dynamic languages.

Node.js was also very lightweight on our servers even during peek usage. On our game the node.js process was using only 1 thread and ran at about 3-4% CPU usage running 8-10 simultaneous games each with their own collision engine instance.

Writing a realtime multiplayer game – the initial (naive) approach:

var info = {};
info.position = {x:10, y:15};
info.velocity = {x:0.5,y: 0.2};
info.currentWeapon = 1;
info.radius = 10;
this.netChannel.send( info );

Server re-broadcast that info to all other clients:

function broadcastInfo( sendingClient, messageInfo )
     for(var aClient in allClients) {
          if(aClient != sendingClient) {
               aClient.connection.send( messageInfo );

Continue reading Creating Realtime Multiplayer Games using Node JS

A Finite State Machine implementation for use with Javascript games

Currently I’m working on a new Javascript/WebGL game called ChuClone. It’s been a lot of fun to work on so far. Having a good editor has been a key in that, as it allows you to write javascript in a more application like style, than strictly a series of DOM manipulation functions.

For this game I wanted to use a Finite State Machine to handle my gameplay states.

An example of such a system is if you think of your game as a connection of screens, for example:

Continue reading A Finite State Machine implementation for use with Javascript games

Component based game entities in javascript

I’m creating a javascript/webgl based game and would like you guys to take a look at the current entity component system which I created for it, and perhaps weigh in some opinions.

On caveat I don’t like is that, sometimes a component needs to call the attachedEntities version of a function it has overridden. For example handleInput, it might call the attachedEntities handleInput functions and then with the new movementVector multiply them by negative 1 so now all input while this component is active is reversed.

When I intercept the properties, currently I wrap intercepted function calls into a closure ( see BaseComponent.intercept() ) so that the ‘this‘ object can refer to the component itself. Without that the ‘this’ object was still being referred to as the attachedEntity (from within the components version of that function), so to get the components properties I had to run a query.

So I’m curious what others think of this implementation.

Things I used as reference:

Continue reading Component based game entities in javascript