Cocos engine in node.js

Cocos engine in node.js
0.0 0


Hi i have developed a game with cocos creator and now i want to make it multiplayer with nodejs.

I want my server can handle object create, destroy, movement and collider event like in cocos creator.

Can u tell me how to use cocos core/engine in nodejs server.

I searched and try cocos engine github but dont know how to use it ( I build it via gulp successfully, play the test unit in browser ok but dont know how to achieve my need)


No Idea, just thought interesting idea. Sounds like will be much fun. I will be getting deep into Node after may :slight_smile:


Let me ask our engineering team to take a look. I think know this info would be beneficial to all Creator developers.


Yes Brilliant - Having your engineers look and comment would be valuable. The Jedi Coders :slight_smile:


You should simulate an editor environment. Search “Editor”, “process”, “electron” in the engine code to see how to achieve it. And try something like

global.Editor = {
    isMainProcess: true
process.versions = { electron: "" };

Simulate cocos engine in nodejs

Hi i now can use engine in Editor environment :slight_smile:

global.Editor = {
    isMainProcess: true,
process.versions.electron = "";

var em = require("./engine-master");
for(var i in cc){

But since it is in environment, there is no node object so i cant use the Node Action rules as i want. I will research about it, but any help is so wonderful.


I have gone to this so far :slight_smile:



var new_node = new _ccsg.Node();
var action = new cc.MoveTo(0.5,cc.p(640,360));
cc.director = new cc.Director();
console.log(new Date());
    console.log(new Date());

It doesn’t work yet, but it is still a good signal :smiley: