This forum is read only and just serves as an archive. If you have any questions, please post them on

1 decade ago by ape

I put together a plugin that makes it pretty easy to turn your ImpactJS games into Socket.IO clients.

It's safe to say that the plugin is at its most basic level in terms of functionality. There's an example app in the repo. Just clone the repo, copy your core impact files into it, and use node to fire up the server.js file.

1 decade ago by MikeL

Wow ape, you were able to turn your work into a plugin?! Super cool! Opens up whole new world. Love the name 'impsock' by the way. Conjures up funny images in my mind.....

1 decade ago by matthew

So.. this could be used for what? Multiplayer perhaps?

1 decade ago by q_no


I'm new to impact and the reason I got a license is, that I want to create a multiplayer game with impact and node.js.

Ape, your plugins is a great basis to start with, but unfortunately your plugin is hiding the callbacks from impact.

For instance, when the socket is established the player should join the game automatically. In your example you'r checking if the socket is connected, as well as for the existence of the player entity on every update call. I don't think that's necessary. Using event callbacks it's much prettier IMO.

Hence I've extended your plugin to pass the basic events back to the game, similar to the way jQuery attaches event callbacks.

Basically what I've done is adding an on() method.
For instance:
   this.impsock = new ig.Impsock(this);
   this.impsock.on('disconnect',function() { alert('disconnect form server');});

This way you can subscribe to the events connect, disconnect and message. Unfortunately subscribing to the connect event AFTER instantiating the impsocket class is pointless, since the establishSocket() function is called right away inside the init call.
So I've added an optional parameter to the constructor for passing events on instantiation.

for instance:
this.impsock = new ig.Impsock(this,{'connect':CreateDelegate(this,this.joinGame)});

This way you can pass ANY event callback directly to the object. Unfortunately, the callback will loose the current context. Therefore I've added the createDelegate() function, which looks like this:

function CreateDelegate(contextObject, delegateMethod){
    return function()  {
        return delegateMethod.apply(contextObject, arguments);

To cut a long story short.... thanks for creating the impsocket plugin. It's a great basis to build upon and I hope you might consider applying my changes to your plugin.
You can get the sourcecode here:

tweaked impsock

I just hacked the event callbacks into your plugin a few minutes ago and haven't deployed it to a real project yet, since I've just started using impact yesterday. There probably room for improvements ;)

Have a nice and sunny sunday :)


1 decade ago by fugufish

nice contribution! hope to see some awesome multiplayer games soon

1 decade ago by ape


I remember not liking how I was handling the Socket.IO event callbacks. Thanks for focusing on this.

Could you fork the repo on github with your changes? I could then pull them into the master version so anyone stumbling across the plugin in the future can benefit from your improvements.

1 decade ago by FelipeMadrid

I started to develop with ImpactJS, and my ideal is to create multi-player games.

There is no more efforts on this way? I will upload any kind of plugin or advance of my own. I guess there is no big problems about sockets then.

1 decade ago by Xaan

Honestly, you don't have to use plugins to work with Impact and Look at the thread below to see HallsOfValhalla's tutorials about using to create a multiplayer game with Impact.
Page 1 of 1
« first « previous next › last »