How easy is it to hook construct 2 up to nodejs?

0 favourites
  • 9 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Right now I have a project that is using NodeJS, NowJS and MongoDB/MongooseJS server-side. Client-side, I am using a javascript game engine call MelonJS.

    MelonJS is "non-intrusive" in the sense that it is just a set of javascript that I can use to manipulate the canvas. I can easily alter them or use them to call javascript outside of the engine. E.g. I can ask MelonJS to listen to arrow keys and call server-side functions via NowJS when they are pressed.

    I am thinking of switching to Construct 2 because it looks like it can shorten development time. But is it easy to call outside javascript from within Construct 2 to hook it up to Node.JS?


    1) Construct 2 listens to arrow key.

    2) Arrow key pressed --> Construct 2 calls server-side function via NowJS.

    3) Server processes action and calls client-side Construct 2 function via NowJS.

    4) Construct 2 processes the function and carry out the action.

    Or do I have to use clunky workarounds?

  • If I am not mistaken, you could use AJAX to query the NodeJS server.

  • If I am not mistaken, you could use AJAX to query the NodeJS server.

    I am using HTML5 web-sockets (via NodeJS and instead of AJAX. (to achieve "server push", one typically use either AJAX or websockets but not both)

    Does Construct 2 work easily with HTML5 web-sockets, and various other HTML5 technologies like NodeJS and

  • If you're good with Javascript, you can do any kind of javascript coding within C2 using the Javascript SDK.

  • If you're good with Javascript, you can do any kind of javascript coding within C2 using the Javascript SDK.

    Looks like everything has to be done with "plug-ins". I don't know, I am used to less restrictive Javascript game engines.


    The chat plug-in looks complicated. On the other hand, if you have a node.js server up, chat is just a few lines:

    1. HTML text input form. Sends text to server-side function.

    2. Server-side function calls client-side function.

    3. Append HTML with the text.

    I hate to get bogged down with trying to get basic functionality working with Construct 2.

  • Unfortunately at this time C2 going multiplayer through other api's(NowJS, Photon...) is a hurdle in that a plugin needs to be coded. Someone already did a plugin, but your limited to straight up socket commands without any api that bridges with a server :(. It's an api to work with, but you have to be up to working in code for the server and covering a lot of reinvention of the wheel.

    There was an individual who was working on a nowjs plugin, but that project and the user hasn't been seen from in a while. I'm thinking about doing a nowjs plugin, but I'm notoriously slow and get distracted by shinies :P

  • Legendre: have you checked this topic, more up to date than rex's chat plug ?

  • Obviously there's going to be some overhead involved in creating and working with a plugin to achieve your multi-player functionality, so you really have to decide whether or not the productivity gains from working with Construct 2 are enough to balance that out.

    For a single or small number of projects of smaller scope it may not be worth having to spend the time, but if you're planning on using these platforms repeatedly over a number of projects it will probably start to become more worthwhile -- once you've coded your plug-in, assuming you do a good job of it, you should then be able to simply drop it into multiple projects with only minor adjustments where necessary.

    I'd suggest spending a couple of days evaluating the workflow of the free version of Construct 2 and examining the plug-in API so that you can make a more informed decision based on your own needs; only you can really judge how suitable (or not) Construct 2 will be for the types of projects you're working on, and only you will be able to estimate just how much time and effort you might be able to save when compared to working with the libraries you mentioned.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for all the input! :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)