• 30 favourites


Attached Files

The following files have been attached to this tutorial:



Download now 78.09 KB

Download now 355.61 KB


10,522 visits, 27,154 views



This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Update notes:

I DO NOT RECOMMEND using Socket.IO anymore, you should use the official multiplayer plugin.

I updated the Capx you are no longer needing the combobox & listbox plugin.

Rewrote a few comments to be better understandable.


Firstly what this tutorial will cover, and what it wont cover:

It´s going to teach you how to setup your Server.

It´s Going to teach you how to write your own server in Javascript.

It´s not going to do the work for you.

What you need (Windows)

You´ll need a Windows PC (obviously)

Construct 2:


Eclipse IDE:

Socket.IO plugin from Johnny Sheffield: It is in the download section to the left!

Setup everything

Setup Node.JS

First of all, download it, and install it. I hope I don´t need to cover how to install a normal program properly.

Then, open up CMD with Admin rights, and type in(example): cd c:\Nodejs

you can fill in at C:\Nodejs, with any path you want.

Then you need to type in: npm install

Wait a moment, because it will download and install it.

Now you succesfully installed Node.js and!


For scripting the server side, you´re going to need a Javascript IDE.

That stands for Integrated Development Enviorement.

You can use Eclipse for example, but i am going to use Adobe Dreamveawer.

But if you don´t want to install any unknown you can use the Editor, it´s integrated in EVERY windows pc.


Simply start the program, and then you can start coding. But when you´re saving it then your going on File → Save As → Filename: app.js → Filetype: All Files → Save.


Start the program, go on File → New... → Blank Page → Page Type: Javascript → Create.

Now when your going to save it, simply press save, and in filename type in thefilenameyouwant.js

That is how you´re doing it.

Javascript and Socket.IO


No, you´re not going to learn the whole javascipt language, you can if you want to.

But i am only going to cover the important parts of it.


Variables can be numbers and strings.

You just need to say: yourvariablename = 0;

or yourvariablename = “String”;

or if you want to keep it empty in the beginning just say: yourvariablename;

The important thing in Javascript is you need to set a ; in the most endings of the line.

1: Yourvariablename = 0

2: Yourvariablename = 0;

1 is wrong, don´t do it like that, 2 is the right way to do it.


sockets.on('yourfunctionname', function (data) {

socket.dosomethinghere; });


Sockets.on defines that it is a socket function.

“youfunctionname” is, your function name, you can take “enemyxy” or whatever you want.

function(data) defines what variables you want to include in that function.

You could also say function(x,y) the , split the variables, so x is a variable and y is a variable.

Socket.dosomethinghere is where you are going to put you socket logic.

}); is needed to end a function, that describes where the function ends. { describes where it begins.

You probably saw the: socket.dosomethinghere; }); there were two ; its used to describe the end of a line, that means you could put 3 lines into one line, but that looks awful and is called bad-coding.

That is what you would need on javascript to make a server.


  • Order by
Want to leave a comment? Login or Register an account!